Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207662
b: refs/heads/master
c: 22aa425
h: refs/heads/master
v: v3
  • Loading branch information
Andreas Gruenbacher authored and Eric Paris committed Jul 28, 2010
1 parent d3911e3 commit 47e6dc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9bbfc964b89009d0cadcec7027afc92ee742e95e
refs/heads/master: 22aa425dec9e47051624714ae283eb2b6a473013
17 changes: 6 additions & 11 deletions trunk/fs/notify/fanotify/fanotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,14 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
return fsnotify_remove_notify_event(group);
}

static int create_and_fill_fd(struct fsnotify_group *group,
struct fanotify_event_metadata *metadata,
struct fsnotify_event *event)
static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
{
int client_fd;
struct dentry *dentry;
struct vfsmount *mnt;
struct file *new_file;

pr_debug("%s: group=%p metadata=%p event=%p\n", __func__, group,
metadata, event);
pr_debug("%s: group=%p event=%p\n", __func__, group, event);

client_fd = get_unused_fd();
if (client_fd < 0)
Expand Down Expand Up @@ -93,9 +90,7 @@ static int create_and_fill_fd(struct fsnotify_group *group,
fd_install(client_fd, new_file);
}

metadata->fd = client_fd;

return 0;
return client_fd;
}

static ssize_t fill_event_metadata(struct fsnotify_group *group,
Expand All @@ -108,9 +103,9 @@ static ssize_t fill_event_metadata(struct fsnotify_group *group,
metadata->event_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION;
metadata->mask = fanotify_outgoing_mask(event->mask);
metadata->fd = create_fd(group, event);

return create_and_fill_fd(group, metadata, event);

return metadata->fd;
}

static ssize_t copy_event_to_user(struct fsnotify_group *group,
Expand All @@ -123,7 +118,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
pr_debug("%s: group=%p event=%p\n", __func__, group, event);

ret = fill_event_metadata(group, &fanotify_event_metadata, event);
if (ret)
if (ret < 0)
return ret;

if (copy_to_user(buf, &fanotify_event_metadata, FAN_EVENT_METADATA_LEN))
Expand Down

0 comments on commit 47e6dc2

Please sign in to comment.