Skip to content

Commit 01affd5

Browse files
committed
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 <[email protected]>
1 parent d766b55 commit 01affd5

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

fs/notify/fanotify/fanotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ init: __maybe_unused
387387
else
388388
event->pid = get_pid(task_tgid(current));
389389

390-
if (fanotify_event_has_fid(event)) {
390+
if (fanotify_event_object_fh(event)) {
391391
ffe->object_fh.len = 0;
392392
if (fsid)
393393
ffe->fsid = *fsid;

fs/notify/fanotify/fanotify.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ FANOTIFY_FE(struct fanotify_event *event)
8383
return container_of(event, struct fanotify_fid_event, fae);
8484
}
8585

86-
static inline bool fanotify_event_has_fid(struct fanotify_event *event)
87-
{
88-
return event->type == FANOTIFY_EVENT_TYPE_FID;
89-
}
90-
9186
static inline __kernel_fsid_t *fanotify_event_fsid(struct fanotify_event *event)
9287
{
9388
if (event->type == FANOTIFY_EVENT_TYPE_FID)

fs/notify/fanotify/fanotify_user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
275275
metadata.mask = event->mask & FANOTIFY_OUTGOING_EVENTS;
276276
metadata.pid = pid_vnr(event->pid);
277277

278-
if (fanotify_event_has_fid(event)) {
278+
if (fanotify_event_object_fh(event)) {
279279
metadata.event_len += fanotify_event_info_len(event);
280280
} else if (path && path->mnt && path->dentry) {
281281
fd = create_fd(group, path, &f);
@@ -300,7 +300,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
300300

301301
if (f) {
302302
fd_install(fd, f);
303-
} else if (fanotify_event_has_fid(event)) {
303+
} else if (fanotify_event_object_fh(event)) {
304304
ret = copy_fid_to_user(fanotify_event_fsid(event),
305305
fanotify_event_object_fh(event),
306306
buf + FAN_EVENT_METADATA_LEN);

0 commit comments

Comments
 (0)