|
|
@ -18,17 +18,15 @@ static int fillstat(io_registry_entry_t d, DriveStats *stat);
|
|
|
|
int
|
|
|
|
int
|
|
|
|
gopsutil_v3_readdrivestat(DriveStats a[], int n)
|
|
|
|
gopsutil_v3_readdrivestat(DriveStats a[], int n)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mach_port_t port;
|
|
|
|
|
|
|
|
CFMutableDictionaryRef match;
|
|
|
|
CFMutableDictionaryRef match;
|
|
|
|
io_iterator_t drives;
|
|
|
|
io_iterator_t drives;
|
|
|
|
io_registry_entry_t d;
|
|
|
|
io_registry_entry_t d;
|
|
|
|
kern_return_t status;
|
|
|
|
kern_return_t status;
|
|
|
|
int na, rv;
|
|
|
|
int na, rv;
|
|
|
|
|
|
|
|
|
|
|
|
IOMainPort(bootstrap_port, &port);
|
|
|
|
|
|
|
|
match = IOServiceMatching("IOMedia");
|
|
|
|
match = IOServiceMatching("IOMedia");
|
|
|
|
CFDictionaryAddValue(match, CFSTR(kIOMediaWholeKey), kCFBooleanTrue);
|
|
|
|
CFDictionaryAddValue(match, CFSTR(kIOMediaWholeKey), kCFBooleanTrue);
|
|
|
|
status = IOServiceGetMatchingServices(port, match, &drives);
|
|
|
|
status = IOServiceGetMatchingServices(0, match, &drives);
|
|
|
|
if(status != KERN_SUCCESS)
|
|
|
|
if(status != KERN_SUCCESS)
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|