Add defines into related source files

---
 snapper/Filesystem.cc |   24 +++++++++++++++++++++---
 snapper/Filesystem.h  |   10 +++++++---
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/snapper/Filesystem.cc b/snapper/Filesystem.cc
index 1dac168..2aabfde 100644
--- a/snapper/Filesystem.cc
+++ b/snapper/Filesystem.cc
@@ -34,6 +34,7 @@
 #include "snapper/SystemCmd.h"
 #include "snapper/SnapperDefines.h"
 #include "snapper/Regex.h"
+#include "config.h"
 
 
 namespace snapper
@@ -68,7 +69,17 @@ namespace snapper
     {
        typedef Filesystem* (*func_t)(const string& fstype, const string& 
subvolume);
 
-       static const func_t funcs[] = { &Btrfs::create, &Ext4::create, 
&Lvm::create, NULL };
+       static const func_t funcs[] = {
+#ifdef ENABLE_BTRFS
+               &Btrfs::create,
+#endif
+#ifdef ENABLE_EXT4
+               &Ext4::create,
+#endif
+#ifdef ENABLE_LVM
+               &Lvm::create,
+#endif
+       NULL };
 
        for (const func_t* func = funcs; *func != NULL; ++func)
        {
@@ -82,6 +93,7 @@ namespace snapper
     }
 
 
+#ifdef ENABLE_BTRFS
     Filesystem*
     Btrfs::create(const string& fstype, const string& subvolume)
     {
@@ -178,8 +190,10 @@ namespace snapper
     {
        return checkDir(snapshotDir(num));
     }
+    // ENABLE_BTRFS
+#endif
 
-
+#ifdef ENABLE_EXT4
     Filesystem*
     Ext4::create(const string& fstype, const string& subvolume)
     {
@@ -374,8 +388,10 @@ namespace snapper
     {
        return checkNormalFile(snapshotFile(num));
     }
+    // ENABLE_EXT4
+#endif
 
-
+#ifdef ENABLE_LVM
     Filesystem*
     Lvm::create(const string& fstype, const string& subvolume)
     {
@@ -562,5 +578,7 @@ namespace snapper
        return "/dev/mapper/" + boost::replace_all_copy(vg_name, "-", "--") + 
"-" +
            boost::replace_all_copy(snapshotLvName(num), "-", "--");
     }
+    // ENABLE_LVM
+#endif
 
 }
diff --git a/snapper/Filesystem.h b/snapper/Filesystem.h
index 6383b4f..7e5a6ef 100644
--- a/snapper/Filesystem.h
+++ b/snapper/Filesystem.h
@@ -27,6 +27,7 @@
 #include <string>
 #include <vector>
 
+#include "config.h"
 
 namespace snapper
 {
@@ -70,7 +71,7 @@ namespace snapper
 
     };
 
-
+#ifdef ENABLE_BTRFS
     class Btrfs : public Filesystem
     {
     public:
@@ -97,8 +98,9 @@ namespace snapper
        virtual bool checkSnapshot(unsigned int num) const;
 
     };
+#endif
 
-
+#ifdef ENABLE_EXT4
     class Ext4 : public Filesystem
     {
     public:
@@ -130,8 +132,9 @@ namespace snapper
        vector<string> mount_options;
 
     };
+#endif
 
-
+#ifdef ENABLE_LVM
     class Lvm : public Filesystem
     {
     public:
@@ -172,6 +175,7 @@ namespace snapper
        vector<string> mount_options;
 
     };
+#endif
 
 }
 
-- 
1.7.8.6

-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to