static IOReturn
PrintSpeedForBSDNode ( const char * bsdNode )
{
	
	IOReturn		error			= kIOReturnError;
	int 			fileDescriptor	= 0;
	UInt16			speed			= 0;
	char 			deviceName[MAXPATHLEN];
	
	if ( strncmp ( bsdNode, "/dev/rdisk", 10 ) == 0 )
	{
		 sprintf ( deviceName, "%s", bsdNode );
	}
	
	else if ( strncmp ( bsdNode, "/dev/disk", 9 ) == 0 )
	{
		sprintf ( deviceName, "%s", bsdNode );
	}
	
	else if ( strncmp ( bsdNode, "disk", 4 ) == 0 )
	{
		sprintf ( deviceName, "%s%s", "/dev/", bsdNode );
	}
	
	else
	{
		goto ErrorExit;
	}
	
	fileDescriptor = OpenMedia ( deviceName );
	require ( ( fileDescriptor > 0 ), ErrorExit );
	
	speed = GetSpeed ( fileDescriptor );
	printf ( "%s: speed = %d KB/s\n", deviceName, speed );
	
	CloseMedia ( fileDescriptor );
	
	
ErrorExit:
	
	
	return error;
	
}
예제 #2
0
Waveform::~Waveform()
{
    CloseMedia();
}