summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3fd064e)
raw | patch | inline | side by side (parent: 3fd064e)
author | octo <octo> | |
Sun, 16 Apr 2006 00:25:42 +0000 (00:25 +0000) | ||
committer | octo <octo> | |
Sun, 16 Apr 2006 00:25:42 +0000 (00:25 +0000) |
src/disk.c | patch | blob | history |
diff --git a/src/disk.c b/src/disk.c
index c4f919ab862dc436a525d6e56f6385317f0ac062..beee7fa690f29956cf7ab97720863427d4d0bf60 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
key_obj = CFStringCreateWithCString (kCFAllocatorDefault, key,
kCFStringEncodingASCII);
if (key_obj == NULL)
+ {
+ DBG ("CFStringCreateWithCString (%s) failed.", key);
return (-1LL);
+ }
/* get => we don't need to release (== free) the object */
val_obj = (CFNumberRef) CFDictionaryGetValue (dict, key_obj);
@@ -267,11 +270,16 @@ static signed long long dict_get_value (CFDictionaryRef dict, const char *key)
CFRelease (key_obj);
if (val_obj == NULL)
+ {
+ DBG ("CFDictionaryGetValue (%s) failed.", key);
return (-1LL);
+ }
- if (CFNumberGetValue (val_obj, kCFNumberSInt64Type, &val_int)
- != kIOReturnSuccess)
+ if (!CFNumberGetValue (val_obj, kCFNumberSInt64Type, &val_int))
+ {
+ DBG ("CFNumberGetValue (%s) failed.", key);
return (-1LL);
+ }
return (val_int);
}
CFDictionaryRef props_dict;
CFDictionaryRef stats_dict;
CFDictionaryRef child_dict;
+ kern_return_t status;
signed long long read_ops;
signed long long read_byt;
stats_dict = NULL;
child_dict = NULL;
+ /* `disk_child' must be released */
+ if ((status = IORegistryEntryGetChildEntry (disk, kIOServicePlane, &disk_child))
+ != kIOReturnSuccess)
+ {
+ /* This fails for example for DVD/CD drives.. */
+ DBG ("IORegistryEntryGetChildEntry (disk) failed: 0x%08x", status);
+ IOObjectRelease (disk);
+ continue;
+ }
+
/* We create `props_dict' => we need to release it later */
if (IORegistryEntryCreateCFProperties (disk,
(CFMutableDictionaryRef *) &props_dict,
!= kIOReturnSuccess)
{
syslog (LOG_ERR, "disk-plugin: IORegistryEntryCreateCFProperties failed.");
+ IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
}
if (props_dict == NULL)
{
DBG ("IORegistryEntryCreateCFProperties (disk) failed.");
+ IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
}
DBG ("CFDictionaryGetValue (%s) failed.",
kIOBlockStorageDriverStatisticsKey);
CFRelease (props_dict);
- IOObjectRelease (disk);
- continue;
- }
-
- /* `disk_child' must be released */
- if (IORegistryEntryGetChildEntry (disk, kIOServicePlane, &disk_child)
- != kIOReturnSuccess)
- {
- DBG ("IORegistryEntryGetChildEntry (disk) failed.");
- CFRelease (props_dict);
+ IOObjectRelease (disk_child);
IOObjectRelease (disk);
continue;
}
IOObjectRelease (disk);
continue;
}
+ DBG ("disk_name = %s", disk_name);
if ((read_ops != -1LL)
|| (read_byt != -1LL)