Skip to main content

mtp_mount/daemon/
mod.rs

1//! The `mtp-mountd` daemon: one mount per device, for as long as the device is there.
2//!
3//! The CLI mounts one device at one path because a person asked it to. The
4//! daemon does the same thing on the device's schedule instead: a phone shows
5//! up, it gets a mount; the cable comes out, the mount goes away. Everything
6//! below the mount is the same code the CLI uses ([`crate::fs::MtpFs`], the
7//! spool dir, the open-failure hints).
8//!
9//! The parts:
10//!
11//! - [`supervisor`]: the loop that owns every mount. Its input is a channel of
12//!   [`Command`]s, never USB directly, which is the seam tests drive.
13//! - [`usb`]: the production wiring, turning `mtp-rs`'s hotplug stream into
14//!   those commands.
15//! - [`paths`]: where mounts live and what each one is called.
16//! - [`unmount`]: taking a mount down for good, and proving it's gone.
17//! - [`dryrun`]: `--dry-run`, which watches real devices and reports what would
18//!   happen without mounting anything. It's how the hotplug path, the one part
19//!   no test can reach, gets checked against a real phone.
20
21pub mod dryrun;
22pub mod paths;
23pub mod supervisor;
24pub mod unmount;
25pub mod usb;
26
27pub use dryrun::{DepartureVerdict, DeviceFacts, DryRun, DryRunCommand};
28pub use paths::{device_dir_name, mount_root_from_env, resolve_mount_root, RUNTIME_SUBDIR};
29pub use supervisor::{
30    Command, DeviceChange, DeviceIdent, DeviceSource, Supervisor, SupervisorConfig,
31};
32pub use unmount::{clean_stale_mounts, force_unmount, is_mountpoint};
33pub use usb::{facts_of, ident_of, spawn_dry_run_watch, spawn_hotplug_watch, UsbSource};