* is_dvd_service * * Returns whether or not the service passed in is a DVD. * * Searches for an IOMedia object that represents the entire (whole) media that * the volume is on. If the volume is on partitioned media, the whole media * object will be a parent of the volume's media object. If the media is not * partitioned, the volume's media object will be the whole media object. ***********
| 5766 | * partitioned, the volume's media object will be the whole media object. |
| 5767 | ****************************************************************************/ |
| 5768 | static int is_dvd_service( io_service_t service ) |
| 5769 | { |
| 5770 | kern_return_t kernResult; |
| 5771 | io_iterator_t iter; |
| 5772 | |
| 5773 | // Create an iterator across all parents of the service object passed in. |
| 5774 | kernResult = IORegistryEntryCreateIterator( service, |
| 5775 | kIOServicePlane, |
| 5776 | kIORegistryIterateRecursively | kIORegistryIterateParents, |
| 5777 | &iter ); |
| 5778 | if( kernResult != KERN_SUCCESS ) |
| 5779 | { |
| 5780 | return 0; |
| 5781 | } |
| 5782 | if( iter == IO_OBJECT_NULL ) |
| 5783 | { |
| 5784 | return 0; |
| 5785 | } |
| 5786 | |
| 5787 | // A reference on the initial service object is released in the do-while |
| 5788 | // loop below, so add a reference to balance. |
| 5789 | IOObjectRetain( service ); |
| 5790 | |
| 5791 | int result = 0; |
| 5792 | do |
| 5793 | { |
| 5794 | if( is_whole_media_service( service ) && |
| 5795 | IOObjectConformsTo( service, kIODVDMediaClass) ) |
| 5796 | { |
| 5797 | result = 1; |
| 5798 | } |
| 5799 | IOObjectRelease( service ); |
| 5800 | } while( !result && (service = IOIteratorNext( iter )) ); |
| 5801 | IOObjectRelease( iter ); |
| 5802 | |
| 5803 | return result; |
| 5804 | } |
| 5805 | |
| 5806 | /**************************************************************************** |
| 5807 | * is_whole_media_service |
no test coverage detected