fanotify: Drop fanotify_event_has_fid()
authorJan Kara <jack@suse.cz>
Tue, 24 Mar 2020 18:35:07 +0000 (19:35 +0100)
committerJan Kara <jack@suse.cz>
Wed, 25 Mar 2020 09:27:16 +0000 (10:27 +0100)
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>
fs/notify/fanotify/fanotify.c
fs/notify/fanotify/fanotify.h
fs/notify/fanotify/fanotify_user.c

index 74676228f7840a7c7b1e4959847c633e12045cf3..ef39664e389c4d643a3bb1d07932359b86ff72e2 100644 (file)
@@ -387,7 +387,7 @@ init: __maybe_unused
        else
                event->pid = get_pid(task_tgid(current));
 
-       if (fanotify_event_has_fid(event)) {
+       if (fanotify_event_object_fh(event)) {
                ffe->object_fh.len = 0;
                if (fsid)
                        ffe->fsid = *fsid;
index 3b50ee44a0cdb10bed64b1d37c47ba576360e7c3..eecf4be3bfd1cee43ac5f86d869391ffcd558974 100644 (file)
@@ -83,11 +83,6 @@ FANOTIFY_FE(struct fanotify_event *event)
        return container_of(event, struct fanotify_fid_event, fae);
 }
 
-static inline bool fanotify_event_has_fid(struct fanotify_event *event)
-{
-       return event->type == FANOTIFY_EVENT_TYPE_FID;
-}
-
 static inline __kernel_fsid_t *fanotify_event_fsid(struct fanotify_event *event)
 {
        if (event->type == FANOTIFY_EVENT_TYPE_FID)
index 3a11f6a0339f9181c0d163a7abc3d9924f2dde2d..b93585406aadc45a3dc190cb9d6cb62eb30a53d7 100644 (file)
@@ -275,7 +275,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
        metadata.mask = event->mask & FANOTIFY_OUTGOING_EVENTS;
        metadata.pid = pid_vnr(event->pid);
 
-       if (fanotify_event_has_fid(event)) {
+       if (fanotify_event_object_fh(event)) {
                metadata.event_len += fanotify_event_info_len(event);
        } else if (path && path->mnt && path->dentry) {
                fd = create_fd(group, path, &f);
@@ -300,7 +300,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
 
        if (f) {
                fd_install(fd, f);
-       } else if (fanotify_event_has_fid(event)) {
+       } else if (fanotify_event_object_fh(event)) {
                ret = copy_fid_to_user(fanotify_event_fsid(event),
                                       fanotify_event_object_fh(event),
                                       buf + FAN_EVENT_METADATA_LEN);