* 8/17/2007
*
* This file is part of the HandBrake source code.
- * Homepage: <http://handbrake.m0k.org/>.
+ * Homepage: <http://handbrake.fr/>.
* It may be used under the terms of the GNU General Public License.
*/
- (NSString *)bsdNameForPath
{
OSStatus err;
- FSRef ref;
- err = FSPathMakeRef( (const UInt8 *) [path fileSystemRepresentation],
+ FSRef ref;
+ err = FSPathMakeRef( (const UInt8 *) [path fileSystemRepresentation],
&ref, NULL );
- if( err != noErr )
+ if( err != noErr )
{
return nil;
}
}
FSVolumeRefNum volRefNum = catalogInfo.volume;
- // Mow let's get the device name
- GetVolParmsInfoBuffer volumeParms;
- HParamBlockRec pb;
- pb.ioParam.ioNamePtr = NULL;
- pb.ioParam.ioVRefNum = volRefNum;
- pb.ioParam.ioBuffer = (Ptr) &volumeParms;
- pb.ioParam.ioReqCount = sizeof( volumeParms );
- err = PBHGetVolParmsSync( &pb );
+ // Now let's get the device name
+ GetVolParmsInfoBuffer volumeParms;
+ err = FSGetVolumeParms ( volRefNum, &volumeParms, sizeof( volumeParms ) );
+
if( err != noErr )
{
return nil;
}
- // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field.
- // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h.
- return [NSString stringWithCString:(char *)volumeParms.vMDeviceID];
+ // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field.
+ // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h.
+ if( volumeParms.vMVersion < 4 )
+ {
+ return nil;
+ }
+
+ // vMDeviceID might be zero as is reported with experimental ZFS (zfs-119) support in Leopard.
+ if( !volumeParms.vMDeviceID )
+ {
+ return nil;
+ }
+
+ return [NSString stringWithUTF8String:(const char *)volumeParms.vMDeviceID];
}
- (io_service_t)getIOKitServiceForBSDName
{
CFMutableDictionaryRef matchingDict;
- matchingDict = IOBSDNameMatching( kIOMasterPortDefault, 0, [bsdName cString] );
+ matchingDict = IOBSDNameMatching( kIOMasterPortDefault, 0, [bsdName UTF8String] );
if( matchingDict == NULL )
{
return IO_OBJECT_NULL;