mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
Allow multiple targets for subvolume delete.
Signed-off-by: Malte Schröder <malte.schroeder@tnxip.de> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
2541755981
commit
cb8dc1b2ba
@ -24,7 +24,7 @@ enum Subcommands {
|
||||
#[command(visible_aliases = ["del"])]
|
||||
Delete {
|
||||
/// Path
|
||||
target: PathBuf,
|
||||
targets: Vec<PathBuf>,
|
||||
},
|
||||
|
||||
#[command(allow_missing_positional = true, visible_aliases = ["snap"])]
|
||||
@ -58,15 +58,17 @@ pub fn subvolume(argv: Vec<String>) -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
Subcommands::Delete { target } => {
|
||||
let target = target
|
||||
.canonicalize()
|
||||
.context("subvolume path does not exist or can not be canonicalized")?;
|
||||
Subcommands::Delete { targets } => {
|
||||
for target in targets {
|
||||
let target = target
|
||||
.canonicalize()
|
||||
.context("subvolume path does not exist or can not be canonicalized")?;
|
||||
|
||||
if let Some(dirname) = target.parent() {
|
||||
let fs = unsafe { BcachefsHandle::open(dirname) };
|
||||
fs.delete_subvolume(target)
|
||||
.context("Failed to delete the subvolume")?;
|
||||
if let Some(dirname) = target.parent() {
|
||||
let fs = unsafe { BcachefsHandle::open(dirname) };
|
||||
fs.delete_subvolume(target)
|
||||
.context("Failed to delete the subvolume")?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Subcommands::Snapshot {
|
||||
|
Loading…
Reference in New Issue
Block a user