diff options
author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:37 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:50 -0400 |
commit | 20dee624ca40db227aa70cb3f44d2d6cb4fdbab4 (patch) | |
tree | 527888dd4cda99501b7ac16a3783f57251807c13 | |
parent | 44b350fc23e36e95c8e042b7ded66217ea2b9d72 (diff) |
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: Eric Paris <eparis@redhat.com>
-rw-r--r-- | fs/notify/fsnotify.c | 2 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 9810babb1a3..076c10e959d 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -275,6 +275,8 @@ EXPORT_SYMBOL_GPL(fsnotify); | |||
275 | 275 | ||
276 | static __init int fsnotify_init(void) | 276 | static __init int fsnotify_init(void) |
277 | { | 277 | { |
278 | BUG_ON(hweight32(ALL_FSNOTIFY_EVENTS) != 23); | ||
279 | |||
278 | return init_srcu_struct(&fsnotify_grp_srcu); | 280 | return init_srcu_struct(&fsnotify_grp_srcu); |
279 | } | 281 | } |
280 | subsys_initcall(fsnotify_init); | 282 | subsys_initcall(fsnotify_init); |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 4b809fcd499..a46355db1e4 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -64,6 +64,15 @@ | |||
64 | 64 | ||
65 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) | 65 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) |
66 | 66 | ||
67 | #define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \ | ||
68 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \ | ||
69 | FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \ | ||
70 | FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \ | ||
71 | FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \ | ||
72 | FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \ | ||
73 | FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \ | ||
74 | FS_DN_MULTISHOT | FS_EVENT_ON_CHILD) | ||
75 | |||
67 | struct fsnotify_group; | 76 | struct fsnotify_group; |
68 | struct fsnotify_event; | 77 | struct fsnotify_event; |
69 | struct fsnotify_mark; | 78 | struct fsnotify_mark; |