函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:copy_event_to_user

函数原型:static ssize_t copy_event_to_user(struct fsnotify_group *group, struct fsnotify_event *fsn_event, char __user *buf, size_t count)

返回类型:ssize_t

参数:

类型参数名称
struct fsnotify_group *group
struct fsnotify_event *fsn_event
char __user *buf
size_tcount
265  struct file * f = NULL
266  fd等于No fd set in event
268  pr_debug("%s: group=%p event=%p\n", __func__, group, fsn_event)
270  event等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(fsn_event, structfanotify_event, fse)
271  event_len等于Helper functions to deal with fanotify_event_metadata buffers
272  metadata_len等于Helper functions to deal with fanotify_event_metadata buffers
273  vers等于FANOTIFY_METADATA_VERSION
274  reserved等于0
275  mask等于mask按位与Events that may be reported to user
276  pid等于pid_vnr(pid)
278  如果fanotify_event_has_path(event)则
279  fd等于create_fd(group, event, & f)
280  如果fd小于0则返回:fd
282  否则如果fanotify_event_has_fid(event)则
283  event_len加等于fanotify_event_info_len(event)
285  fd等于fd
287  ret等于负EFAULT
292  如果WARN_ON_ONCE(event_len > count)则转到:out_close_fd
295  如果copy_to_user(buf, & metadata, Helper functions to deal with fanotify_event_metadata buffers )则转到:out_close_fd
298  如果fanotify_is_perm_event(mask)则d we passed to userspace for this event 等于fd
301  如果fanotify_event_has_path(event)则
302  fd_install(fd, f)
303  否则如果fanotify_event_has_fid(event)则
304  ret等于copy_fid_to_user(event, buf + Helper functions to deal with fanotify_event_metadata buffers )
305  如果ret小于0则返回:ret
309  返回:event_len
311  out_close_fd :
312  如果fd不等于No fd set in event
313  put_unused_fd(fd)
314  fput(f)
316  返回:ret
调用者
名称描述
fanotify_read