btrfs-util: introduce btrfs_is_filesystem() and make use of it where appropriate

Let's unify the code that checks whether an fd is on btrfs a bit.

(Also, rename btrfs_is_snapshot() to btrfs_is_subvol(), since that's
usually how this is referred to in our code)
This commit is contained in:
Lennart Poettering
2015-04-22 13:27:53 +02:00
parent 03091baac3
commit 21222ea5cd
3 changed files with 22 additions and 13 deletions
+4 -5
View File
@@ -136,12 +136,11 @@ static int image_make(
/* btrfs subvolumes have inode 256 */
if (st.st_ino == 256) {
struct statfs sfs;
if (fstatfs(fd, &sfs) < 0)
return -errno;
if (F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC)) {
r = btrfs_is_filesystem(fd);
if (r < 0)
return r;
if (r) {
BtrfsSubvolInfo info;
BtrfsQuotaInfo quota;