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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user