From f0df58635efe5f687c10a19c73ae805a15a05436 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 5 Oct 2022 14:27:57 +0200 Subject: [PATCH] btrfs-progs: send: use pr_stderr for messages Replace fprintf(stderr, ...) by the level-aware helper instead of the explicit verbosity level checks. No change for commands that don't have the global -q/-v options, otherwise the output can be quieted. Signed-off-by: David Sterba --- cmds/send.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/cmds/send.c b/cmds/send.c index 79feef0a..db6043c5 100644 --- a/cmds/send.c +++ b/cmds/send.c @@ -284,15 +284,12 @@ static int do_send(struct btrfs_send *send, u64 parent_root_id, ret = -errno; error("send ioctl failed with %d: %m", ret); if (ret == -EINVAL && (!is_first_subvol || !is_last_subvol)) - fprintf(stderr, + pr_stderr(LOG_DEFAULT, "Try upgrading your kernel or don't use -e.\n"); goto out; } - if (bconf.verbose > 1) - fprintf(stderr, "BTRFS_IOC_SEND returned %d\n", ret); - - if (bconf.verbose > 1) - fprintf(stderr, "joining genl thread\n"); + pr_stderr(LOG_INFO, "BTRFS_IOC_SEND returned %d\n", ret); + pr_stderr(LOG_DEBUG, "joining genl thread\n"); close(pipefd[1]); pipefd[1] = -1; @@ -745,7 +742,7 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv) if ((send_flags & BTRFS_SEND_FLAG_NO_FILE_DATA) && bconf.verbose > 1) if (bconf.verbose > 1) - fprintf(stderr, "Mode NO_FILE_DATA enabled\n"); + pr_stderr(LOG_DEFAULT, "Mode NO_FILE_DATA enabled\n"); send.proto_supported = get_sysfs_proto_supported(); if (send.proto_supported == 1) { if (send.proto > send.proto_supported) { @@ -773,9 +770,8 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv) goto out; } } - if (bconf.verbose > 1) - fprintf(stderr, "Protocol version requested: %u (supported %u)\n", - send.proto, send.proto_supported); + pr_stderr(LOG_INFO, "Protocol version requested: %u (supported %u)\n", + send.proto, send.proto_supported); for (i = optind; i < argc; i++) { int is_first_subvol; @@ -784,8 +780,7 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv) free(subvol); subvol = argv[i]; - if (bconf.verbose > BTRFS_BCONF_QUIET) - fprintf(stderr, "At subvol %s\n", subvol); + pr_stderr(LOG_DEFAULT, "At subvol %s\n", subvol); subvol = realpath(subvol, NULL); if (!subvol) {