Commit 20dee624 authored by Eric Paris's avatar Eric Paris

fsnotify: check to make sure all fsnotify bits are unique

This patch adds a check to make sure that all fsnotify bits are unique and we
cannot accidentally use the same bit for 2 different fsnotify event types.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 44b350fc
...@@ -275,6 +275,8 @@ EXPORT_SYMBOL_GPL(fsnotify); ...@@ -275,6 +275,8 @@ EXPORT_SYMBOL_GPL(fsnotify);
static __init int fsnotify_init(void) static __init int fsnotify_init(void)
{ {
BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 23);
return init_srcu_struct(&fsnotify_grp_srcu); return init_srcu_struct(&fsnotify_grp_srcu);
} }
subsys_initcall(fsnotify_init); subsys_initcall(fsnotify_init);
...@@ -64,6 +64,15 @@ ...@@ -64,6 +64,15 @@
#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
struct fsnotify_group; struct fsnotify_group;
struct fsnotify_event; struct fsnotify_event;
struct fsnotify_mark; struct fsnotify_mark;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment