fscrypt_set_bio_crypt_ctx(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fscrypt_set_bio_crypt_ctx

okay so bestie, we're in the Kernel API Manual today and the star of the show is fscrypt_set_bio_crypt_ctx(9) β€” literally the function that gets a file contents bio all dressed up for inline crypto ✨

🌸 NAME 🌸

fscrypt_set_bio_crypt_ctx β€” prep a file contents bio for inline crypto πŸŽ€

✨ SYNOPSIS ✨

void fscrypt_set_bio_crypt_ctx (struct bio *bio , const struct inode
*inode , loff_t pos , gfp_t gfp_mask );

🫢 ARGUMENTS 🫢

  • bio β€” a bio that's eventually gonna get submitted to the file 🌈
  • inode β€” the file's inode, yep that one
  • pos β€” the first file position (in bytes) in the I/O πŸ“
  • gfp_mask β€” memory allocation flags. and listen, these must be a waiting mask so that bio_crypt_set_ctx can't fail. no cap, that's a hard requirement πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

So like β€” if the contents of the file should be encrypted (or decrypted), then you assign the appropriate encryption context to the bio. that's the whole vibe πŸ’œ

Normally the bio should be newly allocated (i.e. no pages added yet), because otherwise fscrypt_mergeable_bio won't work as intended. so don't be out here adding pages first and then acting surprised πŸ™ˆ

Good news tho: the encryption context will be freed automatically when the bio is freed. self-cleaning, iconic, main character energy πŸ‘‘

πŸ”₯ SEE ALSO πŸ”₯


okay that's the whole page bestie, go forth and encrypt responsibly πŸ’–

shoutout to the source ./fs/crypto, dated October 2026 β€” mwah, we love a documented kernel 🫢✨

πŸ“¦ where this page comes from