fscrypt_fname_encrypt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fscrypt_fname_encrypt β€” encrypt a filename

okay so this is a page from the Kernel API Manual (yes, the kernel has lore too, bestie) and honestly? it's giving "small function, big responsibilities" πŸ”₯


✨ NAME ✨

fscrypt_fname_encrypt β€” literally just: encrypt a filename πŸ’– that's the whole vibe.


πŸŽ€ SYNOPSIS πŸŽ€

int fscrypt_fname_encrypt(const struct inode *inode, const struct qstr *iname,
                          u8 *out, unsigned int olen);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • inode β€” the inode of the parent directory (for regular filenames), or of the symlink (for symlink targets). heads up: the key must already be set up before you call this, no cap πŸ”‘βœ¨
  • iname β€” the filename you wanna encrypt. the main character, the one we're protecting 🫢
  • out β€” (output) the encrypted filename goes here. this is where the slay happens πŸ’…
  • olen β€” the size of the encrypted filename. it must be at least iname->len. any extra space gets filled with NUL padding before encryption, so don't be weird about it πŸ™ˆ

🌸 RETURN 🌸

  • 0 on success β€” iconic, we ate πŸ‘‘
  • -errno on failure β€” 😭 not the errno

🌈 SEE ALSO 🌈

like, the whole friend group fr fr πŸ§šπŸ’œ go read them, iykyk


πŸ’€ reminder bestie: olen must be at least iname->len. this is not a suggestion, it's the law. the extra bytes get NUL-padded before encryption, so keep that in mind before you come for this function.

and that's the whole page, periodt πŸŽ€ this came out of ./fs/crypto in October 2026, so go be obsessed responsibly β­πŸ’–

πŸ“¦ where this page comes from