Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\notify\fanotify\fanotify.c Create Date:2022-07-28 20:18:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fanotify_alloc_event

Proto:struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, struct inode *inode, unsigned int mask, const void *data, int data_type, __kernel_fsid_t *fsid)

Type:struct fanotify_event

Parameter:

TypeParameterName
struct fsnotify_group *group
struct inode *inode
unsigned intmask
const void *data
intdata_type
__kernel_fsid_t *fsid
284  struct fanotify_event * event = NULL
285  gfp = GFP_KERNEL_ACCOUNT
286  id = The inode to use as identifier when reporting fid depends on the event.* Report the modified directory inode on dirent modification events.* Report the "victim" inode otherwise.* For example:
294  If maximum events allowed on the list == UINT_MAX Then gfp |= __GFP_NOFAIL
296  Else gfp |= __GFP_RETRY_MAYFAIL
300  memalloc_use_memcg - Starts the remote memcg charging scope.*@memcg: memcg to charge.* This function marks the beginning of the remote memcg charging scope. All the* __GFP_ACCOUNT allocations till the end of the scope will be charged to the* given memcg.
302  If fanotify_is_perm_event(mask) Then
305  pevent = kmem_cache_alloc(fanotify_perm_event_cachep, gfp)
306  If Not pevent Then Go to out
308  event = fae
309  userspace answer to the event = 0
310  state of the event = FAN_EVENT_INIT
311  Go to init
313  event = kmem_cache_alloc(fanotify_event_cachep, gfp)
314  If Not event Then Go to out
316  init :
316  fsnotify_init_event( & fse, inode)
318  mask = mask
319  If FAN_GROUP_FLAG(group, vent->pid is thread id ) Then pid = get_pid(task_pid(current process))
321  Else pid = get_pid(task_tgid(current process))
323  fh_len = 0
324  If id && FAN_GROUP_FLAG(group, Report unique file id ) Then
326  Those fields are outside fanotify_fid to pack fanotify_event nicely* on 64bit arch and to use fh_type as an indication of whether path* or fid are used in the union:* FILEID_ROOT (0) for path, > 0 for fid, FILEID_INVALID for neither. = fanotify_encode_fid(event, id, gfp, fsid)
327  Else if data_type == FSNOTIFY_EVENT_PATH Then
328  Those fields are outside fanotify_fid to pack fanotify_event nicely* on 64bit arch and to use fh_type as an indication of whether path* or fid are used in the union:* FILEID_ROOT (0) for path, > 0 for fid, FILEID_INVALID for neither. = FILEID_ROOT
329  We hold ref to this path so it may be dereferenced at any* point during this object's lifetime = *data
330  path_get - get a reference to a path*@path: path to get the reference to* Given a path increment the reference count to the dentry and the vfsmount.
331  Else
332  Those fields are outside fanotify_fid to pack fanotify_event nicely* on 64bit arch and to use fh_type as an indication of whether path* or fid are used in the union:* FILEID_ROOT (0) for path, > 0 for fid, FILEID_INVALID for neither. = FILEID_INVALID
333  mnt = NULL
334  dentry = NULL
336  out :
337  memalloc_unuse_memcg - Ends the remote memcg charging scope.* This function marks the end of the remote memcg charging scope started by* memalloc_use_memcg().
338  Return event
Caller
NameDescribe
fanotify_handle_event
SYSCALL_DEFINE2anotify syscalls