summaryrefslogtreecommitdiff
path: root/src/shared/machine-image.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-22 13:08:19 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-22 13:27:53 +0200
commit21222ea5cdec65fa30a75bd5a78475459075b946 (patch)
treebd043503be06aa6a0c10ed097eece733a4466f47 /src/shared/machine-image.c
parent03091baac3c37094af6a30be31e4962dd26f8404 (diff)
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)
Diffstat (limited to 'src/shared/machine-image.c')
-rw-r--r--src/shared/machine-image.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 0b41860b5d..bc215f0ad5 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -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;