@@ -1058,6 +1058,60 @@ namespace lsp
10581058 }
10591059 #endif /* PLATFORM_BSD */
10601060
1061+ #ifdef PLATFORM_MACOSX
1062+ static status_t read_macos_mntinfo (lltl::parray<volume_info_t > *volumes)
1063+ {
1064+ struct statfs *fsp = NULL ;
1065+ lltl::parray<volume_info_t > list;
1066+ lsp_finally { free_volume_info (&list); };
1067+
1068+ // Get mount information
1069+ int entries = getmntinfo_r_np (&fsp, MNT_NOWAIT);
1070+ lsp_finally {
1071+ if (fsp != NULL )
1072+ free (fsp);
1073+ };
1074+ if (entries < 0 )
1075+ return STATUS_NOT_SUPPORTED;
1076+
1077+ for (int i=0 ; i < entries; ++fsp, ++i)
1078+ {
1079+ // Create record
1080+ volume_info_t *info = new volume_info_t ();
1081+ if (info == NULL )
1082+ return STATUS_NO_MEM;
1083+ else if (!list.add (info))
1084+ {
1085+ delete info;
1086+ return STATUS_NO_MEM;
1087+ }
1088+
1089+ // Fill fields
1090+ if (!info->device .set_utf8 (fsp->f_mntfromname ))
1091+ return STATUS_NO_MEM;
1092+ if (!info->target .set_utf8 (fsp->f_mntonname ))
1093+ return STATUS_NO_MEM;
1094+ if (!info->root .set_ascii (" /" ))
1095+ return STATUS_NO_MEM;
1096+ if (!info->name .set_utf8 (fsp->f_fstypename ))
1097+ return STATUS_NO_MEM;
1098+
1099+ // Produce final record
1100+ info->flags = 0 ;
1101+ if (is_dummy_fs (&info->name , false ))
1102+ info->flags |= VF_DUMMY;
1103+ if (is_remote_fs (&info->device , &info->name ))
1104+ info->flags |= VF_REMOTE;
1105+ if (is_posix_drive (&info->device ))
1106+ info->flags |= VF_DRIVE;
1107+ }
1108+
1109+ // Commit and return
1110+ list.swap (volumes);
1111+ return STATUS_OK;
1112+ }
1113+ #endif /* PLATFORM_MACOSX */
1114+
10611115 #ifdef PLATFORM_WINDOWS
10621116 status_t read_pathnames (const WCHAR *volume, WCHAR **list, size_t *cap)
10631117 {
@@ -1326,7 +1380,7 @@ namespace lsp
13261380 return STATUS_BAD_ARGUMENTS;
13271381
13281382 status_t res = STATUS_NOT_IMPLEMENTED;
1329- #ifdef PLATFORM_LINUX
1383+ #if defined( PLATFORM_LINUX)
13301384 if ((res = read_linux_mountinfo (volumes)) != STATUS_NOT_SUPPORTED)
13311385 return res;
13321386 if ((res = read_linux_mntent (" /proc/self/mounts" , volumes)) != STATUS_NOT_SUPPORTED)
@@ -1335,16 +1389,17 @@ namespace lsp
13351389 return res;
13361390 if ((res = read_linux_mntent (" /etc/mtab" , volumes)) != STATUS_NOT_SUPPORTED)
13371391 return res;
1338- #endif /* PLATFORM_LINUX */
1339- #ifdef PLATFORM_BSD
1392+ #elif defined(PLATFORM_BSD)
13401393 if ((res = read_bsd_mntinfo (volumes)) != STATUS_NOT_SUPPORTED)
13411394 return res;
1342- #endif /* PLATFORM_BSD */
1343- #ifdef PLATFORM_WINDOWS
1395+ #elif defined(PLATFORM_MACOS)
1396+ if ((res = read_macos_mntinfo (volumes)) != STATUS_NOT_SUPPORTED)
1397+ return res;
1398+ #elif defined(PLATFORM_WINDOWS)
13441399 res = read_windows_mntinfo (volumes);
13451400 if (res == STATUS_OK)
13461401 res = read_windows_netinfo (volumes);
1347- #endif /* PLATFORM_WINDOWS */
1402+ #endif
13481403
13491404 return res;
13501405 }
0 commit comments