include/linux/fscrypt.h
Source file repositories/reference/linux-study-clean/include/linux/fscrypt.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/fscrypt.h- Extension
.h- Size
- 36051 bytes
- Lines
- 1136
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/mm.hlinux/slab.huapi/linux/fscrypt.h
Detected Declarations
struct fscrypt_inode_infostruct fs_parameterstruct seq_filestruct fscrypt_strstruct fscrypt_namestruct fscrypt_operationsstruct fscrypt_dummy_policystruct fscrypt_dummy_policyfunction fscrypt_inode_info_addrfunction fscrypt_get_inode_info_rawfunction fscrypt_get_inode_infofunction fscrypt_needs_contents_encryptionfunction d_splice_aliasfunction fscrypt_is_nokey_namefunction fscrypt_prepare_dentryfunction fscrypt_is_bounce_pagefunction fscrypt_is_bounce_foliofunction fscrypt_is_dummy_policy_setfunction fscrypt_free_dummy_policyfunction fscrypt_free_filenamefunction fscrypt_set_opsfunction fscrypt_get_inode_infofunction fscrypt_needs_contents_encryptionfunction fscrypt_handle_d_movefunction fscrypt_prepare_dentryfunction fscrypt_encrypt_block_inplacefunction fscrypt_decrypt_pagecache_blocksfunction fscrypt_decrypt_block_inplacefunction fscrypt_is_bounce_pagefunction fscrypt_is_bounce_foliofunction fscrypt_free_bounce_pagefunction fscrypt_ioctl_get_policyfunction fscrypt_ioctl_get_policy_exfunction fscrypt_ioctl_get_noncefunction fscrypt_has_permitted_contextfunction fscrypt_set_contextfunction fscrypt_parse_test_dummy_encryptionfunction fscrypt_dummy_policies_equalfunction fscrypt_show_test_dummy_encryptionfunction fscrypt_free_dummy_policyfunction fscrypt_ioctl_remove_keyfunction fscrypt_ioctl_remove_key_all_usersfunction fscrypt_ioctl_get_key_statusfunction fscrypt_prepare_new_inodefunction fscrypt_put_encryption_infofunction fscrypt_free_inodefunction fscrypt_setup_filenamefunction fscrypt_free_filename
Annotated Snippet
struct fscrypt_str {
unsigned char *name;
u32 len;
};
struct fscrypt_name {
const struct qstr *usr_fname;
struct fscrypt_str disk_name;
u32 hash;
u32 minor_hash;
struct fscrypt_str crypto_buf;
bool is_nokey_name;
};
#define FSTR_INIT(n, l) { .name = n, .len = l }
#define FSTR_TO_QSTR(f) QSTR_INIT((f)->name, (f)->len)
#define fname_name(p) ((p)->disk_name.name)
#define fname_len(p) ((p)->disk_name.len)
/* Maximum value for the third parameter of fscrypt_operations.set_context(). */
#define FSCRYPT_SET_CONTEXT_MAX_SIZE 40
#ifdef CONFIG_FS_ENCRYPTION
/* Crypto operations for filesystems */
struct fscrypt_operations {
/*
* The offset of the pointer to struct fscrypt_inode_info in the
* filesystem-specific part of the inode, relative to the beginning of
* the common part of the inode (the 'struct inode').
*/
ptrdiff_t inode_info_offs;
/*
* If set, then fs/crypto/ will allocate a global bounce page pool the
* first time an encryption key is set up for a file. The bounce page
* pool is required by the following functions:
*
* - fscrypt_encrypt_pagecache_blocks()
* - fscrypt_zeroout_range() for files not using inline crypto
*
* If the filesystem doesn't use those, it doesn't need to set this.
*/
unsigned int needs_bounce_pages : 1;
/*
* If set, then fs/crypto/ will allow the use of encryption settings
* that assume inode numbers fit in 32 bits (i.e.
* FSCRYPT_POLICY_FLAG_IV_INO_LBLK_{32,64}), provided that the other
* prerequisites for these settings are also met. This is only useful
* if the filesystem wants to support inline encryption hardware that is
* limited to 32-bit or 64-bit data unit numbers and where programming
* keyslots is very slow.
*/
unsigned int has_32bit_inodes : 1;
/*
* If set, then fs/crypto/ will allow users to select a crypto data unit
* size that is less than the filesystem block size. This is done via
* the log2_data_unit_size field of the fscrypt policy. This flag is
* not compatible with filesystems that encrypt variable-length blocks
* (i.e. blocks that aren't all equal to filesystem's block size), for
* example as a result of compression. It's also not compatible with
* the fscrypt_encrypt_block_inplace() and
* fscrypt_decrypt_block_inplace() functions.
*/
unsigned int supports_subblock_data_units : 1;
/*
* This field exists only for backwards compatibility reasons and should
* only be set by the filesystems that are setting it already. It
* contains the filesystem-specific key description prefix that is
* accepted for "logon" keys for v1 fscrypt policies. This
* functionality is deprecated in favor of the generic prefix
* "fscrypt:", which itself is deprecated in favor of the filesystem
* keyring ioctls such as FS_IOC_ADD_ENCRYPTION_KEY. Filesystems that
* are newly adding fscrypt support should not set this field.
*/
const char *legacy_key_prefix;
/*
* Get the fscrypt context of the given inode.
*
* @inode: the inode whose context to get
* @ctx: the buffer into which to get the context
* @len: length of the @ctx buffer in bytes
*
* Return: On success, returns the length of the context in bytes; this
* may be less than @len. On failure, returns -ENODATA if the
* inode doesn't have a context, -ERANGE if the context is
Annotation
- Immediate include surface: `linux/fs.h`, `linux/mm.h`, `linux/slab.h`, `uapi/linux/fscrypt.h`.
- Detected declarations: `struct fscrypt_inode_info`, `struct fs_parameter`, `struct seq_file`, `struct fscrypt_str`, `struct fscrypt_name`, `struct fscrypt_operations`, `struct fscrypt_dummy_policy`, `struct fscrypt_dummy_policy`, `function fscrypt_inode_info_addr`, `function fscrypt_get_inode_info_raw`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.