File System Type (statfs, sysfs)
Tim Roper
timr at labtam.OZ
Tue May 31 23:51:00 AEST 1988
In article <479 at uniq.UUCP>, rjnoe at uniq.UUCP (Roger J. Noe) writes:
> The following pertains to UNIX System V Release 3.1.1 Version 3 for the AT&T
> 3B2 computer. Perhaps I have misunderstood the purpose of the statfs(2)
> system call, but when I use it on remote file systems (RFS), I always get
> the same file system type as local (non-RFS) file systems. The following
> program illustrates my point:
> ...
When you statfs(2) a remote (RFS) file, f_fstyp gives the filesystem
index from the remote machine. Beware that eg. if "S51K" on the remote
machine is a different index to what it is on the local machine you
get the *former*. This can and does happen if the local and remote
machines have different filesystems configured. Therefore using
sysfs(GETFSTYP, ...) to map an f_fstyp obtained from statfs(2) onto a
name is not correct in general, as sysfs(2) uses the local mapping.
If you stat(2) a remote file you get the high order bit of st_dev
turned on so you can tell that it is remote if you want to. Also the
major number tells which machine it resides on. And the minor
number tells which filesystem on the remote machine the file
resides on. The major and minor are uninteresting on their own but can
be used to see whether two files reside on the same machine and/or
filesystem. I understand that this is so that programs like cp(1)
that decide whether two files are the same by comparing st_dev and
st_ino still work (unless you "remotely" mount a local filesystem).
-Tim.
D
More information about the Comp.bugs.sys5
mailing list