Skip to content

Commit 2c50694

Browse files
krisman-at-collaborajankara
authored andcommitted
fanotify: Wrap object_fh inline space in a creator macro
fanotify_error_event would duplicate this sequence of declarations that already exist elsewhere with a slight different size. Create a helper macro to avoid code duplication. Link: https://lore.kernel.org/r/[email protected] Suggested-by: Jan Kara <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 8a6ae64 commit 2c50694

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

fs/notify/fanotify/fanotify.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,18 @@ static inline void fanotify_init_event(struct fanotify_event *event,
171171
event->pid = NULL;
172172
}
173173

174+
#define FANOTIFY_INLINE_FH(name, size) \
175+
struct { \
176+
struct fanotify_fh (name); \
177+
/* Space for object_fh.buf[] - access with fanotify_fh_buf() */ \
178+
unsigned char _inline_fh_buf[(size)]; \
179+
}
180+
174181
struct fanotify_fid_event {
175182
struct fanotify_event fae;
176183
__kernel_fsid_t fsid;
177-
struct fanotify_fh object_fh;
178-
/* Reserve space in object_fh.buf[] - access with fanotify_fh_buf() */
179-
unsigned char _inline_fh_buf[FANOTIFY_INLINE_FH_LEN];
184+
185+
FANOTIFY_INLINE_FH(object_fh, FANOTIFY_INLINE_FH_LEN);
180186
};
181187

182188
static inline struct fanotify_fid_event *

0 commit comments

Comments
 (0)