git_policy_cli/subvolume/mod.rs
1//! What:
2//! Btrfs subvolume worktrees and the filesystem primitives under them.
3//! Why:
4//! Platform-specific code is easier to audit in one folder.
5//!
6//! In TS you'd write (pseudocode):
7//! ```ts
8//! // subvolume/index.ts: one `export * from './file'` per module below.
9//! ```
10
11/// The typed failure of one Linux filesystem primitive:
12/// the call, the path and the error number.
13#[cfg(target_os = "linux")]
14pub mod fs_primitive_error;
15
16/// Which filesystem holds a path (btrfs, overlayfs, other) and whether a directory is a btrfs subvolume root.
17#[cfg(target_os = "linux")]
18pub mod fs_kind;
19
20/// The mount of a path read from `/proc/self/mountinfo`, with its options (`user_subvol_rm_allowed`).
21#[cfg(target_os = "linux")]
22pub mod fs_mount_options;
23
24/// The btrfs ioctls that create, snapshot and destroy a subvolume, called in process.
25#[cfg(target_os = "linux")]
26pub mod fs_btrfs_ioctl;
27
28/// `FICLONE` of one file into another and the atomic `RENAME_EXCHANGE` of two paths.
29#[cfg(target_os = "linux")]
30pub mod fs_clone_exchange;
31
32/// Directory-relative file operations that never follow a link: the held-handle primitives of the clone rung and of the
33/// snapshot's stub removal.
34#[cfg(target_os = "linux")]
35pub mod fs_beneath;
36
37/// The btrfs fixture root of the primitive and migration controls, and the loud report where there is none.
38#[cfg(all(test, target_os = "linux"))]
39pub(crate) mod fs_btrfs_test_support;
40
41/// SHA-1 and SHA-256, for the checksum of a rewritten Git index.
42#[cfg(target_os = "linux")]
43pub mod subvolume_sha;
44
45/// The stat rewrite of a Git index file's bytes.
46#[cfg(target_os = "linux")]
47pub mod subvolume_index;
48
49/// The linked worktrees of a main checkout and the index stat rewrite applied to files.
50#[cfg(target_os = "linux")]
51pub mod subvolume_index_files;
52
53/// The failure type of the subvolume migration and its simulated-kill hook.
54#[cfg(target_os = "linux")]
55pub mod subvolume_error;
56
57/// The operating-system operations of the migration behind one trait, and the Linux implementation.
58#[cfg(target_os = "linux")]
59pub mod subvolume_platform;
60
61/// Copying owner, permissions, times and extended attributes onto a copy.
62#[cfg(target_os = "linux")]
63pub mod subvolume_sync_attrs;
64
65/// One idempotent pass that makes a directory tree match another, in process.
66#[cfg(target_os = "linux")]
67pub mod subvolume_sync;
68
69/// The index locks the migration holds, marked with a token that names the migration.
70#[cfg(target_os = "linux")]
71pub mod subvolume_lock;
72
73/// An open directory that every operation inside it is addressed through, so a replaced path cannot redirect them.
74#[cfg(target_os = "linux")]
75pub mod subvolume_anchor;
76
77/// Removal of a directory tree whose directories may lack owner write permission.
78#[cfg(target_os = "linux")]
79pub mod subvolume_remove;
80
81pub mod subvolume_remove_walk;
82
83/// The migration journal beside the checkout.
84#[cfg(target_os = "linux")]
85pub mod subvolume_journal;
86
87/// The count of the entries under a checkout, from which the free space a migration needs follows.
88#[cfg(target_os = "linux")]
89pub mod subvolume_entry_count;
90
91/// The paths of a migration and the refusals that stop it before anything is created.
92#[cfg(target_os = "linux")]
93pub mod subvolume_preflight;
94
95/// The state a migration command carries between its steps.
96#[cfg(target_os = "linux")]
97pub mod subvolume_run;
98
99/// Converting a main checkout into a btrfs subvolume, resumably.
100#[cfg(target_os = "linux")]
101pub mod subvolume_migrate;
102
103/// Undoing a migration and deleting the old tree.
104#[cfg(target_os = "linux")]
105pub mod subvolume_rollback;
106
107/// The grammar of `git cli-git migrate-to-subvolume`.
108pub mod subvolume_arguments;
109
110/// `git cli-git migrate-to-subvolume`: root discovery, modes and exit statuses.
111#[cfg(target_os = "linux")]
112pub mod subvolume_command;
113
114/// The stand-in platform and fixture checkouts of the subvolume migration controls.
115#[cfg(all(test, target_os = "linux"))]
116pub(crate) mod subvolume_test_support;
117
118/// The migration controls that need the real btrfs ioctls, `FICLONE` and exchange.
119#[cfg(all(test, target_os = "linux"))]
120mod subvolume_btrfs_tests;