History

fsnotify: pass dir argument to handle_event() callback

The 'inode' argument to handle_event(), sometimes referred to as 'to_tell' is somewhat obsolete. It is a remnant from the times when a group could only have an inode mark associated with an event. We now pass an iter_info array to the callback, with all marks associated with an event. Most backends ignore this argument, with two exceptions: 1. dnotify uses it for sanity check that event is on directory 2. fanotify uses it to report fid of directory on directory entry modification events Remove the 'inode' argument and add a 'dir' argument. The callback function signature is deliberately changed, because the meaning of the argument has changed and the arguments have been documented. The 'dir' argument is set to when 'file_name' is specified and it is referring to the directory that the 'file_name' entry belongs to.

Amir Goldstein committed 6 years ago

Commit b54cecf1 parent 9c61f3b11 files · +62 −56Browse files

Showing the changes to include/linux (1 of 11 files). Show all

Unified · Split

include/linux/fsnotify_backend.h+13−3
@@ -108,6 +108,17 @@ struct mem_cgroup; · 107 unmodified lines
108108 * these operations for each relevant group.
109109 *
110110 * handle_event - main call for a group to handle an fs event
111+ * @group: group to notify
112+ * @mask: event type and flags
113+ * @data: object that event happened on
114+ * @data_type: type of object for fanotify_data_XXX() accessors
115+ * @dir: optional directory associated with event -
116+ * if @file_name is not NULL, this is the directory that
117+ * @file_name is relative to
118+ * @file_name: optional file name associated with event
119+ * @cookie: inotify rename cookie
120+ * @iter_info: array of marks from this group that are interested in the event
121+ *
111122 * free_group_priv - called when a group refcnt hits 0 to clean up the private union
112123 * freeing_mark - called when a mark is being destroyed for some reason. The group
113124 * MUST be holding a reference on each mark and that reference must be
@@ -115,9 +126,8 @@ struct mem_cgroup; · 1 unmodified line
115126 * userspace messages that marks have been removed.
116127 */
117128 struct fsnotify_ops {
118− int (*handle_event)(struct fsnotify_group *group,
119− struct inode *inode,
120− u32 mask, const void *data, int data_type,
129+ int (*handle_event)(struct fsnotify_group *group, u32 mask,
130+ const void *data, int data_type, struct inode *dir,
121131 const struct qstr *file_name, u32 cookie,
122132 struct fsnotify_iter_info *iter_info);
123133 void (*free_group_priv)(struct fsnotify_group *group);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t