What, exactly, are stat.st_blocks, statfs.f_b

Jonathan I. Kamens jik at athena.mit.edu
Tue Mar 5 10:36:17 AEST 1991


  I know about statfs; I did, after all, mention it in the subject line of my
original message (which you may not have seen, since it was posted to
comp.unix.wizards).

  The statfs I've got on my system (which came with the vnode code which came
with our NFS code) doesn't appear to have a f_frsize element of the statfs
structure.  So I can't use it on my system.

  As you pointed out, statfs isn't a global thing.  So I can't use it in
general in my program.

  So, the question still remains -- is there any *reliable* way to find out
what st_blocks counts in terms of?  Is the answer, "If statfs exists on the
system, AND it has an f_frsize field, then use that field and do statfs on
every filesystem you encounter.  Otherwise, use 512."  Or is there something
more I can do?

  Sigh.  This all seems like such a muddled mess of different interfaces (or
lacks of interface!) to the same information that I'm tempted to forget about
the whole thing and not make any attempt at all to count blocks.  Yuck.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.internals mailing list