[TUHS] question about V7 ls(1) vs. sys/stat.h and ls.c

M. Warner Losh imp at bsdimp.com
Fri May 23 14:02:51 AEST 2003


In message: <20030523033209.GE29449 at nodewarrior.org>
            Chris Palmer <chris at nodewarrior.org> writes:
: Aharon Robbins writes:
: 
: > 	long
: > 	nblock(size)
: > 	long size;
: > 	{
: > 		return((size+511)>>9);
: > 	}
: 
: Unfortunately I can't answer any of your questions; I can only ask a new
: one: What's with that "511" in there?

It rounds size up to the next larger block, and >> 9 divides by 512.
So if you size was 512 it would return '1' but if it was 513 it would
return '2'.

Warner



More information about the TUHS mailing list