From: Arvin Schnell Date: Wed, 3 Aug 2011 09:07:40 +0000 (+0200) Subject: - added mount and umount command (so far secret) X-Git-Tag: v0.1.3~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b70c7e3714e39d35ed1fbd1296c72ea8b939b7a6;p=thirdparty%2Fsnapper.git - added mount and umount command (so far secret) --- diff --git a/tools/snapper.cc b/tools/snapper.cc index fa280d40..eea1100c 100644 --- a/tools/snapper.cc +++ b/tools/snapper.cc @@ -1,3 +1,24 @@ +/* + * Copyright (c) 2011 Novell, Inc. + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + #include #include @@ -451,6 +472,60 @@ command_delete() } +void +help_mount() +{ + cout << _(" Mount snapshot:") << endl + << _("\tsnapper mount ") << endl + << endl; +} + + +void +command_mount() +{ + getopts.parse("mount", GetOpts::no_options); + if (!getopts.hasArgs()) + { + cerr << _("Command 'mount' needs at least one argument.") << endl; + exit(EXIT_FAILURE); + } + + while (getopts.hasArgs()) + { + Snapshots::iterator snapshot = readNum(getopts.popArg()); + snapshot->mountFilesystemSnapshot(); + } +} + + +void +help_umount() +{ + cout << _(" Umount snapshot:") << endl + << _("\tsnapper umount ") << endl + << endl; +} + + +void +command_umount() +{ + getopts.parse("mount", GetOpts::no_options); + if (!getopts.hasArgs()) + { + cerr << _("Command 'mount' needs at least one argument.") << endl; + exit(EXIT_FAILURE); + } + + while (getopts.hasArgs()) + { + Snapshots::iterator snapshot = readNum(getopts.popArg()); + snapshot->umountFilesystemSnapshot(); + } +} + + void help_diff() { @@ -704,6 +779,8 @@ command_help() help_create(); help_modify(); help_delete(); + // help_mount(); // secret until ext4 finished + // help_umount(); // secret until ext4 finished help_diff(); help_rollback(); help_cleanup(); @@ -755,6 +832,8 @@ main(int argc, char** argv) cmds["create"] = command_create; cmds["modify"] = command_modify; cmds["delete"] = command_delete; + cmds["mount"] = command_mount; + cmds["umount"] = command_umount; cmds["diff"] = command_diff; cmds["rollback"] = command_rollback; cmds["cleanup"] = command_cleanup;