fsnotify: generalize iteration of marks by object type

Make some code that handles marks of object types inode and vfsmount
generic, so it can handle other object types.

Introduce fsnotify_foreach_obj_type macro to iterate marks by object type
and fsnotify_iter_{should|set}_report_type macros to set/test report_mask.

This is going to be used for adding mark of another object type
(super block mark).

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Amir Goldstein
2018-04-20 16:10:52 -07:00
committed by Jan Kara
parent d9a6f30bb8
commit 47d9c7cc45
4 changed files with 72 additions and 39 deletions

View File

@@ -485,10 +485,10 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
struct fsnotify_group *group)
{
struct inotify_inode_mark *i_mark;
struct fsnotify_iter_info iter_info = {
.inode_mark = fsn_mark,
.report_mask = FSNOTIFY_OBJ_TYPE_INODE_FL,
};
struct fsnotify_iter_info iter_info = { };
fsnotify_iter_set_report_type_mark(&iter_info, FSNOTIFY_OBJ_TYPE_INODE,
fsn_mark);
/* Queue ignore event for the watch */
inotify_handle_event(group, NULL, FS_IN_IGNORED, NULL,