Add notifications for attaching and detaching mounts. The following new event masks are added: FAN_MNT_ATTACH - Mount was attached FAN_MNT_DETACH - Mount was detached If a mount is moved, then the event is reported with (FAN_MNT_ATTACH | FAN_MNT_DETACH). These events add an info record of type FAN_EVENT_INFO_TYPE_MNT containing these fields identifying the affected mounts: __u64 mnt_id - the ID of the mount (see statmount(2)) FAN_REPORT_MNT must be supplied to fanotify_init() to receive these events and no other type of event can be received with this report type. Marks are added with FAN_MARK_MNTNS, which records the mount namespace from an nsfs file (e.g. /proc/self/ns/mnt).
Showing the changes to include/uapi/linux (1 of 8 files). Show all
Unified · Split
| @@ -28,6 +28,8 @@ · 27 unmodified lines | ||
| 28 | 28 | /* #define FAN_DIR_MODIFY 0x00080000 */ /* Deprecated (reserved) */ |
| 29 | 29 | |
| 30 | 30 | #define FAN_PRE_ACCESS 0x00100000 /* Pre-content access hook */ |
| 31 | +#define FAN_MNT_ATTACH 0x01000000 /* Mount was attached */ | |
| 32 | +#define FAN_MNT_DETACH 0x02000000 /* Mount was detached */ | |
| 31 | 33 | |
| 32 | 34 | #define FAN_EVENT_ON_CHILD 0x08000000 /* Interested in child events */ |
| 33 | 35 | |
| @@ -64,6 +66,7 @@ · 30 unmodified lines | ||
| 64 | 66 | #define FAN_REPORT_NAME 0x00000800 /* Report events with name */ |
| 65 | 67 | #define FAN_REPORT_TARGET_FID 0x00001000 /* Report dirent target id */ |
| 66 | 68 | #define FAN_REPORT_FD_ERROR 0x00002000 /* event->fd can report error */ |
| 69 | +#define FAN_REPORT_MNT 0x00004000 /* Report mount events */ | |
| 67 | 70 | |
| 68 | 71 | /* Convenience macro - FAN_REPORT_NAME requires FAN_REPORT_DIR_FID */ |
| 69 | 72 | #define FAN_REPORT_DFID_NAME (FAN_REPORT_DIR_FID | FAN_REPORT_NAME) |
| @@ -94,6 +97,7 @@ · 24 unmodified lines | ||
| 94 | 97 | #define FAN_MARK_INODE 0x00000000 |
| 95 | 98 | #define FAN_MARK_MOUNT 0x00000010 |
| 96 | 99 | #define FAN_MARK_FILESYSTEM 0x00000100 |
| 100 | +#define FAN_MARK_MNTNS 0x00000110 | |
| 97 | 101 | |
| 98 | 102 | /* |
| 99 | 103 | * Convenience macro - FAN_MARK_IGNORE requires FAN_MARK_IGNORED_SURV_MODIFY |
| @@ -147,6 +151,7 @@ struct fanotify_event_metadata { · 47 unmodified lines | ||
| 147 | 151 | #define FAN_EVENT_INFO_TYPE_PIDFD 4 |
| 148 | 152 | #define FAN_EVENT_INFO_TYPE_ERROR 5 |
| 149 | 153 | #define FAN_EVENT_INFO_TYPE_RANGE 6 |
| 154 | +#define FAN_EVENT_INFO_TYPE_MNT 7 | |
| 150 | 155 | |
| 151 | 156 | /* Special info types for FAN_RENAME */ |
| 152 | 157 | #define FAN_EVENT_INFO_TYPE_OLD_DFID_NAME 10 |
| @@ -200,6 +205,11 @@ struct fanotify_event_info_range { · 47 unmodified lines | ||
| 200 | 205 | __u64 count; |
| 201 | 206 | }; |
| 202 | 207 | |
| 208 | +struct fanotify_event_info_mnt { | |
| 209 | + struct fanotify_event_info_header hdr; | |
| 210 | + __u64 mnt_id; | |
| 211 | +}; | |
| 212 | + | |
| 203 | 213 | /* |
| 204 | 214 | * User space may need to record additional information about its decision. |
| 205 | 215 | * The extra information type records what kind of information is included. |