NetBSD STAT_ST_BLOCKSIZE prob

Patrick Welche prlw1 at newn.cam.ac.uk
Wed Dec 4 19:39:01 GMT 2002


On Wed, Dec 04, 2002 at 07:12:20PM +0000, jra at dp.samba.org wrote:
> 
> Ah you see this is the *exact* problem. This is why I ditched the
> code that uses stat.st_blksize. It was causing 64-bit copies on
> IRIX to fail.
> 
> The fundamental misunderstanding (and it was mine also when I wrote
> this code) is that stat.st_blksize is the units of stat.st_blocks.
> 
> It is *NOT*. stat.st_blksize is a "guide" to the "best" I/O size
> for the filesystem. It has nothing to do with stat.st_blocks.
> 
> The unfortunate problem is that neither stat.st_blocks, or
> stat.st_blksize are defined by POSIX so vendors set them as
> they wish.

So is your STAT_ST_BLOCKSIZE the units of stat.st_blocks? In that case

     st_blocks      The actual number of blocks allocated for the file in
                    512-byte units.  As short symbolic links are stored in the
                    inode, this number may be zero.

the ubiquitous 512 should do it for netbsd too...

Cheers,

Patrick



More information about the samba-technical mailing list