include/linux/exportfs.h
Source file repositories/reference/linux-study-clean/include/linux/exportfs.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/exportfs.h- Extension
.h- Size
- 12791 bytes
- Lines
- 399
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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/types.hlinux/path.h
Detected Declarations
struct dentrystruct exportfs_block_opsstruct inodestruct super_blockstruct vfsmountstruct fidstruct handle_to_path_ctxstruct export_operationsenum fid_typeenum handle_to_path_flagsfunction exportfs_cannot_lockfunction exportfs_can_encode_fidfunction exportfs_can_decode_fhfunction exportfs_may_exportfunction exportfs_can_encode_fhfunction exportfs_encode_fid
Annotated Snippet
struct fid {
union {
struct {
u32 ino;
u32 gen;
u32 parent_ino;
u32 parent_gen;
} i32;
struct {
u64 ino;
u32 gen;
} __packed i64;
struct {
u32 block;
u16 partref;
u16 parent_partref;
u32 generation;
u32 parent_block;
u32 parent_generation;
} udf;
DECLARE_FLEX_ARRAY(__u32, raw);
};
};
enum handle_to_path_flags {
HANDLE_CHECK_PERMS = (1 << 0),
HANDLE_CHECK_SUBTREE = (1 << 1),
};
struct handle_to_path_ctx {
struct path root;
enum handle_to_path_flags flags;
unsigned int fh_flags;
};
#define EXPORT_FH_CONNECTABLE 0x1 /* Encode file handle with parent */
#define EXPORT_FH_FID 0x2 /* File handle may be non-decodeable */
#define EXPORT_FH_DIR_ONLY 0x4 /* Only decode file handle for a directory */
/*
* Filesystems use only lower 8 bits of file_handle type for fid_type.
* name_to_handle_at() uses upper 16 bits of type as user flags to be
* interpreted by open_by_handle_at().
*/
#define FILEID_USER_FLAGS_MASK 0xffff0000
#define FILEID_USER_FLAGS(type) ((type) & FILEID_USER_FLAGS_MASK)
/* Flags supported in encoded handle_type that is exported to user */
#define FILEID_IS_CONNECTABLE 0x10000
#define FILEID_IS_DIR 0x20000
#define FILEID_VALID_USER_FLAGS (FILEID_IS_CONNECTABLE | FILEID_IS_DIR)
/**
* struct export_operations - for nfsd to communicate with file systems
* @encode_fh: encode a file handle fragment from a dentry
* @fh_to_dentry: find the implied object and get a dentry for it
* @fh_to_parent: find the implied object's parent and get a dentry for it
* @get_name: find the name for a given inode in a given directory
* @get_parent: find the parent of a given directory
* @commit_metadata: commit metadata changes to stable storage
*
* Methods for open_by_handle(2) syscall with special kernel file systems:
* @permission: custom permission for opening a file by handle
* @open: custom open routine for opening file by handle
*
* See Documentation/filesystems/nfs/exporting.rst for details on how to use
* this interface correctly and the definition of the flags.
*
* @encode_fh:
* @encode_fh should store in the file handle fragment @fh (using at most
* @max_len bytes) information that can be used by @decode_fh to recover the
* file referred to by the &struct dentry @de. If @flag has CONNECTABLE bit
* set, the encode_fh() should store sufficient information so that a good
* attempt can be made to find not only the file but also it's place in the
* filesystem. This typically means storing a reference to de->d_parent in
* the filehandle fragment. encode_fh() should return the fileid_type on
* success and on error returns 255 (if the space needed to encode fh is
* greater than @max_len*4 bytes). On error @max_len contains the minimum
* size(in 4 byte unit) needed to encode the file handle.
*
* @fh_to_dentry:
* @fh_to_dentry is given a &struct super_block (@sb) and a file handle
* fragment (@fh, @fh_len). It should return a &struct dentry which refers
* to the same file that the file handle fragment refers to. If it cannot,
* it should return a %NULL pointer if the file cannot be found, or an
* %ERR_PTR error code of %ENOMEM if a memory allocation failure occurred.
* Any other error code is treated like %NULL, and will cause an %ESTALE error
* for callers of exportfs_decode_fh().
* Any suitable dentry can be returned including, if necessary, a new dentry
* created with d_alloc_root. The caller can then find any other extant
Annotation
- Immediate include surface: `linux/types.h`, `linux/path.h`.
- Detected declarations: `struct dentry`, `struct exportfs_block_ops`, `struct inode`, `struct super_block`, `struct vfsmount`, `struct fid`, `struct handle_to_path_ctx`, `struct export_operations`, `enum fid_type`, `enum handle_to_path_flags`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.