Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:copy_fid_to_user

Proto:static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)

Type:int

Parameter:

TypeParameterName
struct fanotify_event *event
char __user *buf
209  struct fanotify_event_info_fid info = {}
210  struct file_handle handle = {}
212  fh_len = fh_len
213  len = fanotify_event_info_len(event)
215  If Not len Then Return 0
218  If WARN_ON_ONCE(len < size of info + size of handle + fh_len) Then Return -EFAULT
222  info_type = FAN_EVENT_INFO_TYPE_FID
223  len = len
224  fsid = fsid
225  If copy_to_user(buf, & info, size of info ) Then Return -EFAULT
228  buf += size of info
229  len -= size of info
230  handle_type = 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.
231  handle_bytes = fh_len
232  If copy_to_user(buf, & handle, size of handle ) Then Return -EFAULT
235  buf += size of handle
236  len -= size of handle
241  fh = fanotify_event_fh(event)
242  If fh_len <= 3 dwords are sufficient for most local fs (64bit ino, 32bit generation) Then
243  memcpy(bounce, fh, fh_len)
244  fh = bounce
246  If copy_to_user(buf, fh, fh_len) Then Return -EFAULT
250  buf += fh_len
251  len -= fh_len
252  WARN_ON_ONCE(len < 0 || len >= FANOTIFY_EVENT_ALIGN)
253  If len > 0 && lear_user - Zero a block of memory in user space.*@to: Destination address, in user space.*@n: Number of bytes to zero.* Zero a block of memory in user space.* Return: number of bytes that could not be cleared.* On success, this will be zero. Then Return -EFAULT
256  Return 0
Caller
NameDescribe
copy_event_to_user