mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
mount: minor cleanup
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
0c39011ae0
commit
c3c7dacab2
@ -86,20 +86,6 @@ fn parse_mount_options(options: impl AsRef<str>) -> (Option<String>, libc::c_ulo
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_mount(
|
|
||||||
device: String,
|
|
||||||
target: impl AsRef<std::path::Path>,
|
|
||||||
options: impl AsRef<str>,
|
|
||||||
) -> anyhow::Result<()> {
|
|
||||||
let (data, mountflags) = parse_mount_options(options);
|
|
||||||
|
|
||||||
info!(
|
|
||||||
"mounting bcachefs filesystem, {}",
|
|
||||||
target.as_ref().display()
|
|
||||||
);
|
|
||||||
mount_inner(device, target, "bcachefs", mountflags, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_super_silent(path: impl AsRef<Path>) -> anyhow::Result<bch_sb_handle> {
|
fn read_super_silent(path: impl AsRef<Path>) -> anyhow::Result<bch_sb_handle> {
|
||||||
let mut opts = bcachefs::bch_opts::default();
|
let mut opts = bcachefs::bch_opts::default();
|
||||||
opt_set!(opts, noexcl, 1);
|
opt_set!(opts, noexcl, 1);
|
||||||
@ -394,16 +380,17 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> {
|
|||||||
&opt.options
|
&opt.options
|
||||||
);
|
);
|
||||||
|
|
||||||
do_mount(devices, mountpoint, &opt.options)?;
|
let (data, mountflags) = parse_mount_options(&opt.options);
|
||||||
|
mount_inner(devices, mountpoint, "bcachefs", mountflags, data)
|
||||||
} else {
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"would mount with params: device: {}, options: {}",
|
"would mount with params: device: {}, options: {}",
|
||||||
devices, &opt.options
|
devices, &opt.options
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> i32 {
|
pub fn mount(mut argv: Vec<String>, symlink_cmd: Option<&str>) -> i32 {
|
||||||
// If the bcachefs tool is being called as "bcachefs mount dev ..." (as opposed to via a
|
// If the bcachefs tool is being called as "bcachefs mount dev ..." (as opposed to via a
|
||||||
|
Loading…
Reference in New Issue
Block a user