[net.unix] Device numbers in a stat entry vs. the kernel i_node table

sjm@dayton.UUCP (sjm) (09/07/86)

In trying to port the ofiles program which was recently posted, to a 
System V.2 release of Unix on a Tower/32, I was able to get every
thing to work EXECEPT: (There's always an execpt :-)

Ofiles gets the device number (st_dev) from a stat() of the file you
are looking for and compares it to the device number it gets from the
kernel inode table (sys/inode.h -> i_dev). These 2 numbers never match
even though the inode numbers themselves match and I am fairly
certain (95%) that they point to the same inodes (I checked 
by simply removing the device number check, and keeping only the
inode number checking, and ofiles "worked" fine). 

My question is this: Does anyone have an idea of why these two 
numbers are different on System V? Should they be? Does one maybe
(somehow) point in to a mount table or something? Also, of course,
how can I relate the two together?

Thanks in advance!

-- 
Steven J. McDowall	
Dayton-Hudson Dept. Store. Co.		UUCP: ihnp4!rosevax!dayton!sjm
700 on the Mall				ATT:  1 612 375 2816
Mpls, Mn. 55408

wescott@sauron.UUCP (09/09/86)

In article <186@dayton.UUCP> sjm@dayton.UUCP (Steven J. McDowall) writes:
> In trying to port the ofiles program which was recently posted, to a 
> System V.2 release of Unix on a Tower/32.
> 				...
> Ofiles gets the device number (st_dev) from a stat() of the file you
> are looking for and compares it to the device number it gets from the
> kernel inode table (sys/inode.h -> i_dev). These 2 numbers never match
> 				...
> My question is this: Does anyone have an idea of why these two 
> numbers are different on System V? Should they be? Does one maybe
> (somehow) point in to a mount table or something? Also, of course,
> how can I relate the two together?

	st_dev == brdev(i_dev)

where brdev is a macro defined in <sys/sysmacros.h>.  There are some bits
masked off of i_dev which are used to indicate whether the filesystem 
uses 1024-byte blocks or 512-byte blocks.  i_dev should be something like
0x2204 while st_dev would be 0x0204.


-- 
	-Mike Wescott
	 ncrcae!wescott