On Wed, Feb 20, 2013 at 02:15:52PM +0000, Mike Fleetwood wrote:
> On 20 February 2013 13:05, Audrius Butkevicius
> <[email protected]> wrote:
> > On 01/02/2013 10:30, Hugo Mills wrote:
> >>
> >> On Fri, Feb 01, 2013 at 09:59:49AM +0000, Audrius Butkevicius wrote:
> >>>
> >>> Add '-b' and '--bytes' options to btrfs filesystem df and show, for
> >>> easier
> >>> integration with scripts. This causes all sizes to be displayed in
> >>> decimal
> >>> bytes instead of pretty-printed with human-readable suffices KB, MB, etc.
> >>
> >>     Please, not this way.
> >>
> >
> > Hi Hugo,
> >
> > Just wanted to check which approach you'd prefer to see me adopt:
> >
> > 1. Providing an option which is handled near the entry point (prior going to
> > commands), which would toggle a global flag to indicate the format.
> >
> > 2. An option in every function which uses pretty sizes. (Though -B seems to
> > be used by scrub, -b is used by calc-size and mkfs utils, -u is used by
> > subvolume list and so on, meaning the option might have to be different for
> > different commands)

   Option 1 has an icky global (but one that's pretty much read-only,
so it's not all that bad). Option 2 pushes a piece of information
through a whole load of functions which really don't have to know
about it themselves.

   Either way, it's not particularly elegant, but either way would
work. Unless someone else (Chris? Dave?) has any particular feelings
either way, I'd probably go for option 1.

> > 3. An environment variable BTRFS_UNITS, which when set to b[ytes], changes
> > the behaviour of pretty printing. Avoids having to touch the multiple sets
> > of ad-hoc option parsing code, but is perhaps a slightly non-standard
> > interface.

   Yuck. Don't do that.

> Just for reference du and df use the following options:
>     -b, --bytes    (du only)
>     -h, --human-readable

and
  -H, --si              likewise, but use powers of 1000 not 1024

>     -k               (equivalent to --block-size=1K)
>     --block-size=n[SUFFIX]    (suffixes KB, MB, GB, ... mean 1000,
> 1000^2, 1000^3 ... and K, M, G, ... mean 1024, 1024^2, 1024^3, ...)

  ls has --block-size, -k, -h, --human-readable and --si, but not -H
(which overlaps with another option) or -b.

   I'm not too fussed about -k being there. -h and -H and their long
forms are the ones I'd definitely want to see. --block-size is useful
to give consistent numbers.

   I'd _like_ to see "bytes" as the default option (which also means
that we don't need to use up -b), but that changes the behaviour of
the tool (for anyone who was parsing the output of it in scripts), so
we probably shouldn't do that. OTOH, we're going to be changing the
output of the tool anyway with this change, so maybe it's worth doing
it all at once...

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
       --- He's playing Schubert.  I think Schubert is losing. ---       

Attachment: signature.asc
Description: Digital signature

Reply via email to