All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH 3/6] btrfs-progs: remove duplicate function __is_subvol()
Date: Mon, 21 Mar 2016 15:21:02 +0800	[thread overview]
Message-ID: <1458544865-16467-4-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1458544865-16467-1-git-send-email-anand.jain@oracle.com>

The function test_issubvolume() provides the same check, and
has better logic.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 utils.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/utils.c b/utils.c
index 046ddf8eef19..110a4badb764 100644
--- a/utils.c
+++ b/utils.c
@@ -1864,25 +1864,6 @@ int set_label(const char *btrfs_dev, const char *label)
 }
 
 /*
- * Unsafe subvolume check.
- *
- * This only checks ino == BTRFS_FIRST_FREE_OBJECTID, even it is not in a
- * btrfs mount point.
- * Must use together with other reliable method like btrfs ioctl.
- */
-static int __is_subvol(const char *path)
-{
-	struct stat st;
-	int ret;
-
-	ret = lstat(path, &st);
-	if (ret < 0)
-		return ret;
-
-	return st.st_ino == BTRFS_FIRST_FREE_OBJECTID;
-}
-
-/*
  * A not-so-good version fls64. No fascinating optimization since
  * no one except parse_size use it
  */
@@ -2002,7 +1983,7 @@ u64 parse_qgroupid(const char *p)
 
 path:
 	/* Path format like subv at 'my_subvol' is the fallback case */
-	ret = __is_subvol(p);
+	ret = test_issubvolume(p);
 	if (ret < 0 || !ret)
 		goto err;
 	fd = open(p, O_RDONLY);
-- 
2.7.0


  parent reply	other threads:[~2016-03-21  7:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-21  7:20 [PATCH 0/6 v3] btrfs-progs: subvolume functions reorg Anand Jain
2016-03-21  7:21 ` [PATCH 1/6] btrfs-progs: spatial rearrange subvolume functions together Anand Jain
2016-03-21  7:21 ` [PATCH 2/6] btrfs-progs: move test_issubvolume() to utils.c Anand Jain
2016-03-21  7:21 ` Anand Jain [this message]
2016-03-21  7:21 ` [PATCH 4/6] btrfs-progs: move get_subvol_name() " Anand Jain
2016-03-21  7:21 ` [PATCH 5/6] btrfs-progs: create get_subvol_info() Anand Jain
2016-03-21  7:21 ` [PATCH 6/6] btrfs-progs: rename get_subvol_name() to subvol_minus_mnt() Anand Jain
2016-03-22 16:11 ` [PATCH 0/6 v3] btrfs-progs: subvolume functions reorg David Sterba

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=1458544865-16467-4-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --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 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.