aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fsnotify.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fsnotify.h')
-rw-r--r--include/linux/fsnotify.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index b8cf161f5a6d..64efda9aae62 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -34,6 +34,25 @@ static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u
34 __fsnotify_parent(path, dentry, mask); 34 __fsnotify_parent(path, dentry, mask);
35} 35}
36 36
37/* simple call site for access decisions */
38static inline int fsnotify_perm(struct file *file, int mask)
39{
40 struct path *path = &file->f_path;
41 struct inode *inode = path->dentry->d_inode;
42 __u32 fsnotify_mask;
43
44 if (file->f_mode & FMODE_NONOTIFY)
45 return 0;
46 if (!(mask & (MAY_READ | MAY_OPEN)))
47 return 0;
48 if (mask & MAY_READ)
49 fsnotify_mask = FS_ACCESS_PERM;
50 if (mask & MAY_OPEN)
51 fsnotify_mask = FS_OPEN_PERM;
52
53 return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
54}
55
37/* 56/*
38 * fsnotify_d_move - dentry has been moved 57 * fsnotify_d_move - dentry has been moved
39 * Called with dcache_lock and dentry->d_lock held. 58 * Called with dcache_lock and dentry->d_lock held.