From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz, chris.mason@fusionio.com, jbacik@fusionio.com
Subject: [PATCH 1/2] btrfs-progs: make get_btrfs_mount callable
Date: Tue, 22 Oct 2013 13:53:21 +0800 [thread overview]
Message-ID: <1382421202-18494-1-git-send-email-anand.jain@oracle.com> (raw)
get_btrfs_mount is reusable function but it is printing
errors, this removes it. Here the parent function of
open_path_or_dev_mnt does print error msg on error.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
utils.c | 6 ++----
utils.h | 1 +
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/utils.c b/utils.c
index a7441c1..cb69b2b 100644
--- a/utils.c
+++ b/utils.c
@@ -692,7 +692,8 @@ int is_block_device(const char *path) {
* On failure, returns -errno (not mounted yields -EINVAL)
* Is noisy on failures, expects to be given a mounted device.
*/
-static int get_btrfs_mount(const char *dev, char *mp, size_t mp_size) {
+int get_btrfs_mount(const char *dev, char *mp, size_t mp_size)
+{
int ret;
int fd = -1;
@@ -717,7 +718,6 @@ static int get_btrfs_mount(const char *dev, char *mp, size_t mp_size) {
ret = check_mounted_where(fd, dev, mp, mp_size, NULL);
if (!ret) {
- fprintf(stderr, "%s is not a mounted btrfs device\n", dev);
ret = -EINVAL;
} else { /* mounted, all good */
ret = 0;
@@ -725,8 +725,6 @@ static int get_btrfs_mount(const char *dev, char *mp, size_t mp_size) {
out:
if (fd != -1)
close(fd);
- if (ret)
- fprintf(stderr, "Could not get mountpoint for %s\n", dev);
return ret;
}
diff --git a/utils.h b/utils.h
index 251ef8e..8370686 100644
--- a/utils.h
+++ b/utils.h
@@ -91,5 +91,6 @@ int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
int ask_user(char *question);
int lookup_ino_rootid(int fd, u64 *rootid);
int btrfs_scan_lblkid(int update_kernel);
+int get_btrfs_mount(const char *dev, char *mp, size_t mp_size);
#endif
--
1.7.1
next reply other threads:[~2013-10-22 5:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-22 5:53 Anand Jain [this message]
2013-10-22 5:53 ` [PATCH 2/2] btrfs-progs: filesystem show of specified mounted disk should work Anand Jain
2013-10-22 14:33 ` David Sterba
2013-10-23 2:08 ` Anand Jain
2013-10-24 14:51 ` David Sterba
2013-10-24 14:54 ` Hugo Mills
2013-10-24 17:21 ` Anand Jain
2013-10-22 16:39 ` David Sterba
2013-10-23 1:53 ` Anand Jain
2013-10-22 14:43 ` [PATCH 1/2] btrfs-progs: make get_btrfs_mount callable David Sterba
2013-10-23 2:11 ` Anand Jain
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=1382421202-18494-1-git-send-email-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=chris.mason@fusionio.com \
--cc=dsterba@suse.cz \
--cc=jbacik@fusionio.com \
--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).