5 // convert existing log statements to tracing events
6 // tracing_log::LogTracer::init().expect("logtracer init failed!");
7 // format tracing log data to env_logger like stdout
8 tracing_subscriber::fmt::init();
10 if let Err(e) = crate::main_inner() {
11 tracing::error!(fatal_error = ?e);
16 #[tracing_attributes::instrument("main")]
17 pub fn main_inner() -> anyhow::Result<()> {
18 use bcachefs_mount::{Cli, filesystem, key};
26 // libc::fflush(filesystem::stdout);
29 let opt = Cli::parse();
31 tracing::trace!(?opt);
33 let fss = filesystem::probe_filesystems()?;
36 .ok_or_else(|| anyhow::anyhow!("filesystem was not found"))?;
38 tracing::info!(msg="found filesystem", %fs);
43 .ok_or_else(|| anyhow::anyhow!("no keyoption specified for locked filesystem"))?;
45 key::prepare_key(&fs, key)?;
50 .ok_or_else(|| anyhow::anyhow!("mountpoint option was not specified"))?;
52 fs.mount(&mountpoint, &opt.options)?;
59 // use insta::assert_debug_snapshot;
61 // fn snapshot_testing() {
62 // insta::assert_debug_snapshot!();