Ticket #2425: fixup read_filesystem_list() for NetBSD >=3.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Aleksey Cheusov 2010-11-21 10:11:57 +03:00 committed by Andrew Borodin
parent 81b9326843
commit faff5709c6

View File

@ -54,6 +54,7 @@
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */ #ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
#include <sys/statvfs.h> #include <sys/statvfs.h>
#define statfs statvfs
#endif #endif
#ifdef MOUNTED_GETMNT /* Ultrix. */ #ifdef MOUNTED_GETMNT /* Ultrix. */
@ -371,7 +372,7 @@ read_filesystem_list (int need_fs_type, int all_fs)
#endif /* MOUNTED */ #endif /* MOUNTED */
#endif /* MOUNTED_GETMNTENT1 */ #endif /* MOUNTED_GETMNTENT1 */
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */ #if defined(MOUNTED_GETMNTINFO) || defined(MOUNTED_GETMNTINFO2) /* 4.4BSD and NetBSD >= 3 */
{ {
struct statfs *fsp; struct statfs *fsp;
int entries; int entries;
@ -384,7 +385,7 @@ read_filesystem_list (int need_fs_type, int all_fs)
me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); me = (struct mount_entry *) malloc (sizeof (struct mount_entry));
me->me_devname = strdup (fsp->f_mntfromname); me->me_devname = strdup (fsp->f_mntfromname);
me->me_mountdir = strdup (fsp->f_mntonname); me->me_mountdir = strdup (fsp->f_mntonname);
#ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME #if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(MOUNTED_GETMNTINFO2)
me->me_type = strdup (fsp->f_fstypename); me->me_type = strdup (fsp->f_fstypename);
#else #else
me->me_type = fstype_to_string (fsp->f_type); me->me_type = fstype_to_string (fsp->f_type);
@ -398,30 +399,7 @@ read_filesystem_list (int need_fs_type, int all_fs)
fsp++; fsp++;
} }
} }
#endif /* MOUNTED_GETMNTINFO */ #endif /* MOUNTED_GETMNTINFO || MOUNTED_GETMNTINFO2 */
#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. */ #ifdef MOUNTED_GETMNT /* Ultrix. */
{ {