Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fanotify: Drop fanotify_event_has_fid()

When some events have directory id and some object id,
fanotify_event_has_fid() becomes mostly useless and confusing because we
usually need to know which type of file handle the event has. So just
drop the function and use fanotify_event_object_fh() instead.

Signed-off-by: Jan Kara <jack@suse.cz>

Jan Kara 01affd54 d766b553

+3 -8
+1 -1
fs/notify/fanotify/fanotify.c
··· 387 387 else 388 388 event->pid = get_pid(task_tgid(current)); 389 389 390 - if (fanotify_event_has_fid(event)) { 390 + if (fanotify_event_object_fh(event)) { 391 391 ffe->object_fh.len = 0; 392 392 if (fsid) 393 393 ffe->fsid = *fsid;
-5
fs/notify/fanotify/fanotify.h
··· 83 83 return container_of(event, struct fanotify_fid_event, fae); 84 84 } 85 85 86 - static inline bool fanotify_event_has_fid(struct fanotify_event *event) 87 - { 88 - return event->type == FANOTIFY_EVENT_TYPE_FID; 89 - } 90 - 91 86 static inline __kernel_fsid_t *fanotify_event_fsid(struct fanotify_event *event) 92 87 { 93 88 if (event->type == FANOTIFY_EVENT_TYPE_FID)
+2 -2
fs/notify/fanotify/fanotify_user.c
··· 275 275 metadata.mask = event->mask & FANOTIFY_OUTGOING_EVENTS; 276 276 metadata.pid = pid_vnr(event->pid); 277 277 278 - if (fanotify_event_has_fid(event)) { 278 + if (fanotify_event_object_fh(event)) { 279 279 metadata.event_len += fanotify_event_info_len(event); 280 280 } else if (path && path->mnt && path->dentry) { 281 281 fd = create_fd(group, path, &f); ··· 300 300 301 301 if (f) { 302 302 fd_install(fd, f); 303 - } else if (fanotify_event_has_fid(event)) { 303 + } else if (fanotify_event_object_fh(event)) { 304 304 ret = copy_fid_to_user(fanotify_event_fsid(event), 305 305 fanotify_event_object_fh(event), 306 306 buf + FAN_EVENT_METADATA_LEN);