| index 1493b81..18829ec 100644 | | index 1493b81..18829ec 100644 |
| --- a/src/plugin_disks.c | | --- a/src/plugin_disks.c |
| +++ b/src/plugin_disks.c | | +++ b/src/plugin_disks.c |
| @@ -263,7 +263,7 @@ typedef struct { | | @@ -263,7 +263,7 @@ typedef struct { |
| 263 | unsigned long long inodes_total; | 263 | unsigned long long inodes_total; |
| 264 | unsigned long long inodes_used; | 264 | unsigned long long inodes_used; |
| 265 | int has_inodes; | 265 | int has_inodes; |
| 266 | -} mount_t; | 266 | +} sx_mount_t; |
| 267 | | 267 | |
| 268 | #if !defined(_WIN32) | 268 | #if !defined(_WIN32) |
| 269 | | 269 | |
| @@ -302,7 +302,7 @@ static int pseudo_mountpoint(const char *mp) | | @@ -302,7 +302,7 @@ static int pseudo_mountpoint(const char *mp) |
| 302 | | 302 | |
| 303 | #endif /* !_WIN32 */ | 303 | #endif /* !_WIN32 */ |
| 304 | | 304 | |
| 305 | -#if !defined(_WIN32) | 305 | +#if !defined(_WIN32) && !defined(__APPLE__) |
| 306 | | 306 | |
| 307 | /* /proc/mounts and /etc/mtab escape space, tab, newline and backslash as octal. */ | 307 | /* /proc/mounts and /etc/mtab escape space, tab, newline and backslash as octal. */ |
| 308 | static void unescape_mount_field(char *s) | 308 | static void unescape_mount_field(char *s) |
| @@ -320,7 +320,7 @@ static void unescape_mount_field(char *s) | | @@ -320,7 +320,7 @@ static void unescape_mount_field(char *s) |
| 320 | *o = '\0'; | 320 | *o = '\0'; |
| 321 | } | 321 | } |
| 322 | | 322 | |
| 323 | -static void fill_vfs(const char *mp, mount_t *m) | 323 | +static void fill_vfs(const char *mp, sx_mount_t *m) |
| 324 | { | 324 | { |
| 325 | struct statvfs vfs; | 325 | struct statvfs vfs; |
| 326 | if (statvfs(mp, &vfs) != 0) return; | 326 | if (statvfs(mp, &vfs) != 0) return; |
| @@ -340,7 +340,7 @@ static void fill_vfs(const char *mp, mount_t *m) | | @@ -340,7 +340,7 @@ static void fill_vfs(const char *mp, mount_t *m) |
| 340 | | 340 | |
| 341 | #if defined(__APPLE__) | 341 | #if defined(__APPLE__) |
| 342 | | 342 | |
| 343 | -static int collect_mounts(mount_t *out, int max) | 343 | +static int collect_mounts(sx_mount_t *out, int max) |
| 344 | { | 344 | { |
| 345 | struct statfs *mnt = NULL; | 345 | struct statfs *mnt = NULL; |
| 346 | int n, i, count = 0; | 346 | int n, i, count = 0; |
| @@ -349,7 +349,7 @@ static int collect_mounts(mount_t *out, int max) | | @@ -349,7 +349,7 @@ static int collect_mounts(mount_t *out, int max) |
| 349 | if (n <= 0) return 0; | 349 | if (n <= 0) return 0; |
| 350 | | 350 | |
| 351 | for (i = 0; i < n && count < max; i++) { | 351 | for (i = 0; i < n && count < max; i++) { |
| 352 | - mount_t *m = &out[count]; | 352 | + sx_mount_t *m = &out[count]; |
| 353 | unsigned long long bs = (unsigned long long)mnt[i].f_bsize; | 353 | unsigned long long bs = (unsigned long long)mnt[i].f_bsize; |
| 354 | if (pseudo_fstype(mnt[i].f_fstypename)) continue; | 354 | if (pseudo_fstype(mnt[i].f_fstypename)) continue; |
| 355 | if (pseudo_mountpoint(mnt[i].f_mntonname)) continue; | 355 | if (pseudo_mountpoint(mnt[i].f_mntonname)) continue; |
| @@ -374,7 +374,7 @@ static int collect_mounts(mount_t *out, int max) | | @@ -374,7 +374,7 @@ static int collect_mounts(mount_t *out, int max) |
| 374 | | 374 | |
| 375 | #elif defined(_WIN32) | 375 | #elif defined(_WIN32) |
| 376 | | 376 | |
| 377 | -static int collect_mounts(mount_t *out, int max) | 377 | +static int collect_mounts(sx_mount_t *out, int max) |
| 378 | { | 378 | { |
| 379 | char drives[512]; | 379 | char drives[512]; |
| 380 | DWORD n; | 380 | DWORD n; |
| @@ -387,7 +387,7 @@ static int collect_mounts(mount_t *out, int max) | | @@ -387,7 +387,7 @@ static int collect_mounts(mount_t *out, int max) |
| 387 | for (p = drives; *p && count < max; p += strlen(p) + 1) { | 387 | for (p = drives; *p && count < max; p += strlen(p) + 1) { |
| 388 | ULARGE_INTEGER avail, total, totalfree; | 388 | ULARGE_INTEGER avail, total, totalfree; |
| 389 | char fsname[64] = "unknown"; | 389 | char fsname[64] = "unknown"; |
| 390 | - mount_t *m; | 390 | + sx_mount_t *m; |
| 391 | | 391 | |
| 392 | if (GetDriveTypeA(p) == DRIVE_NO_ROOT_DIR) continue; | 392 | if (GetDriveTypeA(p) == DRIVE_NO_ROOT_DIR) continue; |
| 393 | if (!GetDiskFreeSpaceExA(p, &avail, &total, &totalfree)) continue; | 393 | if (!GetDiskFreeSpaceExA(p, &avail, &total, &totalfree)) continue; |
| @@ -412,7 +412,7 @@ static int collect_mounts(mount_t *out, int max) | | @@ -412,7 +412,7 @@ static int collect_mounts(mount_t *out, int max) |
| 412 | | 412 | |
| 413 | #else /* Linux and other POSIX */ | 413 | #else /* Linux and other POSIX */ |
| 414 | | 414 | |
| 415 | -static int collect_mounts(mount_t *out, int max) | 415 | +static int collect_mounts(sx_mount_t *out, int max) |
| 416 | { | 416 | { |
| 417 | FILE *fp; | 417 | FILE *fp; |
| 418 | char line[2048]; | 418 | char line[2048]; |
| @@ -474,8 +474,8 @@ static int collect_mounts(mount_t *out, int max) | | @@ -474,8 +474,8 @@ static int collect_mounts(mount_t *out, int max) |
| 474 | /* Largest first. Used for display order. */ | 474 | /* Largest first. Used for display order. */ |
| 475 | static int mount_cmp(const void *a, const void *b) | 475 | static int mount_cmp(const void *a, const void *b) |
| 476 | { | 476 | { |
| 477 | - const mount_t *x = (const mount_t *)a; | 477 | + const sx_mount_t *x = (const sx_mount_t *)a; |
| 478 | - const mount_t *y = (const mount_t *)b; | 478 | + const sx_mount_t *y = (const sx_mount_t *)b; |
| 479 | if (x->total_bytes < y->total_bytes) return 1; | 479 | if (x->total_bytes < y->total_bytes) return 1; |
| 480 | if (x->total_bytes > y->total_bytes) return -1; | 480 | if (x->total_bytes > y->total_bytes) return -1; |
| 481 | return strcmp(x->mount, y->mount); | 481 | return strcmp(x->mount, y->mount); |
| @@ -719,7 +719,7 @@ static void json_header(void) | | @@ -719,7 +719,7 @@ static void json_header(void) |
| 719 | | 719 | |
| 720 | static void emit_mounts(void) | 720 | static void emit_mounts(void) |
| 721 | { | 721 | { |
| 722 | - mount_t mnt[MAX_MOUNTS]; | 722 | + sx_mount_t mnt[MAX_MOUNTS]; |
| 723 | int i, n; | 723 | int i, n; |
| 724 | | 724 | |
| 725 | memset(mnt, 0, sizeof(mnt)); | 725 | memset(mnt, 0, sizeof(mnt)); |
| @@ -728,7 +728,7 @@ static void emit_mounts(void) | | @@ -728,7 +728,7 @@ static void emit_mounts(void) |
| 728 | | 728 | |
| 729 | fputs("[", stdout); | 729 | fputs("[", stdout); |
| 730 | for (i = 0; i < n; i++) { | 730 | for (i = 0; i < n; i++) { |
| 731 | - const mount_t *m = &mnt[i]; | 731 | + const sx_mount_t *m = &mnt[i]; |
| 732 | double pct = 0.0, ipct = 0.0; | 732 | double pct = 0.0, ipct = 0.0; |
| 733 | if (m->used_bytes + m->avail_bytes > 0) | 733 | if (m->used_bytes + m->avail_bytes > 0) |
| 734 | pct = (double)m->used_bytes * 100.0 / (double)(m->used_bytes + m->avail_bytes); | 734 | pct = (double)m->used_bytes * 100.0 / (double)(m->used_bytes + m->avail_bytes); |
| @@ -899,7 +899,7 @@ static int mode_json(const char *qs) | | @@ -899,7 +899,7 @@ static int mode_json(const char *qs) |
| 899 | | 899 | |
| 900 | /* action == mounts */ | 900 | /* action == mounts */ |
| 901 | { | 901 | { |
| 902 | - mount_t probe[MAX_MOUNTS]; | 902 | + sx_mount_t probe[MAX_MOUNTS]; |
| 903 | int n; | 903 | int n; |
| 904 | memset(probe, 0, sizeof(probe)); | 904 | memset(probe, 0, sizeof(probe)); |
| 905 | n = collect_mounts(probe, MAX_MOUNTS); | 905 | n = collect_mounts(probe, MAX_MOUNTS); |
| 906 | | 906 | |