fscrypt_prepare_setflags(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 there
  • oldflags β€” the old flags πŸ“ the before pic
  • flags β€” 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:

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