On Tue, Sep 09, 2008 at 07:03:11AM +0200, Michael Kerrisk wrote:
> This report is rather vague.  It would be useful to explain how the
> page "seems to imply that struct stat.st_blocks is in the same units
> as stat.st_blocksize" and even better if you had some suggestion about
> how you think the text should change.


The relevant stat(2) struct stat snippet is:
        struct stat {
                ...
                blksize_t st_blksize; /* blocksize for filesystem I/O */
                blkcnt_t  st_blocks;  /* number of blocks allocated */
                ...
        }

The two fields use the same word, "block", with two different meanings.

In particular, to make use of the st_blocks field, "number of blocks
allocated", one may need to know the size of a "block". Given
st_blksize's description, "blocksize for filesystem I/O", it appears
that its purpose is to describe the size of the block unit used for
st_blocks.

Does this convey why I find these fields vague?


A suggestion for their description:
st_blksize; /* file system I/O block size */
st_blocks;  /* disk blocks (e.g., sectors) allocated */

Or if st_blocks is always in units of 512 B, this may be more clear:
st_blocks;  /* number of 512 B blocks allocated */

-- 
Chris Frost  |  http://www.frostnet.net/chris/
-------------+--------------------------------
PGP: http://www.frostnet.net/chris/pgpkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to