On Wed, Feb 20, 2013 at 02:54:09PM +0000, Hugo Mills wrote:
>    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.

I prefer option 1 as well.

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

For brief overview of the filesytem, the values with suffixes are much easier
to grasp.

This is what I use in scripts:

# perl
sub tobytes($$) {
        my ($a,$suff)=@_;
        $a*=1024*1024*1024*1024 if($suff eq "TiB");
        $a*=1024*1024*1024 if($suff eq "GiB");
        $a*=1024*1024 if($suff eq "MiB");
        $a*=1024 if($suff eq "KiB");

        return $a;
}

so it'll use raw value in case of an unrecognized suffix (forget for now that
it does not recognize the 1000x variants).

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to