diff options
author | Jim Meyering <jim@meyering.net> | 1996-05-23 13:04:41 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-05-23 13:04:41 +0000 |
commit | 7f7c69fa196a129f306790690f55a059f750d1de (patch) | |
tree | b7822b0dc5e2e0f8487362456e9a78e37ae277a4 | |
parent | 7d358b253f8a3c3031163a48f438a58091e6356b (diff) | |
download | gnulib-7f7c69fa196a129f306790690f55a059f750d1de.tar.gz |
(read_filesystem_list) [MOUNTED_LISTMNTENT]: New function.
From Johan Danielsson (joda@pdc.kth.se).
-rw-r--r-- | lib/mountlist.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/mountlist.c b/lib/mountlist.c index 5933f76881..86f1e76876 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -80,6 +80,10 @@ void error (); #include <sys/statfs.h> #endif +#ifdef MOUNTED_LISTMNTENT +#include <mntent.h> +#endif + #ifdef MOUNTED_GETMNTENT2 /* SVR4. */ #include <sys/mnttab.h> #endif @@ -195,6 +199,36 @@ read_filesystem_list (need_fs_type, all_fs) me->me_next = NULL; mount_list = mtail = me; +#ifdef MOUNTED_LISTMNTENT + { + struct tabmntent *mntlist, *p; + struct mntent *mnt; + struct mount_entry *me; + + /* the third and fourth arguments could be used to filter mounts, + but Crays doesn't seem to have any mounts that we want to + remove. Specifically, automount create normal NFS mounts. + */ + + if(listmntent(&mntlist, KMTAB, NULL, NULL) < 0) + return NULL; + p = mntlist; + while(p){ + mnt = p->ment; + me = (struct mount_entry*) xmalloc(sizeof (struct mount_entry)); + me->me_devname = xstrdup(mnt->mnt_fsname); + me->me_mountdir = xstrdup(mnt->mnt_dir); + me->me_type = xstrdup(mnt->mnt_type); + me->me_dev = -1; + me->me_next = NULL; + mtail->me_next = me; + mtail = me; + p = p->next; + } + freemntlist(mntlist); + } +#endif + #ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ { struct mntent *mnt; |