<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- dao/ScsiIf-osx.cc.orig	2009-02-22 21:47:01.000000000 +1100
+++ dao/ScsiIf-osx.cc	2010-12-09 12:11:48.000000000 +1100
@@ -18,7 +18,7 @@
 /* cdrdao specific includes and prototype */
 #include "ScsiIf.h"
 #include "trackdb/util.h"
-extern void message(int level, const char *fmt, ...);
+#include "log.h"
 #include "decodeSense.cc"
 
 /* Mac OS X specific includes */
@@ -120,7 +120,7 @@ int ScsiIf::init()
 		                          CFSTR(kIOPropertySCSITaskAuthoringDevice));
 		CFDictionarySetValue(dict, CFSTR(kIOPropertyMatchKey), sub);
 		IOServiceGetMatchingServices(kIOMasterPortDefault, dict, &amp;iterator);
-		if (!iterator) message(-2, "init: no iterator");
+		if (!iterator) log_message(-2, "init: no iterator");
 		if (iterator) {
 			i = impl_-&gt;num_;
 			do {
@@ -134,16 +134,16 @@ int ScsiIf::init()
 		impl_-&gt;object_ = IORegistryEntryFromPath(kIOMasterPortDefault, impl_-&gt;path_);
 	}
 	/* Strange if (!x) ... if (x) style so you can #ifdef out the !x part */
-	if (!impl_-&gt;object_) message(-2, "init: no object");
+	if (!impl_-&gt;object_) log_message(-2, "init: no object");
 	if (impl_-&gt;object_) {
 		/* Get intermediate (IOCFPlugIn) plug-in for MMC device */
 		err = IOCreatePlugInInterfaceForService(impl_-&gt;object_,
 		       kIOMMCDeviceUserClientTypeID, kIOCFPlugInInterfaceID,
 		       &amp;impl_-&gt;plugin_, &amp;score);
 		if (err  != noErr)
-			message(-2, "init: IOCreatePlugInInterfaceForService failed: %d", err);
+			log_message(-2, "init: IOCreatePlugInInterfaceForService failed: %d", err);
 	}
-	if (!impl_-&gt;plugin_) message(-2, "init: no plugin");
+	if (!impl_-&gt;plugin_) log_message(-2, "init: no plugin");
 	if (impl_-&gt;plugin_) {
 		/* Get the MMC interface (MMCDeviceInterface) */
 		herr = (*impl_-&gt;plugin_)-&gt;QueryInterface(impl_-&gt;plugin_,
@@ -154,29 +154,29 @@ int ScsiIf::init()
 			 */
 		        (LPVOID *)&amp;impl_-&gt;mmc_);
 		if (herr != S_OK)
-			message(-2, "init: QueryInterface failed: %d", herr);
+			log_message(-2, "init: QueryInterface failed: %d", herr);
 	}
-	if (!impl_-&gt;mmc_) message(-2, "init: no mmc");
+	if (!impl_-&gt;mmc_) log_message(-2, "init: no mmc");
 	if (impl_-&gt;mmc_) {
 		/* Get the SCSI interface */
 		impl_-&gt;scsi_ = (*impl_-&gt;mmc_)-&gt;GetSCSITaskDeviceInterface(impl_-&gt;mmc_);
 	}
-	if (!impl_-&gt;scsi_) message(-2, "init: no scsi");
+	if (!impl_-&gt;scsi_) log_message(-2, "init: no scsi");
 	if (impl_-&gt;scsi_) {
 		/* Obtain exclusive access to device */
 		err = (*impl_-&gt;scsi_)-&gt;ObtainExclusiveAccess(impl_-&gt;scsi_);
 		if (err != noErr)
-			message(-2, "init: ObtainExclusiveAccess failed: %d", err);
+			log_message(-2, "init: ObtainExclusiveAccess failed: %d", err);
 		if (err == noErr) {
 			impl_-&gt;exclusive_ = 1;
 			/* Send SCSI inquiry command */
 			i = inquiry();
 			if (i != 0)
-				message(-2, "init: inquiry failed: %d", i);
+				log_message(-2, "init: inquiry failed: %d", i);
 			return (i == 0) ? 0 : 2;
 		}
 	}
-	message(-2, "init: failed");
+	log_message(-2, "init: failed");
 	return 1;
 }
 
@@ -311,7 +311,7 @@ void ScsiIf::printError()
 		default:
 			s = "unknown response"; break;
 	}
