filename | src/drivers/osx_iokit.c |
changeset | 736:a02d1475ccfd |
prev | 729:4cc913eabd3d |
next | 758:99ae000d4e09 |
author | nkeynes |
date | Mon Jul 14 07:44:42 2008 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Re-indent everything consistently Fix include guards for consistency as well |
file | annotate | diff | log | raw |
1.1 --- a/src/drivers/osx_iokit.c Sun Jul 06 05:35:13 2008 +00001.2 +++ b/src/drivers/osx_iokit.c Mon Jul 14 07:44:42 2008 +00001.3 @@ -52,7 +52,7 @@1.4 * we're interested in is service termination.1.5 */1.6 static void osx_cdrom_media_notify( void *ref, io_service_t service, uint32_t msgType,1.7 - void *msgArgument )1.8 + void *msgArgument )1.9 {1.10 if( msgType == kIOMessageServiceIsTerminated ) {1.11 osx_cdrom_drive_t drive = (osx_cdrom_drive_t)ref;1.12 @@ -79,13 +79,13 @@1.13 static void osx_cdrom_media_inserted( void *ref, io_iterator_t iterator )1.14 {1.15 osx_cdrom_drive_t drive = (osx_cdrom_drive_t)ref;1.16 -1.17 +1.18 io_object_t object;1.19 while( (object = IOIteratorNext(iterator)) != 0 ) {1.20 io_string_t iopath = "";1.21 IORegistryEntryGetPath( object, kIOServicePlane, iopath );1.22 if( drive != NULL && g_str_has_prefix(iopath, drive->ioservice_path ) &&1.23 - get_bsdname_for_iomedia(object, drive->media_path, sizeof(drive->media_path)) ) {1.24 + get_bsdname_for_iomedia(object, drive->media_path, sizeof(drive->media_path)) ) {1.25 // A disc was inserted within the drive of interest1.26 if( drive->media_fh != -1 ) {1.27 close(drive->media_fh);1.28 @@ -98,7 +98,7 @@1.29 // Add a notification listener to get removal events.1.30 IOServiceAddInterestNotification( notify_port, object, kIOGeneralInterest,1.31 osx_cdrom_media_notify, drive, &drive->media_unload_iterator );1.32 -1.33 +1.34 }1.35 IOObjectRelease( object );1.36 }1.37 @@ -106,11 +106,11 @@1.39 static void osx_drives_changed( void *ref, io_iterator_t iterator )1.40 {1.41 - io_object_t object;1.42 - while( (object = IOIteratorNext(iterator)) != 0 ) {1.43 - IOObjectRelease(object);1.44 - }1.45 -1.46 + io_object_t object;1.47 + while( (object = IOIteratorNext(iterator)) != 0 ) {1.48 + IOObjectRelease(object);1.49 + }1.50 +1.51 }1.53 /******************** Support functions *********************/1.54 @@ -123,13 +123,13 @@1.55 {1.56 gboolean result = FALSE;1.57 CFTypeRef pathRef = IORegistryEntryCreateCFProperty(iomedia, CFSTR(kIOBSDNameKey),1.58 - kCFAllocatorDefault, 0 );1.59 + kCFAllocatorDefault, 0 );1.60 if( pathRef ) {1.61 char pathlen;1.62 strcpy( buf, _PATH_DEV "r" );1.63 pathlen = strlen(buf);1.64 if( CFStringGetCString( pathRef, buf + pathlen, buflen-pathlen,1.65 - kCFStringEncodingASCII ) != noErr ) {1.66 + kCFStringEncodingASCII ) != noErr ) {1.67 result = TRUE;1.68 }1.69 CFRelease(pathRef);1.70 @@ -138,7 +138,7 @@1.71 }1.73 static gboolean osx_cdrom_drive_get_name( io_object_t object, char *vendor, int vendor_len,1.74 - char *product, int product_len )1.75 + char *product, int product_len )1.76 {1.77 gboolean result = FALSE;1.78 CFMutableDictionaryRef props = 0;1.79 @@ -152,7 +152,7 @@1.80 } else {1.81 vendor[0] = 0;1.82 }1.83 -1.84 +1.85 value = CFDictionaryGetValue(dict, CFSTR(kIOPropertyProductNameKey));1.86 if ( value && CFGetTypeID(value) == CFStringGetTypeID() ) {1.87 CFStringGetCString( (CFStringRef)value, product, product_len, kCFStringEncodingUTF8 );1.88 @@ -174,7 +174,7 @@1.89 static osx_cdrom_drive_t osx_cdrom_drive_new( io_object_t device )1.90 {1.91 osx_cdrom_drive_t drive = g_malloc0(sizeof(struct osx_cdrom_drive));1.92 -1.93 +1.94 IORegistryEntryGetPath( device, kIOServicePlane, drive->ioservice_path );1.95 osx_cdrom_drive_get_name( device, drive->vendor_name, sizeof(drive->vendor_name),1.96 drive->product_name, sizeof(drive->product_name) );1.97 @@ -199,7 +199,7 @@1.98 if( object == MACH_PORT_NULL ) {1.99 return NULL;1.100 }1.101 -1.102 +1.103 osx_cdrom_drive_t drive = osx_cdrom_drive_new( object );1.104 IOObjectRelease( object );1.105 return drive;1.106 @@ -258,7 +258,7 @@1.107 }1.108 IOObjectRelease(iterator);1.109 }1.110 -1.111 +1.113 /**1.114 * Search for a CD or DVD drive (instance of IODVDServices or IOCompactDiscServices).1.115 @@ -276,21 +276,21 @@1.116 CFMutableDictionaryRef match;1.117 io_iterator_t services;1.118 io_object_t result;1.119 -1.120 +1.121 if( IOMasterPort( MACH_PORT_NULL, &master_port ) != KERN_SUCCESS ) {1.122 return 0; // Failed to get the master port?1.123 }1.124 -1.125 +1.126 match = IOServiceMatching("IODVDServices");1.127 if( IOServiceGetMatchingServices(master_port, match, &services) != kIOReturnSuccess ) {1.128 return 0;1.129 }1.130 -1.131 +1.132 result = iterator_find_cdrom( services, callback, user_data );1.133 if( result != 0 ) {1.134 return result;1.135 }1.136 -1.137 +1.138 match = IOServiceMatching("IOCompactDiscServices");1.139 if( IOServiceGetMatchingServices(master_port, match, &services) != kIOReturnSuccess ) {1.140 return 0;1.141 @@ -330,7 +330,7 @@1.142 ERROR( "IOServiceAddMatchingNotification failed" );1.143 }1.144 osx_drives_changed(NULL, iokit_iterators[1]);1.145 -1.146 +1.147 if( IOServiceAddMatchingNotification( notify_port, kIOFirstPublishNotification,1.148 IOServiceMatching(kIOHIDDeviceKey),1.149 osx_hid_inserted, NULL, &iokit_iterators[4] ) != kIOReturnSuccess ) {
.