Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207649
b: refs/heads/master
c: ecf081d
h: refs/heads/master
i:
  207647: 006ebcc
v: v3
  • Loading branch information
Eric Paris committed Jul 28, 2010
1 parent 3cec27a commit 0b1d75c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35566087099c3ff8901d65ee98af56347ee66e5a
refs/heads/master: ecf081d1a73b077916f514f2ec744ded32b88ca1
8 changes: 8 additions & 0 deletions trunk/include/asm-generic/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

#include <linux/types.h>

/*
* FMODE_EXEC is 0x20
* FMODE_NONOTIFY is 0x800000
* These cannot be used by userspace O_* until internal and external open
* flags are split.
* -Eric Paris
*/

#define O_ACCMODE 00000003
#define O_RDONLY 00000000
#define O_WRONLY 00000001
Expand Down
6 changes: 5 additions & 1 deletion trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ struct inodes_stat_t {
/* Expect random access pattern */
#define FMODE_RANDOM ((__force fmode_t)0x1000)

/* File was opened by fanotify and shouldn't generate fanotify events */
#define FMODE_NONOTIFY ((__force fmode_t)8388608)

/*
* The below are the various read and write types that we support. Some of
* them include behavioral modifiers that send information down to the
Expand Down Expand Up @@ -2508,7 +2511,8 @@ int proc_nr_files(struct ctl_table *table, int write,
int __init get_filesystem_list(char *buf);

#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE))
#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
(flag & FMODE_NONOTIFY)))

#endif /* __KERNEL__ */
#endif /* _LINUX_FS_H */
24 changes: 16 additions & 8 deletions trunk/include/linux/fsnotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ static inline void fsnotify_access(struct file *file)
if (S_ISDIR(inode->i_mode))
mask |= FS_IN_ISDIR;

fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
if (!(file->f_mode & FMODE_NONOTIFY)) {
fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
}
}

/*
Expand All @@ -181,8 +183,10 @@ static inline void fsnotify_modify(struct file *file)
if (S_ISDIR(inode->i_mode))
mask |= FS_IN_ISDIR;

fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
if (!(file->f_mode & FMODE_NONOTIFY)) {
fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
}
}

/*
Expand All @@ -197,8 +201,10 @@ static inline void fsnotify_open(struct file *file)
if (S_ISDIR(inode->i_mode))
mask |= FS_IN_ISDIR;

fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
if (!(file->f_mode & FMODE_NONOTIFY)) {
fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
}
}

/*
Expand All @@ -214,8 +220,10 @@ static inline void fsnotify_close(struct file *file)
if (S_ISDIR(inode->i_mode))
mask |= FS_IN_ISDIR;

fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
if (!(file->f_mode & FMODE_NONOTIFY)) {
fsnotify_parent(path, NULL, mask);
fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
}
}

/*
Expand Down

0 comments on commit 0b1d75c

Please sign in to comment.