Mercurial > hg > octave-kai > gnulib-hg
changeset 14191:00edc8eebaa5
mountlist: add support for Interix
* lib/mountlist.c (read_file_system_list) [MOUNTED_INTERIX_STATVFS]:
Apply statvfs to all entries of /dev/fs.
* m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Check for statvfs,
and if found, AC_DEFINE MOUNTED_INTERIX_STATVFS.
author | Markus Duft <mduft@gentoo.org> |
---|---|
date | Thu, 20 Jan 2011 09:19:24 +0100 |
parents | 6699cf2b13db |
children | 68883c50dbf9 |
files | ChangeLog lib/mountlist.c m4/ls-mntd-fs.m4 |
diffstat | 3 files changed, 69 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-01-14 Markus Duft <mduft@gentoo.org> + + mountlist: add support for Interix + * lib/mountlist.c (read_file_system_list) [MOUNTED_INTERIX_STATVFS]: + Apply statvfs to all entries of /dev/fs. + * m4/ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Check for statvfs, + and if found, AC_DEFINE MOUNTED_INTERIX_STATVFS. + 2011-01-20 Jim Meyering <meyering@redhat.com> maint.mk: improve the public-submodule-commit rule
--- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -112,6 +112,11 @@ # include <sys/vfs.h> #endif +#ifdef MOUNTED_INTERIX_STATVFS /* Interix. */ +# include <sys/statvfs.h> +# include <dirent.h> +#endif + #ifdef DOLPHIN /* So special that it's not worth putting this in autoconf. */ # undef MOUNTED_FREAD_FSTYP @@ -879,6 +884,45 @@ } #endif /* MOUNTED_VMOUNT. */ +#ifdef MOUNTED_INTERIX_STATVFS + { + DIR *dirp = opendir ("/dev/fs"); + char node[9 + NAME_MAX]; + + if (!dirp) + goto free_then_fail; + + while (1) + { + struct statvfs dev; + struct dirent entry; + struct dirent *result; + + if (readdir_r (dirp, &entry, &result) || result == NULL) + break; + + strcpy (node, "/dev/fs/"); + strcat (node, entry.d_name); + + if (statvfs (node, &dev) == 0) + { + me = xmalloc (sizeof *me); + me->me_devname = xstrdup (dev.f_mntfromname); + me->me_mountdir = xstrdup (dev.f_mntonname); + me->me_type = xstrdup (dev.f_fstypename); + me->me_type_malloced = 1; + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); + me->me_remote = ME_REMOTE (me->me_devname, me->me_type); + me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ + + /* Add to the linked list. */ + *mtail = me; + mtail = &me->me_next; + } + } + } +#endif /* MOUNTED_INTERIX_STATVFS */ + *mtail = NULL; return mount_list;
--- a/m4/ls-mntd-fs.m4 +++ b/m4/ls-mntd-fs.m4 @@ -326,6 +326,23 @@ fi if test -z "$ac_list_mounted_fs"; then + # Interix / BSD alike statvfs + # the code is really interix specific, so make sure, we're on it. + case "$host" in + *-interix*) + AC_CHECK_FUNCS([statvfs]) + if test $ac_cv_func_statvfs = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1], + [Define if we are on interix, and ought to use statvfs plus + some special knowledge on where mounted filesystems can be + found. (Interix)]) + fi + ;; + esac +fi + +if test -z "$ac_list_mounted_fs"; then AC_MSG_ERROR([could not determine how to read list of mounted file systems]) # FIXME -- no need to abort building the whole package # Can't build mountlist.c or anything that needs its functions