253 |
|
|
254 |
|
} |
255 |
|
|
256 |
+ |
int sg_fs_compare_device_name(const void *va, const void *vb) { |
257 |
+ |
const sg_fs_stats *a = (const sg_fs_stats *)va; |
258 |
+ |
const sg_fs_stats *b = (const sg_fs_stats *)vb; |
259 |
+ |
|
260 |
+ |
return strcmp(a->device_name, b->device_name); |
261 |
+ |
} |
262 |
+ |
|
263 |
+ |
int sg_fs_compare_mnt_point(const void *va, const void *vb) { |
264 |
+ |
const sg_fs_stats *a = (const sg_fs_stats *)va; |
265 |
+ |
const sg_fs_stats *b = (const sg_fs_stats *)vb; |
266 |
+ |
|
267 |
+ |
return strcmp(a->mnt_point, b->mnt_point); |
268 |
+ |
} |
269 |
+ |
|
270 |
|
static void diskio_stat_init(sg_disk_io_stats *d) { |
271 |
|
d->disk_name = NULL; |
272 |
|
} |
344 |
|
|
345 |
|
size = sizeof(diskcount); |
346 |
|
if (sysctl(mib, MIBSIZE, &diskcount, &size, NULL, 0) < 0) { |
347 |
< |
sg_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKCOUNT"); |
347 |
> |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKCOUNT"); |
348 |
|
return NULL; |
349 |
|
} |
350 |
|
|
352 |
|
mib[1] = HW_DISKNAMES; |
353 |
|
|
354 |
|
if (sysctl(mib, MIBSIZE, NULL, &size, NULL, 0) < 0) { |
355 |
< |
sg_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
355 |
> |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
356 |
|
return NULL; |
357 |
|
} |
358 |
|
|
362 |
|
} |
363 |
|
|
364 |
|
if (sysctl(mib, MIBSIZE, disknames, &size, NULL, 0) < 0) { |
365 |
< |
sg_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
365 |
> |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKNAMES"); |
366 |
|
return NULL; |
367 |
|
} |
368 |
|
|
381 |
|
#endif |
382 |
|
|
383 |
|
if (sysctl(mib, MIBSIZE, NULL, &size, NULL, 0) < 0) { |
384 |
< |
sg_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
384 |
> |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
385 |
|
return NULL; |
386 |
|
} |
387 |
|
|
397 |
|
} |
398 |
|
|
399 |
|
if (sysctl(mib, MIBSIZE, stats, &size, NULL, 0) < 0) { |
400 |
< |
sg_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
400 |
> |
sg_set_error(SG_ERROR_SYSCTL, "CTL_HW.HW_DISKSTATS"); |
401 |
|
return NULL; |
402 |
|
} |
403 |
|
|
763 |
|
|
764 |
|
*entries = diff_count; |
765 |
|
return diff; |
766 |
+ |
} |
767 |
+ |
|
768 |
+ |
int sg_disk_io_compare_name(const void *va, const void *vb) { |
769 |
+ |
const sg_disk_io_stats *a = (const sg_disk_io_stats *)va; |
770 |
+ |
const sg_disk_io_stats *b = (const sg_disk_io_stats *)vb; |
771 |
+ |
|
772 |
+ |
return strcmp(a->disk_name, b->disk_name); |
773 |
|
} |
774 |
|
|