fscrypt_prepare_setflags(9)
β¨ fscrypt_prepare_setflags(9) β¨
okay bestie, welcome to the Kernel API Manual π this one's a kernel function in the fscrypt squad, and honestly? she's short but she's important.
π NAME π
fscrypt_prepare_setflags β the little prep step you run before you go changing flags with FS_IOC_SETFLAGS π¦
π«Ά SYNOPSIS π«Ά
int fscrypt_prepare_setflags (struct inode *inode , unsigned int
oldflags , unsigned int flags );
like, that's the whole signature. no cap. β¨
πΈ ARGUMENTS πΈ
inodeβ the inode on which flags are being changed π that's your main character right thereoldflagsβ the old flags π the before picflagsβ the new flags π the after pic
π DESCRIPTION π
so here's the vibe check: the caller should be holding i_rwsem for write. π₯
that's it. that's the whole description. but do not sleep on it β if you're calling this without holding i_rwsem for write, you're not slaying, you're just doing too much π lock it down first, then call, periodt.
β RETURN β
0 on success π β iconique, we love a clean return.
-errno if the flags change isn't allowed, or if another error occurs π so yeah, if it comes back negative, something said "no ma'am" β check your errno, bestie, it's giving diagnostic clues π
π§ SEE ALSO π§
Kernel file ./fs/crypto/hooks.c and the whole friend group:
fscrypt_file_open(9)fscrypt_prepare_lookup_partial(9)fscrypt_prepare_symlink(9)fscrypt_get_symlink(9)fscrypt_symlink_getattr(9)
go read them, iykyk π
lowkey reminder: hold that i_rwsem for write before you call. fr fr. π«Ά
and that's the page!! brought to you by the <rainbow>./fs/crypto</rainbow> girlies, October 2026 edition πΈ mwah, go forth and set those flags responsibly π
β¨
π¦ 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