pub enum WhiteoutSpec {
Oci,
Overlayfs,
None,
}Expand description
RAFS filesystem overlay specifications.
When merging multiple RAFS filesystems into one, special rules are needed to white out files/directories in lower/parent filesystems. The whiteout specification defined by the OCI image specification and Linux Overlayfs are widely adopted, so both of them are supported by RAFS filesystem.
§Overlayfs Whiteout
In order to support rm and rmdir without changing the lower filesystem, an overlay filesystem needs to record in the upper filesystem that files have been removed. This is done using whiteouts and opaque directories (non-directories are always opaque).
A whiteout is created as a character device with 0/0 device number. When a whiteout is found in the upper level of a merged directory, any matching name in the lower level is ignored, and the whiteout itself is also hidden.
A directory is made opaque by setting the xattr “trusted.overlay.opaque” to “y”. Where the upper filesystem contains an opaque directory, any directory in the lower filesystem with the same name is ignored.
§OCI Image Whiteout
- A whiteout file is an empty file with a special filename that signifies a path should be deleted.
- A whiteout filename consists of the prefix .wh. plus the basename of the path to be deleted.
- As files prefixed with .wh. are special whiteout markers, it is not possible to create a filesystem which has a file or directory with a name beginning with .wh..
- Once a whiteout is applied, the whiteout itself MUST also be hidden.
- Whiteout files MUST only apply to resources in lower/parent layers.
- Files that are present in the same layer as a whiteout file can only be hidden by whiteout files in subsequent layers.
- In addition to expressing that a single entry should be removed from a lower layer, layers may remove all of the children using an opaque whiteout entry.
- An opaque whiteout entry is a file with the name .wh..wh..opq indicating that all siblings are hidden in the lower layer.
Variants§
Oci
Overlay whiteout rules according to the OCI image specification.
https://github.com/opencontainers/image-spec/blob/master/layer.md#whiteouts
Overlayfs
Overlay whiteout rules according to the Linux Overlayfs specification.
“whiteouts and opaque directories” in https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt
None
No whiteout, keep all content from lower/parent filesystems.
Trait Implementations§
Source§impl Clone for WhiteoutSpec
impl Clone for WhiteoutSpec
Source§fn clone(&self) -> WhiteoutSpec
fn clone(&self) -> WhiteoutSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more