[Ocfs2-tools-devel] [PATCH 08/11] Ocfs2-tools: Add main.c to o2info.
Joel Becker
Joel.Becker at oracle.com
Thu Feb 25 16:13:01 PST 2010
On Sat, Feb 20, 2010 at 02:46:06PM +0800, tristan wrote:
> > Argh! I considered using '-F' above.
> > I think we're going to have to give up on option names for this.
> >They aren't options - they are _operations_. Forget getopt for these.
> >Instead, the usage should be 'o2info [options] <operation> [..
> ><operation>] <device>'. eg, "o2info -F volinfo freefrag freeinodes
> >/dev/sdb1". You only use getopt to gather actual options. Things like
> >"no coherencye". Then at the end of the option list, you walk the
> >remaining arguments for operation names. The last argument is the
>
> You suggestion may make the usage of o2info look more
> straightforward and easy for end-users, It however will be losing
> flexibility somehow, How about the case when each operation needs a
> specific argument, such as, 'freefrag' need us to specify a
> chunksize. Besides, it also keeps an unification in favor to
Good point, I didn't realize any of the operations took
arguments.
> tunefs.ocfs2 which also uses long-options for operations. Even
> what's more, we also could be able to do combined operations by
> following:
>
> 'o2info --volinfo --fs-features /dev/sdx1', and we will not be
I'm confused by this one. 'o2info volinfo fs-features
/dev/sdx1' works just as well as the one with '--'. So I don't see how
we cause any problems.
> forcing users to place device or filename at the end of cmd,
> following usage also is welcome:
>
> 'o2info /file/in/ocfs2/volume --volinfo --freefrage 32' OR
>
> 'o2info --volinfo /dev/sdb1 --fs-features'
This is a "don't care". There's no real usability benefit to
allowing the device in the middle.
We have to handle arguments to operations. Our real problem was
the conflicting short options. Solution: no short options for
operations. All operations (--volinfo, --fs-features, --freefrag, etc)
are long options only. True options (-v for --verbose, -F for
--no-coherency, etc) have both short and long versions.
Joel
--
"The trouble with being punctual is that nobody's there to
appreciate it."
- Franklin P. Jones
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list