2008-05-27 23:22:02 +02:00
|
|
|
$NetBSD: patch-ak,v 1.2 2008/05/27 21:22:02 tonnerre Exp $
|
2006-02-18 18:22:57 +01:00
|
|
|
|
2008-05-27 23:22:02 +02:00
|
|
|
--- gl/mountlist.c.orig 2007-01-24 23:47:25.000000000 +0100
|
|
|
|
+++ gl/mountlist.c
|
|
|
|
@@ -57,7 +57,11 @@ char *strstr ();
|
2006-02-18 18:22:57 +01:00
|
|
|
# if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
|
|
|
|
# define FS_TYPE(Ent) ((Ent).f_fstypename)
|
|
|
|
# else
|
|
|
|
-# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
|
|
|
|
+# ifdef STAT_STATVFS
|
|
|
|
+# define FS_TYPE(Ent) mnt_names[(Ent).f_fsid]
|
|
|
|
+# else
|
|
|
|
+# define FS_TYPE(Ent) mnt_names[(Ent).f_type]
|
|
|
|
+# endif
|
|
|
|
# endif
|
|
|
|
#endif /* MOUNTED_GETFSSTAT */
|
|
|
|
|
2008-05-27 23:22:02 +02:00
|
|
|
@@ -104,6 +108,10 @@ char *strstr ();
|
2006-02-18 18:22:57 +01:00
|
|
|
# include <sys/statfs.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifdef HAVE_SYS_STATVFS_H
|
|
|
|
+#include <sys/statvfs.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#ifdef MOUNTED_LISTMNTENT
|
|
|
|
# include <mntent.h>
|
|
|
|
#endif
|
2008-05-27 23:22:02 +02:00
|
|
|
@@ -178,7 +186,7 @@ char *strstr ();
|
2006-02-18 18:22:57 +01:00
|
|
|
|
|
|
|
#if MOUNTED_GETMNTINFO
|
|
|
|
|
2008-05-27 23:22:02 +02:00
|
|
|
-# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
|
|
|
|
+# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME && ! STAT_STATVFS
|
2006-02-18 18:22:57 +01:00
|
|
|
static char *
|
2008-05-27 23:22:02 +02:00
|
|
|
fstype_to_string (short int t)
|
2006-02-18 18:22:57 +01:00
|
|
|
{
|
2008-05-27 23:22:02 +02:00
|
|
|
@@ -275,9 +283,13 @@ fstype_to_string (short int t)
|
|
|
|
# endif
|
2006-02-18 18:22:57 +01:00
|
|
|
|
|
|
|
static char *
|
|
|
|
+#ifdef STAT_STATVFS
|
|
|
|
+fsp_to_string (const struct statvfs *fsp)
|
|
|
|
+#else
|
|
|
|
fsp_to_string (const struct statfs *fsp)
|
|
|
|
+#endif
|
|
|
|
{
|
2008-05-27 23:22:02 +02:00
|
|
|
-# if HAVE_STRUCT_STATFS_F_FSTYPENAME
|
|
|
|
+# if defined HAVE_STRUCT_STATFS_F_FSTYPENAME || defined STAT_STATVFS
|
2006-02-18 18:22:57 +01:00
|
|
|
return (char *) (fsp->f_fstypename);
|
|
|
|
# else
|
2008-05-27 23:22:02 +02:00
|
|
|
return fstype_to_string (fsp->f_type);
|
|
|
|
@@ -413,7 +425,11 @@ read_file_system_list (bool need_fs_type
|
2006-02-18 18:22:57 +01:00
|
|
|
|
|
|
|
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
|
|
|
{
|
|
|
|
+#ifdef STAT_STATVFS
|
|
|
|
+ struct statvfs *fsp;
|
|
|
|
+#else
|
|
|
|
struct statfs *fsp;
|
|
|
|
+#endif
|
|
|
|
int entries;
|
|
|
|
|
|
|
|
entries = getmntinfo (&fsp, MNT_NOWAIT);
|
2008-05-27 23:22:02 +02:00
|
|
|
@@ -601,9 +617,17 @@ read_file_system_list (bool need_fs_type
|
2006-02-18 18:22:57 +01:00
|
|
|
{
|
|
|
|
int numsys, counter;
|
|
|
|
size_t bufsize;
|
|
|
|
+#ifdef STAT_STATVFS
|
|
|
|
+ struct statvfs *stats;
|
|
|
|
+#else
|
|
|
|
struct statfs *stats;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
+#ifdef STAT_STATVFS
|
|
|
|
+ numsys = getfsstat ((struct statvfs *)0, 0L, MNT_NOWAIT);
|
|
|
|
+#else
|
|
|
|
numsys = getfsstat ((struct statfs *)0, 0L, MNT_NOWAIT);
|
|
|
|
+#endif
|
|
|
|
if (numsys < 0)
|
|
|
|
return (NULL);
|
|
|
|
if (SIZE_MAX / sizeof *stats <= numsys)
|
2008-05-27 23:22:02 +02:00
|
|
|
@@ -666,10 +690,18 @@ read_file_system_list (bool need_fs_type
|
2006-02-18 18:22:57 +01:00
|
|
|
# ifdef GETFSTYP /* SVR3. */
|
|
|
|
if (need_fs_type)
|
|
|
|
{
|
|
|
|
+#ifdef STAT_STATVFS
|
|
|
|
+ struct statvfs fsd;
|
|
|
|
+#else
|
|
|
|
struct statfs fsd;
|
|
|
|
+#endif
|
|
|
|
char typebuf[FSTYPSZ];
|
|
|
|
|
|
|
|
+#ifdef STAT_STATVFS
|
|
|
|
+ if (statvfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
|
|
|
|
+#else
|
|
|
|
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
|
|
|
|
+#endif
|
|
|
|
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
|
|
|
{
|
|
|
|
me->me_type = xstrdup (typebuf);
|