cvs commit: src/sbin/hammer Makefile cmd_snapshot.c hammer.h hammer.c
Matthew Dillon
dillon at apollo.backplane.com
Wed Jun 25 10:19:29 PDT 2008
:> Log:
:> Implement: hammer snapshot <softlink-dir> [<filesystem>]
:
:How about to change the command line syntax into:
:
: hammer snapshot <softlink-dir> [<snapshot-name>] [<filesystem>]
All the other commands use:
hammer <command> <filesystem> [... other arguments]
For the snapshot command I recommend allowing two formats:
hammer snapshot <softlink-dir-in-filesystem>
hammer snapshot <filesystem> <softlink-dir>
:Alternatively, it could be possible (slightly "harder" to implement), so
:achive the same with:
:
: hammer snapshot <softlink-dir+snapshot-name> [<filesystem>]
:
:So that the hammer utility would determine whether the path given for
:softlink-dir actually exists, if not, it is assumed to be the snapshot
:name. I don't like it that much, because there are some implicit
:assumption, so if nobody objects, I'd go with the first approach.
:
:Right now, the snapshots generated are named after the transaction id,
:something like: 0xffffffffffffffffff, which clearly is not that
:beautiful!
:
:Regards,
: Michael
:
Have it create a name based on the current date and time and allow the
prefix to be specified on the command line using %s:
hammer snapshot <softlink-dir-in-filesystem>
hammer snapshot <filesystem> <softlink-dir>
So:
hammer snapshot /usr/obj "/mysnapshots/obj-%s"
--> /mysnapshots/obj-20080625
hammer snapshot /usr/obj "/mysnapshots/obj-%s-%s"
--> /mysnapshots/obj-20080625-1013
hammer snapshot /usr/obj "/mysnapshots"
--> /mysnapshots/snap-20080625-1013
Or something like that.
The coding to check for '%' is just a strchr() or two. As long as you
validate that the string contains either zero % extensions, one, or two,
and that the extensions are always '%s' (verses '%d' or something else),
then you can directly use it as a format string.
-Matt
Matthew Dillon
<dillon at backplane.com>
More information about the Commits
mailing list