fscrypt_get_encryption_info(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ fscrypt_get_encryption_info(9) β€” like, the kernel API manual bestie ✨

okay so real talk, this is fscrypt_get_encryption_info from the Kernel API Manual, and it's genuinely the little function that could 🫢 it sets up an inode's encryption key. that's it, that's the plot. let's get into it.


✨ NAME ✨

fscrypt_get_encryption_info β€” set up an inode's encryption key πŸ”‘


πŸ¦‹ SYNOPSIS πŸ¦‹

int fscrypt_get_encryption_info(struct inode *inode, bool allow_unsupported);

πŸŽ€ ARGUMENTS πŸŽ€

  • inode β€” the inode you're setting the key up for. and like… it must be encrypted. no encrypted inode, no key setup, that's the whole vibe check πŸ’…
  • allow_unsupported β€” if it's true, then an unsupported encryption policy (or an unrecognized encryption context, same energy) gets treated exactly like the key being unavailable, instead of returning an error. basically it's the "no worries bestie" flag πŸ™ˆ
use false unless the operation you're doing is literally needed in order for files (or directories) to be deleted. like, that's the only excuse. periodt.

🌸 DESCRIPTION 🌸

sets up the inode's encryption key, if that hasn't already been done. if it's already done, it's already done, we move on πŸ’…


⚠️ NOTE ⚠️

unless the key setup was already done, this is not GFP_NOFS-safe 😭 so generally? don't call it from inside a filesystem transaction. like, just don't. i'm begging.


πŸ”₯ RETURN πŸ”₯

  • 0 if the key is now set up, or if it couldn't be set up because the needed master key is absent. yes, both. same return value. i know. 🫠 (use fscrypt_has_encryption_key to tell those two cases apart β€” that's literally what it's for, iykyk)
  • also can return another -errno code. so like, be ready for anything ngl.

πŸ‘‘ SEE ALSO πŸ‘‘

go read them, they're iconic, they're the friend group 🌈


mwah, that's the page πŸ’– this one lives in ./fs/crypto, dated October 2026, and it's fscrypt_get_encryption_info(9) β€” go set up some keys, slay, and remember: encrypted inode only! πŸ§šβ€β™€οΈβœ¨

πŸ“¦ where this page comes from