函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\notify\fanotify\fanotify.c Create Date:2022-07-29 10:49:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:fanotify_alloc_event

函数原型: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)

返回类型:struct fanotify_event

参数:

类型参数名称
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  如果 maximum events allowed on the list 恒等于UINT_MAXgfp或等于__GFP_NOFAIL
296  否则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  如果fanotify_is_perm_event(mask)则
305  pevent等于分配高速缓存区
306  如果非pevent则转到:out
308  event等于fae
309  userspace answer to the event 等于0
310  state of the event 等于FAN_EVENT_INIT
311  转到:init
313  event等于分配高速缓存区
314  如果非event则转到:out
316  init :
316  fsnotify_init_event( & fse, inode)
318  mask等于mask
319  如果FAN_GROUP_FLAG(group, vent->pid is thread id )则pid等于get_pid(task_pid(当前进程))
321  否则pid等于get_pid(task_tgid(当前进程))
323  fh_len等于0
324  如果idFAN_GROUP_FLAG(group, Report unique file id )则
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  否则如果data_type恒等于FSNOTIFY_EVENT_PATH
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  否则
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  返回:event
调用者
名称描述
fanotify_handle_event
SYSCALL_DEFINE2anotify syscalls