]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- work on ext4 code
authorArvin Schnell <aschnell@suse.de>
Fri, 29 Jul 2011 17:50:13 +0000 (19:50 +0200)
committerArvin Schnell <aschnell@suse.de>
Fri, 29 Jul 2011 17:50:13 +0000 (19:50 +0200)
snapper/Filesystem.cc
snapper/Snapshot.h

index 431b08a64beb42b5d8c61880afb0105e62eeec0c..add022d0a3a67ccaf598e65f58cdc1271a5de4c2 100644 (file)
@@ -121,6 +121,10 @@ namespace snapper
     void
     Ext4::deleteFilesystemSnapshot(unsigned int num) const
     {
+       SystemCmd cmd(CHSNAPBIN " -S " + snapshotFile(num));
+       if (cmd.retcode() != 0)
+            throw DeleteSnapshotFailedException();
+
        // TODO
     }
 
@@ -130,14 +134,14 @@ namespace snapper
     {
        SystemCmd cmd1(CHSNAPBIN " +n " + snapshotFile(num));
        if (cmd1.retcode() != 0)
-           throw CreateSnapshotFailedException();
+           throw MountSnapshotFailedException();
 
        mkdir(snapshotDir(num).c_str(), 0755);
 
        SystemCmd cmd2(MOUNTBIN " -t ext4 -r -o loop,noload " + snapshotFile(num) +
                       " " + snapshotDir(num));
        if (cmd2.retcode() != 0)
-           throw CreateSnapshotFailedException();
+           throw MountSnapshotFailedException();
     }
 
 
@@ -151,9 +155,7 @@ namespace snapper
     bool
     Ext4::checkFilesystemSnapshot(unsigned int num) const
     {
-       // TODO
-
-       return true;
+       return checkNormalFile(snapshotFile(num));
     }
 
 }
index c361e1435e7e2d2e584da8ee9d91885b63effab3..8244bfe6a6bb37931262ce79a817fd16fa1b738e 100644 (file)
@@ -54,6 +54,19 @@ namespace snapper
     };
 
 
+    struct MountSnapshotFailedException : public std::exception
+    {
+       explicit MountSnapshotFailedException() throw() {}
+       virtual const char* what() const throw() { return "mount snapshot failed"; }
+    };
+
+    struct UmountSnapshotFailedException : public std::exception
+    {
+       explicit UmountSnapshotFailedException() throw() {}
+       virtual const char* what() const throw() { return "umount snapshot failed"; }
+    };
+
+
     class Snapshot
     {
     public: