CFStringRef tmp_cf_string_ref;
kern_return_t status;
- signed long long read_ops;
- signed long long read_byt;
- signed long long read_tme;
- signed long long write_ops;
- signed long long write_byt;
- signed long long write_tme;
-
- int disk_major;
- int disk_minor;
+ signed long long read_ops, read_byt, read_tme;
+ signed long long write_ops, write_byt, write_tme;
+
+ int disk_major, disk_minor;
char disk_name[DATA_MAX_NAME_LEN];
char child_disk_name_bsd[DATA_MAX_NAME_LEN], props_disk_name_bsd[DATA_MAX_NAME_LEN];
/* Get the list of all disk objects. */
- if (IOServiceGetMatchingServices (io_master_port,
- IOServiceMatching (kIOBlockStorageDriverClass),
- &disk_list) != kIOReturnSuccess)
- {
+ if (IOServiceGetMatchingServices (io_master_port, IOServiceMatching (kIOBlockStorageDriverClass), &disk_list) != kIOReturnSuccess) {
ERROR ("disk plugin: IOServiceGetMatchingServices failed.");
return (-1);
}
- while ((disk = IOIteratorNext (disk_list)) != 0)
- {
+ while ((disk = IOIteratorNext (disk_list)) != 0) {
props_dict = NULL;
stats_dict = NULL;
child_dict = NULL;
/* get child of disk entry and corresponding property dictionary */
- if ((status = IORegistryEntryGetChildEntry (disk, kIOServicePlane, &disk_child))
- != kIOReturnSuccess)
- {
+ if ((status = IORegistryEntryGetChildEntry (disk, kIOServicePlane, &disk_child)) != kIOReturnSuccess) {
/* This fails for example for DVD/CD drives, which we want to ignore anyway */
DEBUG ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
IOObjectRelease (disk);
continue;
}
- if ((IORegistryEntryCreateCFProperties (disk_child, &child_dict, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
- || (child_dict == NULL)) {
+ if (IORegistryEntryCreateCFProperties (disk_child, (CFMutableDictionaryRef *) &child_dict, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess || child_dict == NULL) {
ERROR ("disk plugin: IORegistryEntryCreateCFProperties (disk_child) failed.");
IOObjectRelease (disk_child);
IOObjectRelease (disk);
/* extract name and major/minor numbers */
memset (child_disk_name_bsd, 0, sizeof (child_disk_name_bsd));
- /* tmp_cf_string_ref doesn't need to be released. */
- tmp_cf_string_ref = (CFStringRef) CFDictionaryGetValue (child_dict,
- CFSTR(kIOBSDNameKey));
- if (tmp_cf_string_ref)
- {
+ tmp_cf_string_ref = (CFStringRef) CFDictionaryGetValue (child_dict, CFSTR(kIOBSDNameKey));
+ if (tmp_cf_string_ref) {
assert (CFGetTypeID (tmp_cf_string_ref) == CFStringGetTypeID ());
CFStringGetCString (tmp_cf_string_ref, child_disk_name_bsd, sizeof (child_disk_name_bsd), kCFStringEncodingUTF8);
}
IOObjectRelease (disk_child);
/* get property dictionary of the disk entry itself */
- if ((IORegistryEntryCreateCFProperties (disk, &props_dict, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
- || (props_dict == NULL)) {
+ if (IORegistryEntryCreateCFProperties (disk, (CFMutableDictionaryRef *) &props_dict, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess || props_dict == NULL) {
ERROR ("disk-plugin: IORegistryEntryCreateCFProperties failed.");
IOObjectRelease (disk);
continue;
assert (CFGetTypeID (tmp_cf_string_ref) == CFStringGetTypeID ());
CFStringGetCString (tmp_cf_string_ref, props_disk_name_bsd, sizeof (props_disk_name_bsd), kCFStringEncodingUTF8);
}
- stats_dict = (CFDictionaryRef) CFDictionaryGetValue (props_dict,
- CFSTR (kIOBlockStorageDriverStatisticsKey));
- if (stats_dict == NULL)
- {
+ stats_dict = (CFDictionaryRef) CFDictionaryGetValue (props_dict, CFSTR (kIOBlockStorageDriverStatisticsKey));
+ if (stats_dict == NULL) {
ERROR ("disk plugin: CFDictionaryGetValue (%s) failed.", kIOBlockStorageDriverStatisticsKey);
CFRelease (props_dict);
IOObjectRelease (disk);
if ((read_ops != -1LL) || (write_ops != -1LL))
disk_submit (disk_name, "disk_ops", read_ops, write_ops);
if ((read_tme != -1LL) || (write_tme != -1LL))
- disk_submit (disk_name, "disk_time",
- read_tme / 1000,
- write_tme / 1000);
+ disk_submit (disk_name, "disk_time", read_tme / 1000, write_tme / 1000);
}
IOObjectRelease (disk_list);