ecryptfs_write_headers_virt(9)
β¨ ecryptfs_write_headers_virt(9) β¨
okay so bestie, we're in the Kernel API Manual today and this one is a whole little function about writing eCryptfs headers into memory. it's giving low-level, it's giving bytes, it's giving "trust me i know what i'm doing." let's get into it π
πΈ NAME πΈ
ecryptfs_write_headers_virt β no description was given for this one in the original page, so we're just gonna sit here and stan the name itself. cute, concise, iconic. β¨
π¦ SYNOPSIS π¦
int ecryptfs_write_headers_virt (char *page_virt , size_t max , size_t
*size , struct ecryptfs_crypt_stat *crypt_stat , struct dentry
*ecryptfs_dentry );
π ARGUMENTS π
page_virtβ the virtual address you're writing the headers to. like, this is where the bytes go, bestie π«Άmaxβ the size of the memory that's been allocated atpage_virt. know your limits, periodt.sizeβ gets set to the number of bytes this function writes. it's the receipt for how much we actually used πcrypt_statβ the cryptographic context. the main character of the crypto side of things πecryptfs_dentryβ the eCryptfs dentry. yes, that dentry π¦
π DESCRIPTION π
okay so here's the layout, and honestly it's a whole vibe. Format version: 1 β¨
π Header Extent π
- Octets 0-7: Unencrypted file size (big-endian)
- Octets 8-15: eCryptfs special marker
- Octets 16-19: Flags
- Octet 16: File format version number (between 0 and 255)
- Octets 17-18: Reserved
- Octet 19:
- Bit 1 (lsb): Reserved
- Bit 2: Encrypted?
- Bits 3-8: Reserved
- Octets 20-23: Header extent size (big-endian)
- Octets 24-25: Number of header extents at front of file (big-endian)
- Octet 26: Begin RFC 2440 authentication token packet set
π§ Data Extent π
- Data Extent 0: Lower data (CBC encrypted)
- Data Extent 1: Lower data (CBC encrypted)
- ... and it keeps going like that, no cap π
Returns zero on success. that's it, that's the win. slay π
π₯ SEE ALSO π₯
Kernel file ./fs/ecryptfs/crypto.c β and the whole friend group:
ecryptfs_from_hex(9)ecryptfs_derive_iv(9)ecryptfs_init_crypt_stat(9)ecryptfs_destroy_crypt_stat(9)virt_to_scatterlist(9)crypt_scatterlist(9)crypt_extent(9)ecryptfs_encrypt_page(9)ecryptfs_decrypt_page(9)ecryptfs_init_crypt_ctx(9)ecryptfs_copy_mount_wide_flags_to_inode_flags(9)ecryptfs_set_default_crypt_stat_vals(9)ecryptfs_new_file_context(9)ecryptfs_validate_marker(9)ecryptfs_process_flags(9)write_ecryptfs_marker(9)ecryptfs_code_for_cipher_string(9)ecryptfs_cipher_code_to_string(9)ecryptfs_write_metadata(9)set_default_header_data(9)ecryptfs_read_headers_virt(9)ecryptfs_read_xattr_region(9)ecryptfs_process_key_cipher(9)ecryptfs_destroy_crypto(9)ecryptfs_tfm_exists(9)ecryptfs_get_tfm_and_mutex_for_cipher_name(9)ecryptfs_encode_for_filename(9)ecryptfs_decode_from_filename(9)ecryptfs_encrypt_and_encode_filename(9)ecryptfs_decode_and_decrypt_filename(9)
and that's the whole page, bestie!! this one lives in ./fs/ecryptfs and it's dated October 2026 β shoutout to ecryptfs_write_headers_virt(9) for being the blueprint. mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms