Skip to main content

Crate ntfs_mac_core

Crate ntfs_mac_core 

Source
Expand description

ntfs-mac core.

Subprocess wrappers around ntfs-3g, diskutil, hdiutil, newfs_ntfs, ntfsfix and fsck_ntfs, plus a small config layer.

Design rules (do not violate — they are the reason this library is kept under ~1.5k LOC):

  • No unsafe, no unwrap on production paths, no async runtime.
  • Every external command goes through runner::run; failures are surfaced as error::Error with the underlying stderr attached.
  • Pure parsing helpers are pure and unit-testable; only the module boundaries that touch std::process::Command are impure.
  • Destructive NTFS operations require an explicit DestructiveToken to be matched before the API proceeds.

Layout:

ntfs-mac-core
  runner   Subprocess plumbing + timeouts
  error    Typed errors, ExitStatus codes
  config   ~/.config/ntfs-mac/config.toml
  deps     Dependency discovery (ntfs-3g, macFUSE, FUSE-T, ...)
  device   diskutil list -plist parsing
  mount    ntfs-3g / diskutil mount and unmount
  format   mkntfs / newfs_ntfs (destructive, gated)
  fix      ntfsfix / fsck_ntfs
  copy     rsync-based copy with progress
  license  Licence metadata + embedded attribution inventory

Re-exports§

pub use config::Config;
pub use config::default_config_path;
pub use config::load_config;
pub use config::save_config;
pub use device::Volume;
pub use error::ConfigError;
pub use error::Error;
pub use error::ExitCode;
pub use error::Result;
pub use hardening::install_panic_hook;
pub use hardening::install_signal_handlers;
pub use hardening::is_stdin_tty;
pub use hardening::is_stdout_tty;
pub use hardening::should_exit;
pub use hardening::validate_device_id;
pub use hardening::validate_label;
pub use hardening::validate_mount_point;
pub use license::LicenseSummary;
pub use license::ThirdPartyCounts;
pub use license::display_path;
pub use license::license_file;
pub use license::notice_file;
pub use license::third_party_counts;
pub use runner::RunOptions;
pub use runner::read_line_interactive;
pub use runner::run_expect_success;
pub use runner::which;

Modules§

config
Persistent configuration at ~/.config/ntfs-mac/config.toml.
copy
File copy between macOS and an NTFS volume. Uses rsync when available for progress reporting + resume semantics; falls back to cp -a when rsync is not installed.
daemon
Auto-mount daemon.
deps
Dependency discovery: ntfs-3g, macFUSE / FUSE-T, diskutil, hdiutil, rsync, mkntfs/newfs_ntfs, ntfsfix, fsck_ntfs.
device
NTFS volume discovery via diskutil list -plist + mount.
error
Typed errors + POSIX-style exit codes used by the CLI/GUI layer.
fix
NTFS repair. ntfsfix -d unmounts the volume, clears the dirty flag and runs a light chkdsk-like pass. fsck_ntfs is a heavier alternative.
format
Format NTFS volumes. Destructive: requires a matching DestructiveToken.
hardening
Production hardening: panic hook, signal handling, input validation, TTY detection.
license
Licence metadata for the ntfs-mac distribution.
mount
Mount / unmount NTFS volumes.
runner
Small subprocess runner.

Structs§

DestructiveToken
Destructive-operation token. Callers that confirm a format or erase action must pass a token whose device_identifier field matches the target device exactly.

Constants§

NAME
VERSION
Build-time constants surfaced to the CLI/GUI.