mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
* m4/ls-mntd-fs.m4: Update to serial#22, which adds support
for getmntinfo() returning its result in struct statvfs. * m4/fstypename.m4: Update to serial#6, which replaces HAVE_F_FSTYPENAME_IN_STATFS with HAVE_STRUCT_STATFS_F_FSTYPENAME. * src/mountlist.c: Sync with gnulib. All uses of HAVE_F_FSTYPENAME replaced by HAVE_STRUCT_STATFS_F_FSTYPENAME. [MOUNTED_GETMNTINFO2] Include sys/statvfs.h. (read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement.
This commit is contained in:
parent
f588181dc6
commit
d407b130f4
@ -1,3 +1,10 @@
|
||||
2006-09-07 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* m4/ls-mntd-fs.m4: Update to serial#22, which adds support
|
||||
for getmntinfo() returning its result in struct statvfs.
|
||||
* m4/fstypename.m4: Update to serial#6, which replaces
|
||||
HAVE_F_FSTYPENAME_IN_STATFS with HAVE_STRUCT_STATFS_F_FSTYPENAME.
|
||||
|
||||
2006-09-07 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* acinclude.m4 (AC_GET_FS_INFO): Revert a failed attempt to
|
||||
|
@ -1,37 +1,22 @@
|
||||
#serial 5
|
||||
#serial 6
|
||||
|
||||
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 If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME.
|
||||
dnl
|
||||
|
||||
# Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1998, 1999, 2001, 2004, 2006 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_CHECK_MEMBERS([struct statfs.f_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
|
||||
]
|
||||
)
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
])
|
||||
])
|
||||
|
@ -1,4 +1,4 @@
|
||||
#serial 21
|
||||
#serial 22
|
||||
# How to list mounted file systems.
|
||||
|
||||
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
|
||||
@ -28,7 +28,7 @@ AC_CHECK_FUNCS(getmntent)
|
||||
AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS],
|
||||
[
|
||||
AC_CHECK_FUNCS(listmntent getmntinfo)
|
||||
AC_CHECK_HEADERS_ONCE(sys/param.h)
|
||||
AC_CHECK_HEADERS_ONCE(sys/param.h sys/statvfs.h)
|
||||
|
||||
# We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
|
||||
# NGROUPS (as the array dimension for a struct member) without a definition.
|
||||
@ -232,10 +232,36 @@ if test -z "$ac_list_mounted_fs"; then
|
||||
])
|
||||
AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
|
||||
if test $fu_cv_sys_mounted_getmntinfo = yes; then
|
||||
AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
|
||||
AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo2,
|
||||
[
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/types.h>
|
||||
#if HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
#if HAVE_SYS_STATVFS_H
|
||||
# include <sys/statvfs.h>
|
||||
#endif
|
||||
extern int getmntinfo (struct statfs **, int);
|
||||
], [],
|
||||
[fu_cv_sys_mounted_getmntinfo2=no],
|
||||
[fu_cv_sys_mounted_getmntinfo2=yes])
|
||||
])
|
||||
AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2])
|
||||
if test $fu_cv_sys_mounted_getmntinfo2 = no; then
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTINFO, 1,
|
||||
[Define if there is a function named getmntinfo for reading the
|
||||
list of mounted file systems. (4.4BSD, Darwin)])
|
||||
list of mounted file systems and it returns an array of
|
||||
'struct statfs'. (4.4BSD, Darwin)])
|
||||
else
|
||||
ac_list_mounted_fs=found
|
||||
AC_DEFINE(MOUNTED_GETMNTINFO2, 1,
|
||||
[Define if there is a function named getmntinfo for reading the
|
||||
list of mounted file systems and it returns an array of
|
||||
'struct statvfs'. (NetBSD 3.0)])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
2006-09-07 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* mountlist.c: Sync with gnulib.
|
||||
All uses of HAVE_F_FSTYPENAME replaced by
|
||||
HAVE_STRUCT_STATFS_F_FSTYPENAME.
|
||||
[MOUNTED_GETMNTINFO2] Include sys/statvfs.h.
|
||||
(read_file_system_list) [MOUNTED_GETMNTINFO2]: Implement.
|
||||
|
||||
2006-09-07 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* mountlist.c: Revert a failed attempt to properly detect and use
|
||||
|
@ -48,6 +48,10 @@
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||
#include <sys/mount.h>
|
||||
#include <sys/fs_types.h>
|
||||
@ -169,7 +173,7 @@ static int xatoi (const char *cp)
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTENT1 */
|
||||
|
||||
#if defined (MOUNTED_GETMNTINFO) && !defined (HAVE_F_FSTYPENAME)
|
||||
#if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
static char *fstype_to_string (short t)
|
||||
{
|
||||
switch (t) {
|
||||
@ -261,7 +265,7 @@ static char *fstype_to_string (short t)
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTINFO && !HAVE_F_FSTYPENAME */
|
||||
#endif /* ! HAVE_STRUCT_STATFS_F_FSTYPENAME */
|
||||
|
||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||
static char *
|
||||
@ -352,7 +356,7 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = strdup (fsp->f_mntonname);
|
||||
#ifdef HAVE_F_FSTYPENAME
|
||||
#ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||
me->me_type = strdup (fsp->f_fstypename);
|
||||
#else
|
||||
me->me_type = fstype_to_string (fsp->f_type);
|
||||
@ -368,6 +372,28 @@ read_filesystem_list (int need_fs_type, int all_fs)
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTINFO */
|
||||
|
||||
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
|
||||
{
|
||||
struct statvfs *fsp;
|
||||
int entries;
|
||||
|
||||
entries = getmntinfo (&fsp, MNT_NOWAIT);
|
||||
if (entries < 0)
|
||||
return NULL;
|
||||
for (; entries-- > 0; fsp++) {
|
||||
me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
|
||||
me->me_devname = strdup (fsp->f_mntfromname);
|
||||
me->me_mountdir = strdup (fsp->f_mntonname);
|
||||
me->me_type = strdup (fsp->f_fstypename);
|
||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||
|
||||
/* Add to the linked list. */
|
||||
mtail->me_next = me;
|
||||
mtail = me;
|
||||
}
|
||||
}
|
||||
#endif /* MOUNTED_GETMNTINFO2 */
|
||||
|
||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||
{
|
||||
int offset = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user