DragonFly commits List (threaded) for 2008-06
DragonFly BSD
DragonFly commits List (threaded) for 2008-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sbin/hammer Makefile cmd_snapshot.c hammer.h hammer.c

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Jun 2008 10:18:11 -0700 (PDT)

:>   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
:   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>


	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.

					Matthew Dillon 

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]