fscrypt_zeroout_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fscrypt_zeroout_range(9) β€” the Kernel API Manual glow-up πŸŽ€

okay bestie, welcome to the Kernel API Manual entry for fscrypt_zeroout_range(9) β€” yes that's the full manual name, we're fancy like that ✨

✨ NAME ✨

fscrypt_zeroout_range β€” zero out a range of blocks in an encrypted file 🫢


🌸 SYNOPSIS 🌸

int fscrypt_zeroout_range (const struct inode *inode , loff_t pos ,
       sector_t sector , u64 len );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • inode β€” the file's inode, like the file's main character ID πŸ’–
  • pos β€” the first file position (in bytes) to zero out πŸ“
  • sector β€” the first sector to zero out 🧚
  • len β€” bytes to zero out, and yes it's counting bytes, not vibes 😭

πŸ”₯ DESCRIPTION πŸ”₯

So what this actually does: it zeroes out filesystem blocks in an encrypted regular file on-disk β€” meaning it writes ciphertext blocks that decrypt to the all-zeroes block. Not me explaining crypto at 2am but here we are πŸ’€

The blocks have to be both logically and physically contiguous. No skipping, no gaps, no chaos, periodt πŸ’…

It's also assumed that the filesystem only uses a single block device, ->s_bdev. That's the vibe check it's operating under πŸ‘‘

And len must be a multiple of the file system logical block size. Like, mandatory. No cap 🚨

Also important, bestie: since each block uses a different IV, this involves writing a different ciphertext to each block β€” we can't simply reuse the same one. Each block gets its own little encrypted outfit, iykyk 🌈


⭐ RETURN ⭐

0 on success; -errno on failure. Slay when it works, errno when it doesn't 😭


πŸ’œ SEE ALSO πŸ’œ

Kernel file ./fs/crypto/block.c and its besties:


and that's the whole page, iconically complete πŸ’–βœ¨πŸŽ€

source/version: ./fs/crypto Β· date: October 2026 Β· page: fscrypt_zeroout_range(9) β€” mwah, go read the kernel docs bestie πŸ«ΆπŸ’…

πŸ“¦ where this page comes from