diff options
Diffstat (limited to 'include/linux/fanotify.h')
| -rw-r--r-- | include/linux/fanotify.h | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h index f0949a57ca9d..0f0121467fc4 100644 --- a/include/linux/fanotify.h +++ b/include/linux/fanotify.h | |||
| @@ -6,18 +6,19 @@ | |||
| 6 | /* the following events that user-space can register for */ | 6 | /* the following events that user-space can register for */ |
| 7 | #define FAN_ACCESS 0x00000001 /* File was accessed */ | 7 | #define FAN_ACCESS 0x00000001 /* File was accessed */ |
| 8 | #define FAN_MODIFY 0x00000002 /* File was modified */ | 8 | #define FAN_MODIFY 0x00000002 /* File was modified */ |
| 9 | #define FAN_CLOSE_WRITE 0x00000008 /* Unwrittable file closed */ | 9 | #define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */ |
| 10 | #define FAN_CLOSE_NOWRITE 0x00000010 /* Writtable file closed */ | 10 | #define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */ |
| 11 | #define FAN_OPEN 0x00000020 /* File was opened */ | 11 | #define FAN_OPEN 0x00000020 /* File was opened */ |
| 12 | 12 | ||
| 13 | #define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */ | ||
| 14 | |||
| 15 | /* FIXME currently Q's have no limit.... */ | ||
| 16 | #define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ | 13 | #define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ |
| 17 | 14 | ||
| 18 | #define FAN_OPEN_PERM 0x00010000 /* File open in perm check */ | 15 | #define FAN_OPEN_PERM 0x00010000 /* File open in perm check */ |
| 19 | #define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */ | 16 | #define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */ |
| 20 | 17 | ||
| 18 | #define FAN_ONDIR 0x40000000 /* event occurred against dir */ | ||
| 19 | |||
| 20 | #define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */ | ||
| 21 | |||
| 21 | /* helper events */ | 22 | /* helper events */ |
| 22 | #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */ | 23 | #define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */ |
| 23 | 24 | ||
| @@ -25,7 +26,19 @@ | |||
| 25 | #define FAN_CLOEXEC 0x00000001 | 26 | #define FAN_CLOEXEC 0x00000001 |
| 26 | #define FAN_NONBLOCK 0x00000002 | 27 | #define FAN_NONBLOCK 0x00000002 |
| 27 | 28 | ||
| 28 | #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK) | 29 | /* These are NOT bitwise flags. Both bits are used togther. */ |
| 30 | #define FAN_CLASS_NOTIF 0x00000000 | ||
| 31 | #define FAN_CLASS_CONTENT 0x00000004 | ||
| 32 | #define FAN_CLASS_PRE_CONTENT 0x00000008 | ||
| 33 | #define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \ | ||
| 34 | FAN_CLASS_PRE_CONTENT) | ||
| 35 | |||
| 36 | #define FAN_UNLIMITED_QUEUE 0x00000010 | ||
| 37 | #define FAN_UNLIMITED_MARKS 0x00000020 | ||
| 38 | |||
| 39 | #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ | ||
| 40 | FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ | ||
| 41 | FAN_UNLIMITED_MARKS) | ||
| 29 | 42 | ||
| 30 | /* flags used for fanotify_modify_mark() */ | 43 | /* flags used for fanotify_modify_mark() */ |
| 31 | #define FAN_MARK_ADD 0x00000001 | 44 | #define FAN_MARK_ADD 0x00000001 |
| @@ -36,6 +49,10 @@ | |||
| 36 | #define FAN_MARK_IGNORED_MASK 0x00000020 | 49 | #define FAN_MARK_IGNORED_MASK 0x00000020 |
| 37 | #define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040 | 50 | #define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040 |
| 38 | #define FAN_MARK_FLUSH 0x00000080 | 51 | #define FAN_MARK_FLUSH 0x00000080 |
| 52 | #ifdef __KERNEL__ | ||
| 53 | /* not valid from userspace, only kernel internal */ | ||
| 54 | #define FAN_MARK_ONDIR 0x00000100 | ||
| 55 | #endif | ||
| 39 | 56 | ||
| 40 | #define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\ | 57 | #define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\ |
| 41 | FAN_MARK_REMOVE |\ | 58 | FAN_MARK_REMOVE |\ |
| @@ -43,7 +60,8 @@ | |||
| 43 | FAN_MARK_ONLYDIR |\ | 60 | FAN_MARK_ONLYDIR |\ |
| 44 | FAN_MARK_MOUNT |\ | 61 | FAN_MARK_MOUNT |\ |
| 45 | FAN_MARK_IGNORED_MASK |\ | 62 | FAN_MARK_IGNORED_MASK |\ |
| 46 | FAN_MARK_IGNORED_SURV_MODIFY) | 63 | FAN_MARK_IGNORED_SURV_MODIFY |\ |
| 64 | FAN_MARK_FLUSH) | ||
| 47 | 65 | ||
| 48 | /* | 66 | /* |
| 49 | * All of the events - we build the list by hand so that we can add flags in | 67 | * All of the events - we build the list by hand so that we can add flags in |
| @@ -65,15 +83,15 @@ | |||
| 65 | FAN_ALL_PERM_EVENTS |\ | 83 | FAN_ALL_PERM_EVENTS |\ |
| 66 | FAN_Q_OVERFLOW) | 84 | FAN_Q_OVERFLOW) |
| 67 | 85 | ||
| 68 | #define FANOTIFY_METADATA_VERSION 1 | 86 | #define FANOTIFY_METADATA_VERSION 2 |
| 69 | 87 | ||
| 70 | struct fanotify_event_metadata { | 88 | struct fanotify_event_metadata { |
| 71 | __u32 event_len; | 89 | __u32 event_len; |
| 72 | __u32 vers; | 90 | __u32 vers; |
| 91 | __aligned_u64 mask; | ||
| 73 | __s32 fd; | 92 | __s32 fd; |
| 74 | __u64 mask; | 93 | __s32 pid; |
| 75 | __s64 pid; | 94 | }; |
| 76 | } __attribute__ ((packed)); | ||
| 77 | 95 | ||
| 78 | struct fanotify_response { | 96 | struct fanotify_response { |
| 79 | __s32 fd; | 97 | __s32 fd; |
| @@ -95,11 +113,4 @@ struct fanotify_response { | |||
| 95 | (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \ | 113 | (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \ |
| 96 | (long)(meta)->event_len <= (long)(len)) | 114 | (long)(meta)->event_len <= (long)(len)) |
| 97 | 115 | ||
| 98 | #ifdef __KERNEL__ | ||
| 99 | |||
| 100 | struct fanotify_wait { | ||
| 101 | struct fsnotify_event *event; | ||
| 102 | __s32 fd; | ||
| 103 | }; | ||
| 104 | #endif /* __KERNEL__ */ | ||
| 105 | #endif /* _LINUX_FANOTIFY_H */ | 116 | #endif /* _LINUX_FANOTIFY_H */ |
