Skip to main content

Module daemon

Module daemon 

Source
Expand description

The mtp-mountd daemon: one mount per device, for as long as the device is there.

The CLI mounts one device at one path because a person asked it to. The daemon does the same thing on the device’s schedule instead: a phone shows up, it gets a mount; the cable comes out, the mount goes away. Everything below the mount is the same code the CLI uses (crate::fs::MtpFs, the spool dir, the open-failure hints).

The parts:

  • supervisor: the loop that owns every mount. Its input is a channel of Commands, never USB directly, which is the seam tests drive.
  • usb: the production wiring, turning mtp-rs’s hotplug stream into those commands.
  • paths: where mounts live and what each one is called.
  • unmount: taking a mount down for good, and proving it’s gone.
  • dryrun: --dry-run, which watches real devices and reports what would happen without mounting anything. It’s how the hotplug path, the one part no test can reach, gets checked against a real phone.

Re-exports§

pub use dryrun::DepartureVerdict;
pub use dryrun::DeviceFacts;
pub use dryrun::DryRun;
pub use dryrun::DryRunCommand;
pub use paths::device_dir_name;
pub use paths::mount_root_from_env;
pub use paths::resolve_mount_root;
pub use paths::RUNTIME_SUBDIR;
pub use supervisor::Command;
pub use supervisor::DeviceChange;
pub use supervisor::DeviceIdent;
pub use supervisor::DeviceSource;
pub use supervisor::Supervisor;
pub use supervisor::SupervisorConfig;
pub use unmount::clean_stale_mounts;
pub use unmount::force_unmount;
pub use unmount::is_mountpoint;
pub use usb::facts_of;
pub use usb::ident_of;
pub use usb::spawn_dry_run_watch;
pub use usb::spawn_hotplug_watch;
pub use usb::UsbSource;

Modules§

dryrun
--dry-run: watch real devices, mount nothing, and say what would happen.
paths
Where the daemon puts its mounts, and what it calls each one.
supervisor
The loop that owns every mount the daemon has.
unmount
Taking a mount down for good, and proving it’s gone.
usb
Production wiring: real USB hotplug into supervisor commands.