]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- disable functions if libbtrfs is missing 191/head
authorArvin Schnell <aschnell@suse.de>
Thu, 27 Aug 2015 12:27:33 +0000 (14:27 +0200)
committerArvin Schnell <aschnell@suse.de>
Thu, 27 Aug 2015 12:27:33 +0000 (14:27 +0200)
snapper/Btrfs.cc
snapper/BtrfsUtils.cc

index bf5560edfdbc5ac19ac38234e4314e2ca1b52b80..193c52acc49634a67cbdcf181a4710996726cef9 100644 (file)
@@ -352,11 +352,15 @@ namespace snapper
 
        try
        {
+#ifdef HAVE_LIBBTRFS
            subvolid_t subvolid = get_id(openSnapshotDir(num).fd());
+#endif
 
            delete_subvolume(info_dir.fd(), "snapshot");
 
+#ifdef HAVE_LIBBTRFS
            deleted_subvolids.push_back(subvolid);
+#endif
        }
        catch (const runtime_error& e)
        {
@@ -1404,8 +1408,10 @@ namespace snapper
        {
            for (subvolid_t subvolid : deleted_subvolids)
            {
+#ifdef HAVE_LIBBTRFS
                while (!does_subvolume_exist(subvolume_dir.fd(), subvolid))
                    sleep(1);
+#endif
            }
 
            deleted_subvolids.clear();
index b89553fbfe237a039683071fd8c9c17b6699828f..bf737fb1a59e488d2bbd2d29e56d2d45ac5a9244 100644 (file)
@@ -51,6 +51,7 @@
 #define BTRFS_IOC_SUBVOL_CREATE _IOW(BTRFS_IOCTL_MAGIC, 14, struct btrfs_ioctl_vol_args)
 #define BTRFS_IOC_SNAP_DESTROY _IOW(BTRFS_IOCTL_MAGIC, 15, struct btrfs_ioctl_vol_args)
 #define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, struct btrfs_ioctl_vol_args_v2)
+#define BTRFS_IOC_SYNC _IO(BTRFS_IOCTL_MAGIC, 8)
 
 struct btrfs_ioctl_vol_args
 {
@@ -232,6 +233,8 @@ namespace snapper
 #endif
 
 
+#ifdef HAVE_LIBBTRFS
+
        subvolid_t
        get_id(int fd)
        {
@@ -246,6 +249,8 @@ namespace snapper
            return args.treeid;
        }
 
+#endif
+
 
        qgroup_t
        make_qgroup(uint64_t level, subvolid_t id)
@@ -277,6 +282,8 @@ namespace snapper
        }
 
 
+#ifdef HAVE_LIBBTRFS
+
        bool
        does_subvolume_exist(int fd, subvolid_t subvolid)
        {
@@ -300,6 +307,8 @@ namespace snapper
            return sk->nr_items == 0;
        }
 
+#endif
+
 
        void
        sync(int fd)