]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - rust-src/src/cmd_mount.rs
create common entry point for Rust commands
[bcachefs-tools-debian] / rust-src / src / cmd_mount.rs
index a75dd21fc39ebf7cf1986d265b9ff96bda13b706..3f8253f5e1f56781a22fdf6ee7cf6b0ccacdd85b 100644 (file)
@@ -4,10 +4,9 @@ use log::{info, debug, error, LevelFilter};
 use clap::{Parser};
 use uuid::Uuid;
 use std::path::PathBuf;
-use crate::{key, transform_c_args};
+use crate::key;
 use crate::key::KeyLocation;
-use crate::logger::SimpleLogger;
-use std::ffi::{CString, c_int, c_char, c_void};
+use std::ffi::{CString, c_int, c_char, c_void, OsStr};
 use std::os::unix::ffi::OsStrExt;
 
 fn mount_inner(
@@ -222,14 +221,9 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> {
     Ok(())
 }
 
-#[no_mangle]
-#[allow(clippy::not_unsafe_ptr_arg_deref)]
-pub extern "C" fn cmd_mount(argc: c_int, argv: *const *const c_char) -> c_int {
-    transform_c_args!(argv, argc, argv);
+pub fn cmd_mount(argv: Vec<&OsStr>) -> c_int {
     let opt = Cli::parse_from(argv);
 
-    log::set_boxed_logger(Box::new(SimpleLogger)).unwrap();
-
     // @TODO : more granular log levels via mount option
     log::set_max_level(match opt.verbose {
         0 => LevelFilter::Warn,