fscrypt_get_encryption_info(9)
π 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'strue, 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 π₯
0if 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. π« (usefscrypt_has_encryption_keyto tell those two cases apart β that's literally what it's for, iykyk)- also can return another
-errnocode. so like, be ready for anything ngl.
π SEE ALSO π
- Kernel file
./fs/crypto/keysetup.c fscrypt_prepare_new_inode(9)fscrypt_put_encryption_info(9)fscrypt_free_inode(9)fscrypt_drop_inode(9)
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
- 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