Skip to main content

nuclei/fs/
allocate.rs

1//! What [`File::allocate`](super::File::allocate) does with a range of a file.
2
3/// How a call to [`File::allocate`](super::File::allocate) changes the space
4/// a range of a file uses.
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Allocate {
7    /// Reserves disk space for the range, so a later write into it does not
8    /// run out of space, and grows the file to cover the range when the range
9    /// ends past its end. The new part reads as zeros.
10    Extend,
11    /// Reserves disk space for the range and leaves the file's length as it
12    /// is.
13    KeepSize,
14    /// Frees the disk space of the range, which then reads as zeros, and
15    /// leaves the file's length as it is. A range that ends past the end of
16    /// the file does not grow it.
17    PunchHole,
18    /// Makes the range read as zeros, without a write of zeros, and grows the
19    /// file to cover the range when it ends past the end, as a write of zeros
20    /// would.
21    ZeroRange,
22}