-	if (s) message(-2, s);
+	if (s) log_message(-2, s);
 }
 
 /*
@@ -334,7 +334,7 @@ int inq(SCSITaskDeviceInterface **scsi,
 
 	task = (*scsi)-&gt;CreateSCSITask(scsi);
 	if (!task) {
-		message(-2, "inq: no task");
+		log_message(-2, "inq: no task");
 		return 1;
 	}
 	bzero(cdb, sizeof(cdb));
@@ -342,7 +342,7 @@ int inq(SCSITaskDeviceInterface **scsi,
 	cdb[4] = sizeof(inq_data);
 	ret = (*task)-&gt;SetCommandDescriptorBlock(task, cdb, kSCSICDBSize_6Byte);
 	if (ret != kIOReturnSuccess) {
-		message(-2, "inq: SetCommandDescriptorBlock failed: %d", ret);
+		log_message(-2, "inq: SetCommandDescriptorBlock failed: %d", ret);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
@@ -351,35 +351,35 @@ int inq(SCSITaskDeviceInterface **scsi,
 	ret = (*task)-&gt;SetScatterGatherEntries(task, &amp;range, 1,
 	      sizeof(inq_data), kSCSIDataTransfer_FromTargetToInitiator);
 	if (ret != kIOReturnSuccess) {
-		message(-2, "inq: SetScatterGatherEntries failed: %d", ret);
+		log_message(-2, "inq: SetScatterGatherEntries failed: %d", ret);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
 	ret = (*task)-&gt;SetTimeoutDuration(task, 1000);
 	if (ret != kIOReturnSuccess) {
-		message(-2, "inq: SetTimeoutDuration failed: %d", ret);
+		log_message(-2, "inq: SetTimeoutDuration failed: %d", ret);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
 	ret = (*task)-&gt;ExecuteTaskSync(task, sense, status, &amp;len);
 	if (ret != kIOReturnSuccess) {
-		message(-2, "inq: ExecuteTaskSync failed: %d", ret);
+		log_message(-2, "inq: ExecuteTaskSync failed: %d", ret);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
 	ret = (*task)-&gt;GetSCSIServiceResponse(task, response);
 	if (ret != kIOReturnSuccess) {
-		message(-2, "inq: GetSCSIServiceResponse failed: %d", ret);
+		log_message(-2, "inq: GetSCSIServiceResponse failed: %d", ret);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
 	if (*response != kSCSIServiceResponse_TASK_COMPLETE) {
-		message(-2, "inq: response=%d", *response);
+		log_message(-2, "inq: response=%d", *response);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
 	if (*status != kSCSITaskStatus_GOOD) {
-		message(-2, "inq: status=%d", *status);
+		log_message(-2, "inq: status=%d", *status);
 		(*task)-&gt;Release(task);
 		return 1;
 	}
@@ -437,7 +437,7 @@ ScsiIf::ScanData *ScsiIf::scan(int *len,
 	CFDictionarySetValue(dict, CFSTR(kIOPropertyMatchKey), sub);
 	IOServiceGetMatchingServices(kIOMasterPortDefault, dict, &amp;iterator);
 	if (!iterator) {
-		message(-2, "scan: no iterator");
+		log_message(-2, "scan: no iterator");
 		*len = 0;
 		return NULL;
 	}
@@ -456,32 +456,32 @@ ScsiIf::ScanData *ScsiIf::scan(int *len,
 		       kIOMMCDeviceUserClientTypeID, kIOCFPlugInInterfaceID,
 		       &amp;plugin, &amp;score);
 		if (err != noErr) {
-			message(-2, "scan: IOCreatePlugInInterfaceForService failed: %d", err);
+			log_message(-2, "scan: IOCreatePlugInInterfaceForService failed: %d", err);
 			goto clean;
 		}
 		if (!plugin) {
-			message(-2, "scan: no plugin");
+			log_message(-2, "scan: no plugin");
 			goto clean;
 		}
 		herr = (*plugin)-&gt;QueryInterface(plugin,
 		        CFUUIDGetUUIDBytes(kIOMMCDeviceInterfaceID),
 		        (LPVOID *)&amp;mmc);
 		if (herr != S_OK) {
-			message(-2, "scan: QueryInterface failed: %d", herr);
+			log_message(-2, "scan: QueryInterface failed: %d", herr);
 			goto clean;
 		}
 		if (!mmc) {
-			message(-2, "scan: no mmc");
+			log_message(-2, "scan: no mmc");
 			goto clean;
 		}
 		scsi = (*mmc)-&gt;GetSCSITaskDeviceInterface(mmc);
 		if (!scsi) {
-			message(-2, "scan: no scsi");
+			log_message(-2, "scan: no scsi");
 			goto clean;
 		}
 		err = (*scsi)-&gt;ObtainExclusiveAccess(scsi);
 		if (err != noErr) {
-			message(-2, "scan: ObtainExclusiveAccess failed: %d", err);
+			log_message(-2, "scan: ObtainExclusiveAccess failed: %d", err);
 			goto clean;
 		}
 		ret = inq(scsi, &amp;response, &amp;status, NULL,
@@ -489,7 +489,7 @@ ScsiIf::ScanData *ScsiIf::scan(int *len,
 		          scanData[*len].product,
 		          scanData[*len].revision);
 		if (ret != 0) {
-			message(-2, "scan: inq failed: %d", ret);
+			log_message(-2, "scan: inq failed: %d", ret);
 			goto clean;
 		}
 		(*len)++;
</pre></body></html>