From: Arvin Schnell Date: Fri, 14 Jan 2011 09:23:54 +0000 (+0100) Subject: - start background comparsion in snapper tool X-Git-Tag: v0.1.3~544 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a7bb9d87d993fd830f28c87658179a0c263e187;p=thirdparty%2Fsnapper.git - start background comparsion in snapper tool --- diff --git a/snapper/Snapper.cc b/snapper/Snapper.cc index bafa3f8f..9cb785d5 100644 --- a/snapper/Snapper.cc +++ b/snapper/Snapper.cc @@ -289,6 +289,20 @@ namespace snapper } + void + startBackgroundComparsion(unsigned int num1, unsigned int num2) + { + y2mil("num1:" << num1 << " num2:" << num2); + + string dir1 = SNAPSHOTSDIR "/" + decString(num1) + "/snapshot"; + string dir2 = SNAPSHOTSDIR "/" + decString(num2) + "/snapshot"; + + string output = SNAPSHOTSDIR "/" + decString(num2) + "/files-" + decString(num1) + ".txt"; + + SystemCmd(COMPAREDIRSBIN " " + quote(dir1) + " " + quote(dir2) + " " + quote(output)); + } + + bool setComparisonNums(unsigned int num1, unsigned int num2) { diff --git a/snapper/SnapperDefines.h b/snapper/SnapperDefines.h index e242dd37..02cf6f59 100644 --- a/snapper/SnapperDefines.h +++ b/snapper/SnapperDefines.h @@ -30,5 +30,7 @@ #define BTRFSBIN "/sbin/btrfs" +#define COMPAREDIRSBIN "/usr/lib/snapper/bin/compare-dirs" + #endif diff --git a/snapper/SnapperInterface.h b/snapper/SnapperInterface.h index 7a4f68b3..b6a5c446 100644 --- a/snapper/SnapperInterface.h +++ b/snapper/SnapperInterface.h @@ -92,6 +92,8 @@ namespace snapper // use num = 0 for system + void startBackgroundComparsion(unsigned int num1, unsigned int num2); + bool setComparisonNums(unsigned int num1, unsigned int num2); unsigned int getComparisonNum1(); diff --git a/tools/cli.cc b/tools/cli.cc index f186e15b..7acde7f9 100644 --- a/tools/cli.cc +++ b/tools/cli.cc @@ -59,7 +59,10 @@ void createSnap( const list& args ) else if( type=="pre" ) createPreSnapshot(desc); else if( type=="post" ) - createPostSnapshot(number); + { + unsigned int num2 = createPostSnapshot(number); + startBackgroundComparsion(number, num2); + } else y2war( "unknown type:\"" << type << "\"" ); }