btrfs-progs: subvolume delete: add global quiet option

Enable the quiet option to the subvolume delete command.
Does the job quietly. For example:

  $ btrfs --quiet subvolume delete <path>

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2020-06-12 01:41:18 +08:00 committed by David Sterba
parent ebeaf0089d
commit ec2e60bf55
1 changed files with 7 additions and 5 deletions

View File

@ -241,6 +241,7 @@ static const char * const cmd_subvol_delete_usage[] = {
"-v|--verbose verbose output of operations", "-v|--verbose verbose output of operations",
HELPINFO_INSERT_GLOBALS, HELPINFO_INSERT_GLOBALS,
HELPINFO_INSERT_VERBOSE, HELPINFO_INSERT_VERBOSE,
HELPINFO_INSERT_QUIET,
NULL NULL
}; };
@ -359,14 +360,15 @@ again:
goto out; goto out;
} }
printf("Delete subvolume (%s): ", pr_verbose(MUST_LOG, "Delete subvolume (%s): ",
commit_mode == COMMIT_EACH || (commit_mode == COMMIT_AFTER && cnt + 1 == argc) commit_mode == COMMIT_EACH ||
? "commit" : "no-commit"); (commit_mode == COMMIT_AFTER && cnt + 1 == argc) ?
"commit" : "no-commit");
if (subvolid == 0) if (subvolid == 0)
printf("'%s/%s'\n", dname, vname); pr_verbose(MUST_LOG, "'%s/%s'\n", dname, vname);
else else
printf("'%s'\n", full_subvolpath); pr_verbose(MUST_LOG, "'%s'\n", full_subvolpath);
if (subvolid == 0) if (subvolid == 0)
err = btrfs_util_delete_subvolume_fd(fd, vname, 0); err = btrfs_util_delete_subvolume_fd(fd, vname, 0);