[OpenAFS] how do I know if I'm in AFS

David Thompson thomas@cs.wisc.edu
Wed, 04 Jun 2008 13:28:44 -0500


David Bear wrote:
> aside from taking the full path to the file I'm stat'ing, is there any 
> other operating system independent way to tell if I'm looking at a file 
> in afs?
> 
> stat can return directory, link, file types. Are there other codes that 
> could be use to test for 'inAFS'?

Compare the st_dev stat() entry for the file in question with the st_dev 
entry of /afs.  If they're the same, you're in afs.

This doesn't require any magic constants (except the afs mount point 
"/afs").

Cheers,

Dave Thompson
UW-Madison