8 pub mod cmd_completions;
10 #[derive(clap::Parser, Debug)]
11 #[command(name = "bcachefs")]
13 #[command(subcommand)]
14 subcommands: Subcommands,
17 #[derive(Subcommand, Debug)]
20 Mount(cmd_mount::Cli),
21 Completions(cmd_completions::Cli),
28 std::ffi::CStr::from_ptr(concat!($lit, "\0").as_ptr() as *const std::os::raw::c_char)
30 .as_ptr() as *const std::os::raw::c_char
36 macro_rules! transform_c_args {
37 ($var:ident, $argc:expr, $argv:expr) => {
38 // TODO: `OsStr::from_bytes` only exists on *nix
39 use ::std::os::unix::ffi::OsStrExt;
40 let $var: Vec<_> = (0..$argc)
41 .map(|i| unsafe { ::std::ffi::CStr::from_ptr(*$argv.add(i as usize)) })
42 .map(|i| ::std::ffi::OsStr::from_bytes(i.to_bytes()))
48 struct ErrnoError(errno::Errno);
49 impl std::fmt::Display for ErrnoError {
50 fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
54 impl std::error::Error for ErrnoError {}