$NetBSD: patch-ab,v 1.9 2007/12/02 12:55:10 wiz Exp $ --- lib/mountlist.c.orig 2007-01-26 23:16:55.000000000 +0100 +++ lib/mountlist.c @@ -174,6 +174,11 @@ #if MOUNTED_GETMNTINFO +# if defined(__NetBSD__) && (__NetBSD_Version__ > 299000900) +# define statfs statvfs +# define HAVE_F_FSTYPENAME_IN_STATFS 1 +# endif + # if ! HAVE_STRUCT_STATFS_F_FSTYPENAME static char * fstype_to_string (short int t) @@ -296,6 +301,10 @@ fstype_to_string (int t) } #endif /* MOUNTED_VMOUNT */ +#ifdef __INTERIX +# include +# include +#endif #if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2 @@ -859,6 +868,50 @@ read_file_system_list (bool need_fs_type } #endif /* MOUNTED_VMOUNT. */ +#ifdef __INTERIX /* Interix. */ + { + DIR *devfs = opendir ("/dev/fs"); + struct dirent *de; + struct statvfs svfs; + char fsname[] = "/dev/fs/#"; /* writable */ + + if (devfs == NULL) + return NULL; + + while ((de = readdir (devfs)) != NULL) + { + if (strlen (de->d_name) != 1) + { + /* "Drive letters" should all be exactly one character long. */ + continue; + } + + fsname[8] = de->d_name[0]; + + if (statvfs (fsname, &svfs) != 0) + { + /* Could be an offline network fs or empty removable; don't fail. */ + continue; + } + + me = xmalloc (sizeof *me); + + me->me_devname = xstrdup (svfs.f_mntfromname); + me->me_mountdir = xstrdup (svfs.f_mntonname); + me->me_type = xstrdup (svfs.f_fstypename); + me->me_dev = (dev_t)svfs.f_fsid; + me->me_dummy = (svfs.f_type == ST_FSTYPE_OFS ? 1 : 0); + me->me_remote = ((svfs.f_type == ST_FSTYPE_SAMBA + || svfs.f_type == ST_FSTYPE_NFS) ? 1 : 0); + me->me_type_malloced = 1; + + /* Add to the linked list. */ + *mtail = me; + mtail = &me->me_next; + } + } +#endif + *mtail = NULL; return mount_list;