[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using statfs to check a remote file



"T. Alex Chen" <alex_chen@yahoo.com> writes:

> How do I determine if a file is a remote mounted file from statfs()
> call, i.e.  which member of the 'struct statfs' contains information to
> indicate the file is NOT a local file?

This is not a very well-defined question, so the answer in general is "you
can't know that."  Consider iSCSI, a VM that uses NFS as a backing file
store, etc.

You can use the f_type attribute to struct statfs to look for the specific
file systems you're interested in, but that's about as good as you can do.
(Note that the list in the man page is not complete.)

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: