Shrink fanotify_event_metadata by 32 bits
PATCH 1/1 Shrink fanotify_event_metadata by 32 bits
There seems to be no point wasting 32 bits for either the event version or length
---
Hi.
While I'm working on the file modification events, please consider this patch. It obviously breaks the userspace ABI. But maybe that's acceptable, given that no kernel has ever been released with the old ABI.
And the users only need to recompile their code, without changing anything.
If we agree that this change is desirable, please make sure it makes it to Linus before the release. ;)
include/linux/fanotify.h | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
include/linux/fanotify.h +4 -3
@@ -86,10 +86,11 @@#define FANOTIFY_METADATA_VERSION 2struct fanotify_event_metadata { -__u32 event_len; -__u32 vers; -__aligned_u64 mask; +__u16 event_len; +__u8 vers; +__u8 reserved;__s32 fd; +__aligned_u64 mask;__s32 pid; };
Ok, just so you know, the real motivation is to use the '__u8 reserved' for an offset to the first option's header. This way we should be able to add a reasonable number of new core fields to struct fanotify_event_metadata, and still maintain backwards compatibility. I'd have to add an other __u32 for that purpose, so we are actually saving 64 bits per event with this patch.
Quoted 43 lines · Alexey Zaytsev
There seems to be no point wasting 32 bits for either the event version or length
Signed-off-by Alexey Zaytsev <[email protected]>---
Hi.
While I'm working on the file modification events, please consider this patch. It obviously breaks the userspace ABI. But maybe that's acceptable, given that no kernel has ever been released with the old ABI.
And the users only need to recompile their code, without changing anything.
If we agree that this change is desirable, please make sure it makes it to Linus before the release. ;)
include/linux/fanotify.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)include/linux/fanotify.h +4
-3@@ -86,10 +86,11 @@ #define FANOTIFY_METADATA_VERSION 2 struct fanotify_event_metadata { - __u32 event_len; - __u32 vers; - __aligned_u64 mask; + __u16 event_len; + __u8 vers; + __u8 reserved; __s32 fd; + __aligned_u64 mask; __s32 pid; };