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

NFS_SUPER_MAGIC portability



Hi,

I have the problem that in a package (casacore) there is basically the
following code:

---------------------------------8<------------------------------------
#include <sys/vfs.h>
#include <linux/nfs_fs.h>

Bool Directory::isNFSMounted() const
{
   struct statfs buf;
   if (statfs (itsFile.path().expandedName().chars(), &buf) < 0) {
      throw (AipsError ("Directory::isNFSMounted error on " +
            itsFile.path().expandedName() +
            ": " + strerror(errno)));
   }
   return buf.f_type == NFS_SUPER_MAGIC;
}
---------------------------------8<------------------------------------

The linux include subdir is obviously only available on Linux archs, not
on kfreebsd or hurd. From the "statfs" manpage, I had the impression
that the second include is just not needed; however then NFS_SUPER_MAGIC
is not available.

So how do I do this portable (so that I could forward it to upstream as
well)?

Best regards

Ole


Reply to: