fscrypt_policy_from_context(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– fscrypt_policy_from_context πŸ’–

okay so bestie, welcome to the Kernel API Manual ✨ this one is a lil function that turns your fscrypt_context into an fscrypt_policy, and honestly? it's giving "glow-up transformation" πŸ¦‹


🌸 NAME 🌸

fscrypt_policy_from_context β€” convert an fscrypt_context to an fscrypt_policy πŸ’…


✨ SYNOPSIS ✨

int fscrypt_policy_from_context (union fscrypt_policy *policy_u , const
union fscrypt_context *ctx_u , int ctx_size );

πŸŽ€ ARGUMENTS πŸŽ€

  • policy_u β€” the output policy 🫢 this is where the magic lands
  • ctx_u β€” the input context, aka the raw material you're feeding in
  • ctx_size β€” how big the input context is, in bytes (yes, bytes, we're counting πŸ”₯)

πŸ’… DESCRIPTION πŸ’…

Given an fscrypt_context, build the corresponding fscrypt_policy. Literally that's it, no cap β€” context in, policy out, slay ✨

but bestie, listen: this does not validate the settings within the policy itself β€” like the modes, flags, and reserved bits? yeah, not its job πŸ™ˆ if you want that check done, use fscrypt_supported_policy for it. this function is just the converter, not the bouncer at the door πŸ’€

🌈 RETURN 🌈

  • 0 on success β€” we love a clean win πŸ‘‘
  • -EINVAL if the fscrypt_context has an unrecognized version number or size β€” like, it doesn't recognize the vibe check πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./fs/crypto/policy.c plus the whole squad:


and that's the whole page, bestie 🫢 this iconic lil number lives in ./fs/crypto and the version/date stamp on it is October 2026 β€” periodt πŸ’œ

πŸ“¦ where this page comes from