Subject: Re: bug#10561: stat unclear about size on disk and type of blocks discussed

From: Eric Blake <[email-masked]>
Date: Tue, 07 Feb 2012 12:44:07 -0700

On 02/07/2012 12:20 PM, Filipus Klutiero wrote:
> 
> So are you saying that stat cannot display a file's size on disk?

Not without inventing a new % modifier, or else you doing the math
yourself.  So maybe it is worth adding a new one, as in:

%S  Allocated size (same as %b * %B)

>> I don't see any ambiguity. %b and %B are described in relation
>> to each other, which is all that's required.
> 
> That's not all that's required. Each directive should have a useful
> description, not just a circular definition.
>> See how each refers to the other in the docs:
>>
>>    %b     Number of blocks allocated (see %B)
>>    %B     The size in bytes of each block reported by %b
>>
> 
> I see that, but I fail to see how that would make the description of %b
> unambiguous. A file has a number of file system blocks allocated. I do
> not see what would prevent a reader from interpreting %b as that number.

Maybe it would help to do things like:

%b   Number of blocks allocated (see %B), corresponds to st_blocks
%B   The size in bytes of each block reported by %b, or st_blksize

for those that are familiar with the stat(2) interface.  For that
matter, tying ALL of the existing % modifiers back to struct stat
members might be handy.

-- 
Eric Blake   [email-masked]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org