From: Danny Kukawka <danny.kukawka@bisect.de>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.cz>
Subject: [PATCH 2/4] return error code from change/get_label_unmounted
Date: Thu, 12 Jan 2012 16:17:45 +0100 [thread overview]
Message-ID: <1326381467-19848-3-git-send-email-danny.kukawka@bisect.de> (raw)
In-Reply-To: <1326381467-19848-1-git-send-email-danny.kukawka@bisect.de>
From: David Sterba <dsterba@suse.cz>
Return error code from change/get_label_unmounted caused by
caused by open_ctree()
---
btrfslabel.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/btrfslabel.c b/btrfslabel.c
index 2e5d539..29b00bf 100644
--- a/btrfslabel.c
+++ b/btrfslabel.c
@@ -46,7 +46,7 @@
#define GET_LABEL 3
#define SET_LABEL 4
-static void change_label_unmounted(char *dev, char *nLabel)
+static int change_label_unmounted(char *dev, char *nLabel)
{
struct btrfs_root *root;
struct btrfs_trans_handle *trans;
@@ -57,7 +57,7 @@ static void change_label_unmounted(char *dev, char *nLabel)
root = open_ctree(dev, 0, 1);
if (!root) {
fprintf(stderr, "Open ctree failed\n");
- return;
+ return -1;
}
trans = btrfs_start_transaction(root, 1);
@@ -66,9 +66,10 @@ static void change_label_unmounted(char *dev, char *nLabel)
/* Now we close it since we are done. */
close_ctree(root);
+ return 0;
}
-static void get_label_unmounted(char *dev)
+static int get_label_unmounted(char *dev)
{
struct btrfs_root *root;
@@ -78,13 +79,14 @@ static void get_label_unmounted(char *dev)
root = open_ctree(dev, 0, 0);
if (!root) {
fprintf(stderr, "Open ctree failed\n");
- return;
+ return -1;
}
fprintf(stdout, "%s\n", root->fs_info->super_copy.label);
/* Now we close it since we are done. */
close_ctree(root);
+ return 0;
}
int get_label(char *btrfs_dev)
@@ -103,8 +105,7 @@ int get_label(char *btrfs_dev)
fprintf(stderr, "FATAL: the filesystem has to be unmounted\n");
return -2;
}
- get_label_unmounted(btrfs_dev);
- return 0;
+ return get_label_unmounted(btrfs_dev);
}
@@ -124,6 +125,5 @@ int set_label(char *btrfs_dev, char *nLabel)
fprintf(stderr, "FATAL: the filesystem has to be unmounted\n");
return -2;
}
- change_label_unmounted(btrfs_dev, nLabel);
- return 0;
+ return change_label_unmounted(btrfs_dev, nLabel);
}
--
1.7.8
next prev parent reply other threads:[~2012-01-12 15:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-12 15:17 [PATCH 0/4] btrfs-progs: some patches Danny Kukawka
2012-01-12 15:17 ` [PATCH 1/4] fix segfaults from bnc#710486 Danny Kukawka
2012-01-12 15:17 ` Danny Kukawka [this message]
2012-01-12 15:17 ` [PATCH 3/4] fix some compiler warnings from cgcc Danny Kukawka
2012-01-12 15:17 ` [PATCH 4/4] fix indentation Danny Kukawka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326381467-19848-3-git-send-email-danny.kukawka@bisect.de \
--to=danny.kukawka@bisect.de \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).