[comp.bugs.sys5] crossing mount points

cher@whutt.UUCP (Mike Cherepov) (06/09/88)

# The only portable way I can think of to see if a file is remote or not
# is to check the mount table in /etc/mnttab.  Although not the official
# kernel version of the mount table, it does contain a flag indicating that
# a file system is remote.  But that would be useful only if you have a
# full path name and can then traverse down the tree and remember the last
# time you passed a mount point and changed file systems (according to the
# mnttab).  Or you could implement in user code your own version of the
# kernel namei() function.  Excuse me, I'm not feeling well.
# 	Roger Noe			ihnp4!att!uniq!rjnoe

You can tell that you have crossed a mount point by noting that
st_dev has changed, - no need for the full path - then compare
your st_dev with st_rdevs for the files in /etc/mnttab to tell
whether you got a remote.
Not very neat, but does beat the hell out of homespun namei.
		Mike Cherepov