Here is something....
#include <stdio.h>
#include <fstab.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
struct fstab *fstab_info;
if (argc <= 1)
{
printf("You must specify a mount point or top-level\n"
"directory of a filesystem where you wish to\n"
"create a file\n");
exit(1);
}
if ((fstab_info = getfsfile(argv[1])) != 0)
{
printf("For \"%s\", got...\n", argv[1]);
printf(" fs_spec = \"%s\"\n", fstab_info->fs_spec);
printf(" fs_file = \"%s\"\n", fstab_info->fs_file);
printf(" fs_vfstype = \"%s\"\n", fstab_info->fs_vfstype);
printf(" fs_mntops = \"%s\"\n", fstab_info->fs_mntops);
printf(" fs_type = \"%s\"\n", fstab_info->fs_type);
printf(" fs_freq = %d\n", fstab_info->fs_freq);
printf(" fs_passno = %d\n", fstab_info->fs_passno);
}
else
{
printf("getfsfile returned null\n");
}
return 0;
}
Here is output from a couple of systems at LLNL...
For "/p/lscratcha", got...
fs_spec = "levi-mds1-ln...@tcp0:/lsa"
fs_file = "/p/lscratcha"
fs_vfstype = "lustre"
fs_mntops = "lazystatfs,flock,nosuid,noauto,defaults"
fs_type = "??"
fs_freq = 0
fs_passno = 0
For "/g/g11", got...
fs_spec = "chip-nfs.llnl.gov:/vol/g11"
fs_file = "/g/g11"
fs_vfstype = "nfs"
fs_mntops = "rsize=8192,wsize=8192,exec,dev,intr,nosuid,rw,noauto"
fs_type = "rw"
fs_freq = 0
fs_passno = 0
It looks like 'fs_vfstype' field of fstab is most useful in determing
whether or not system is parallel. Note 'lustre' for /p/lscratcha and
'nfs' for the other.
To use something like this, you'll have to determine the mount point
given the filename to be created. So, you'd have to map filename to
absolute (full) filename and from that chop off the 'mount point' part
of the name to query fstab as described here.
Mark
On Tue, 2010-12-07 at 05:16 -0800, Roger Martin wrote:
> Hi,
>
> Is there a good way to test whether a user is actually on a parallel
> file system during run-time so the code can adapt accordingly?
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
--
Mark C. Miller, Lawrence Livermore National Laboratory
================!!LLNL BUSINESS ONLY!!================
[email protected] urgent: [email protected]
T:8-6 (925)-423-5901 M/W/Th:7-12,2-7 (530)-753-8511
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org