* m4/fstypename.m4: New file.

* acinclude.m4 (AC_GET_FS_INFO): Add a check to determine whether
getmntinfo() takes struct statvfs instead of struct statfs as its
first argument. Define MOUNTED_GETMNTINFO_STATVFS if it does.
Add a check to determine whether struct statvfs has a field named
f_fstypename.
Use gl_FSTYPENAME tp determine whether struct statfs has a field
named f_fstypename.
* src/mountlist.c (HAVE_F_FSTYPENAME): Define when getmntinfo() is
used and the struct which it fills has a field named f_fstypename.
(read_filesystem_list) [MOUNTED_GETMNTINFO]: Use
MOUNTED_GETMNTINFO_STATVFS to determine the type of the first
argument to getmntinfo().
This commit is contained in:
Pavel Tsekov 2006-06-17 15:39:07 +00:00
parent 6625412758
commit 9e1dd4594d
5 changed files with 115 additions and 0 deletions

View File

@ -1,3 +1,14 @@
2006-06-17 Pavel Tsekov <ptsekov@gmx.net>
* m4/fstypename.m4: New file.
* acinclude.m4 (AC_GET_FS_INFO): Add a check to determine whether
getmntinfo() takes struct statvfs instead of struct statfs as its
first argument. Define MOUNTED_GETMNTINFO_STATVFS if it does.
Add a check to determine whether struct statvfs has a field named
f_fstypename.
Use gl_FSTYPENAME tp determine whether struct statfs has a field
named f_fstypename.
2006-06-07 Pavel Tsekov <ptsekov@gmx.net>
* configure.ac: Revert last commit.

View File

@ -283,6 +283,51 @@ AC_DEFUN([AC_GET_FS_INFO], [
[AC_MSG_WARN([could not determine how to read list of mounted fs])])
gl_FSUSAGE
if test $ac_cv_func_getmntinfo = yes; then
if test $ac_cv_header_sys_statvfs_h = yes; then
AC_MSG_CHECKING([for getmntinfo taking struct statvfs as dnl
first argument (NetBSD 3.0)])
AC_CACHE_VAL(mc_cv_sys_mounted_getmntinfo_statvfs,
[AC_TRY_RUN([
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_UCRED_H
#include <sys/ucred.h> /* needed by FreeBSD */
#endif
#if HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#include <sys/statvfs.h>
main ()
{
struct statvfs *mntbufp;
exit (getmntinfo (&mntbufp, MNT_NOWAIT));
}],
mc_cv_sys_mounted_getmntinfo_statvfs=yes,
mc_cv_sys_mounted_getmntinfo_statvfs=no,
mc_cv_sys_mounted_getmntinfo_statvfs=no)])
AC_MSG_RESULT($mc_cv_sys_mounted_getmntinfo_statvfs)
if test $mc_cv_sys_mounted_getmntinfo_statvfs = yes; then
AC_DEFINE(MOUNTED_GETMNTINFO_STATVFS, 1,
[Define if there is a function named getmntinfo for
reading the list of mounted file systems. (NetBSD 3.0)])
fi
fi
fi
gl_FSTYPENAME
AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,,[
AC_INCLUDES_DEFAULT()
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif])
])

37
m4/fstypename.m4 Normal file
View File

@ -0,0 +1,37 @@
#serial 5
dnl From Jim Meyering.
dnl
dnl See if struct statfs has the f_fstypename member.
dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
dnl
# Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FSTYPENAME],
[
AC_CACHE_CHECK([for f_fstypename in struct statfs],
fu_cv_sys_f_fstypename_in_statfs,
[
AC_TRY_COMPILE(
[
#include <sys/param.h>
#include <sys/types.h>
#include <sys/mount.h>
],
[struct statfs s; int i = sizeof s.f_fstypename;],
fu_cv_sys_f_fstypename_in_statfs=yes,
fu_cv_sys_f_fstypename_in_statfs=no
)
]
)
if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
AC_DEFINE(HAVE_F_FSTYPENAME_IN_STATFS, 1,
[Define if struct statfs has the f_fstypename member.])
fi
]
)

View File

@ -1,3 +1,11 @@
2006-06-17 Pavel Tsekov <ptsekov@gmx.net>
* mountlist.c (HAVE_F_FSTYPENAME): Define when getmntinfo() is
used and the struct which it fills has a field named f_fstypename.
(read_filesystem_list) [MOUNTED_GETMNTINFO]: Use
MOUNTED_GETMNTINFO_STATVFS to determine the type of the first
argument to getmntinfo().
2006-06-11 Leonard den Ottolander <leonard den ottolander nl>
* dir.c (sort_orders): Substitute duplicate hotkey 'C' in sort order

View File

@ -119,6 +119,16 @@
# define HAVE_INFOMOUNT
#endif
#ifdef MOUNTED_GETMNTINFO_STATVFS
# if defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
# define HAVE_F_FSTYPENAME
# endif
#elif MOUNTED_GETMNTINFO
# if defined(HAVE_F_FSTYPENAME_IN_STATFS)
# define HAVE_F_FSTYPENAME
# endif
#endif
/* A mount table entry. */
struct mount_entry
{
@ -282,7 +292,11 @@ read_filesystem_list (int need_fs_type, int all_fs)
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
{
#ifdef MOUNTED_GETMNTINFO_STATVFS
struct statvfs *fsp;
#else
struct statfs *fsp;
#endif
int entries;
entries = getmntinfo (&fsp, MNT_NOWAIT);