ecryptfs_write_headers_virt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 at page_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:


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