fs/notify/fanotify/fanotify.h
Source file repositories/reference/linux-study-clean/fs/notify/fanotify/fanotify.h
File Facts
- System
- Linux kernel
- Corpus path
fs/notify/fanotify/fanotify.h- Extension
.h- Size
- 15356 bytes
- Lines
- 556
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fsnotify_backend.hlinux/path.hlinux/slab.hlinux/string.hlinux/exportfs.hlinux/hashtable.h
Detected Declarations
struct fanotify_fhstruct fanotify_infostruct fanotify_eventstruct fanotify_fid_eventstruct fanotify_name_eventstruct fanotify_error_eventstruct fanotify_path_eventstruct fanotify_mnt_eventstruct fanotify_perm_eventstruct fanotify_markenum fanotify_event_typefunction fanotify_fh_has_ext_buffunction fanotify_info_dir_fh_lenfunction fanotify_info_dir2_fh_lenfunction fanotify_info_file_fh_lenfunction fanotify_info_initfunction fanotify_info_set_dir_fhfunction fanotify_info_set_dir2_fhfunction fanotify_info_set_file_fhfunction fanotify_info_copy_namefunction fanotify_info_copy_name2function fanotify_init_eventfunction FANOTIFY_FEfunction FANOTIFY_NEfunction FANOTIFY_EEfunction fanotify_event_object_fh_lenfunction fanotify_event_dir_fh_lenfunction fanotify_event_dir2_fh_lenfunction fanotify_event_has_object_fhfunction fanotify_event_has_dir_fhfunction fanotify_event_has_dir2_fhfunction fanotify_event_has_any_dir_fhfunction FANOTIFY_PEfunction FANOTIFY_MEfunction FANOTIFY_PERMfunction fanotify_is_perm_eventfunction fanotify_event_has_access_rangefunction fanotify_is_error_eventfunction fanotify_is_mnt_eventfunction fanotify_is_hashed_eventfunction fanotify_event_hash_bucketfunction fanotify_fsid_equalfunction fanotify_mark_user_flagsfunction fanotify_get_response_errno
Annotated Snippet
struct fanotify_fh {
u8 type;
u8 len;
#define FANOTIFY_FH_FLAG_EXT_BUF 1
u8 flags;
u8 pad;
} __aligned(4);
/* Variable size struct for dir file handle + child file handle + name */
struct fanotify_info {
/* size of dir_fh/file_fh including fanotify_fh hdr size */
u8 dir_fh_totlen;
u8 dir2_fh_totlen;
u8 file_fh_totlen;
u8 name_len;
u8 name2_len;
u8 pad[3];
unsigned char buf[];
/*
* (struct fanotify_fh) dir_fh starts at buf[0]
* (optional) dir2_fh starts at buf[dir_fh_totlen]
* (optional) file_fh starts at buf[dir_fh_totlen + dir2_fh_totlen]
* name starts at buf[dir_fh_totlen + dir2_fh_totlen + file_fh_totlen]
* ...
*/
#define FANOTIFY_DIR_FH_SIZE(info) ((info)->dir_fh_totlen)
#define FANOTIFY_DIR2_FH_SIZE(info) ((info)->dir2_fh_totlen)
#define FANOTIFY_FILE_FH_SIZE(info) ((info)->file_fh_totlen)
#define FANOTIFY_NAME_SIZE(info) ((info)->name_len + 1)
#define FANOTIFY_NAME2_SIZE(info) ((info)->name2_len + 1)
#define FANOTIFY_DIR_FH_OFFSET(info) 0
#define FANOTIFY_DIR2_FH_OFFSET(info) \
(FANOTIFY_DIR_FH_OFFSET(info) + FANOTIFY_DIR_FH_SIZE(info))
#define FANOTIFY_FILE_FH_OFFSET(info) \
(FANOTIFY_DIR2_FH_OFFSET(info) + FANOTIFY_DIR2_FH_SIZE(info))
#define FANOTIFY_NAME_OFFSET(info) \
(FANOTIFY_FILE_FH_OFFSET(info) + FANOTIFY_FILE_FH_SIZE(info))
#define FANOTIFY_NAME2_OFFSET(info) \
(FANOTIFY_NAME_OFFSET(info) + FANOTIFY_NAME_SIZE(info))
#define FANOTIFY_DIR_FH_BUF(info) \
((info)->buf + FANOTIFY_DIR_FH_OFFSET(info))
#define FANOTIFY_DIR2_FH_BUF(info) \
((info)->buf + FANOTIFY_DIR2_FH_OFFSET(info))
#define FANOTIFY_FILE_FH_BUF(info) \
((info)->buf + FANOTIFY_FILE_FH_OFFSET(info))
#define FANOTIFY_NAME_BUF(info) \
((info)->buf + FANOTIFY_NAME_OFFSET(info))
#define FANOTIFY_NAME2_BUF(info) \
((info)->buf + FANOTIFY_NAME2_OFFSET(info))
} __aligned(4);
static inline bool fanotify_fh_has_ext_buf(struct fanotify_fh *fh)
{
return (fh->flags & FANOTIFY_FH_FLAG_EXT_BUF);
}
static inline char **fanotify_fh_ext_buf_ptr(struct fanotify_fh *fh)
{
BUILD_BUG_ON(FANOTIFY_FH_HDR_LEN % 4);
BUILD_BUG_ON(__alignof__(char *) - 4 + sizeof(char *) >
FANOTIFY_INLINE_FH_LEN);
return (char **)ALIGN((unsigned long)(fh + 1), __alignof__(char *));
}
static inline void *fanotify_fh_ext_buf(struct fanotify_fh *fh)
{
return *fanotify_fh_ext_buf_ptr(fh);
}
static inline void *fanotify_fh_buf(struct fanotify_fh *fh)
{
return fanotify_fh_has_ext_buf(fh) ? fanotify_fh_ext_buf(fh) : fh + 1;
}
static inline int fanotify_info_dir_fh_len(struct fanotify_info *info)
{
if (!info->dir_fh_totlen ||
WARN_ON_ONCE(info->dir_fh_totlen < FANOTIFY_FH_HDR_LEN))
return 0;
return info->dir_fh_totlen - FANOTIFY_FH_HDR_LEN;
}
static inline struct fanotify_fh *fanotify_info_dir_fh(struct fanotify_info *info)
{
BUILD_BUG_ON(offsetof(struct fanotify_info, buf) % 4);
return (struct fanotify_fh *)FANOTIFY_DIR_FH_BUF(info);
Annotation
- Immediate include surface: `linux/fsnotify_backend.h`, `linux/path.h`, `linux/slab.h`, `linux/string.h`, `linux/exportfs.h`, `linux/hashtable.h`.
- Detected declarations: `struct fanotify_fh`, `struct fanotify_info`, `struct fanotify_event`, `struct fanotify_fid_event`, `struct fanotify_name_event`, `struct fanotify_error_event`, `struct fanotify_path_event`, `struct fanotify_mnt_event`, `struct fanotify_perm_event`, `struct fanotify_mark`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.