All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs-progs: scan: pass blkid_get_cache error code
Date: Fri, 29 Mar 2019 13:49:54 +0800	[thread overview]
Message-ID: <1553838594-26013-2-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1553838594-26013-1-git-send-email-anand.jain@oracle.com>

blkid_get_cache() returns error code which is -errno. So we can use them
directly.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
Ref:
blkid_get_cache() code:
https://github.com/karelzak/util-linux/blob/master/libblkid/src/cache.c#L93
https://github.com/karelzak/util-linux/blob/master/libblkid/src/blkidP.h#L307
 utils.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/utils.c b/utils.c
index 9e26c884cc6c..c6cdc8f01dc1 100644
--- a/utils.c
+++ b/utils.c
@@ -1994,9 +1994,11 @@ int btrfs_scan_devices(void)
 	if (btrfs_scan_done)
 		return 0;
 
-	if (blkid_get_cache(&cache, NULL) < 0) {
-		error("blkid cache get failed");
-		return 1;
+	ret = blkid_get_cache(&cache, NULL);
+	if (ret < 0) {
+		errno = -ret;
+		error("blkid cache get failed: %m");
+		return ret;
 	}
 	blkid_probe_all(cache);
 	iter = blkid_dev_iterate_begin(cache);
-- 
1.8.3.1


  reply	other threads:[~2019-03-29  5:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29  5:49 [PATCH 1/2] btrfs-progs: scan: cleanup, return errno when we have one Anand Jain
2019-03-29  5:49 ` Anand Jain [this message]
2019-05-15 14:29   ` [PATCH 2/2] btrfs-progs: scan: pass blkid_get_cache error code David Sterba
2019-05-28 12:48     ` Anand Jain
2019-05-15 14:26 ` [PATCH 1/2] btrfs-progs: scan: cleanup, return errno when we have one David Sterba
2019-05-28 12:47   ` 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=1553838594-26013-2-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.