Add a check for sg_io_hdr_t and (not tested) check for scsireq_t presence

Dmitry Timoshkov dmitry at baikal.ru
Mon Jun 27 02:57:55 CDT 2005


Hello,

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Add a check for sg_io_hdr_t and (not tested) check for scsireq_t
    presence.

diff -up cvs/hq/wine/configure.ac wine/configure.ac
--- cvs/hq/wine/configure.ac	2005-06-21 16:39:53.000000000 +0900
+++ wine/configure.ac	2005-06-27 14:09:58.000000000 +0900
@@ -1463,6 +1463,13 @@ AC_CHECK_MEMBERS([struct msghdr.msg_accr
 # include <sys/un.h>
 #endif])
 
+dnl Check for scsireq_t members
+AC_CHECK_MEMBERS([scsireq_t.cmd],,,
+[#include <sys/types.h>
+#ifdef HAVE_SCSI_SG_H
+#include <scsi/sg.h>
+#endif])
+
 dnl Check for siginfo_t members
 AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
 
@@ -1475,6 +1482,13 @@ AC_CHECK_MEMBERS([struct option.name],,,
 dnl Check for stat.st_blocks
 AC_CHECK_MEMBERS([struct stat.st_blocks])
 
+dnl Check for sg_io_hdr_t members
+AC_CHECK_MEMBERS([sg_io_hdr_t.interface_id],,,
+[#include <sys/types.h>
+#ifdef HAVE_SCSI_SG_H
+#include <scsi/sg.h>
+#endif])
+
 dnl Check for the external timezone variables timezone and daylight
 AC_CACHE_CHECK([for timezone variable], ac_cv_have_timezone,
                AC_TRY_LINK([#include <time.h>],[timezone;],
diff -up cvs/hq/wine/dlls/ntdll/cdrom.c wine/dlls/ntdll/cdrom.c
--- cvs/hq/wine/dlls/ntdll/cdrom.c	2005-06-27 12:29:37.000000000 +0900
+++ wine/dlls/ntdll/cdrom.c	2005-06-27 16:44:23.000000000 +0900
@@ -1403,9 +1403,11 @@ static NTSTATUS CDROM_RawRead(int fd, co
 static NTSTATUS CDROM_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pPacket)
 {
     int ret = STATUS_NOT_SUPPORTED;
-
-#if defined(linux)
+#ifdef HAVE_SG_IO_HDR_T_INTERFACE_ID
     sg_io_hdr_t cmd;
+#elif defined HAVE_SCSIREQ_T_CMD
+    scsireq_t cmd;
+#endif
     int io;
 
     if (pPacket->Length < sizeof(SCSI_PASS_THROUGH_DIRECT))
@@ -1420,6 +1422,7 @@ static NTSTATUS CDROM_ScsiPassThroughDir
     if (pPacket->DataTransferLength > 0 && !pPacket->DataBuffer)
         return STATUS_INVALID_PARAMETER;
 
+#ifdef HAVE_SG_IO_HDR_T_INTERFACE_ID
     RtlZeroMemory(&cmd, sizeof(cmd));
 
     cmd.interface_id   = 'S';
@@ -1454,18 +1457,7 @@ static NTSTATUS CDROM_ScsiPassThroughDir
 
     ret = CDROM_GetStatusCode(io);
 
-#elif defined(__NetBSD__)
-    scsireq_t cmd;
-    int io;
-
-    if (pPacket->Length < sizeof(SCSI_PASS_THROUGH_DIRECT))
-	return STATUS_BUFFER_TOO_SMALL;
-
-    if (pPacket->CdbLength > 12)
-        return STATUS_INVALID_PARAMETER;
-
-    if (pPacket->SenseInfoLength > SENSEBUFLEN)
-        return STATUS_INVALID_PARAMETER;
+#elif defined HAVE_SCSIREQ_T_CMD
 
     memset(&cmd, 0, sizeof(cmd));
     memcpy(&(cmd.cmd), &(pPacket->Cdb), pPacket->CdbLength);
@@ -1526,8 +1518,11 @@ static NTSTATUS CDROM_ScsiPassThroughDir
 static NTSTATUS CDROM_ScsiPassThrough(int fd, PSCSI_PASS_THROUGH pPacket)
 {
     int ret = STATUS_NOT_SUPPORTED;
-#if defined(linux)
+#ifdef HAVE_SG_IO_HDR_T_INTERFACE_ID
     sg_io_hdr_t cmd;
+#elif defined HAVE_SCSIREQ_T_CMD
+    scsireq_t cmd;
+#endif
     int io;
 
     if (pPacket->Length < sizeof(SCSI_PASS_THROUGH))
@@ -1542,6 +1537,7 @@ static NTSTATUS CDROM_ScsiPassThrough(in
     if (pPacket->DataTransferLength > 0 && pPacket->DataBufferOffset < sizeof(SCSI_PASS_THROUGH))
         return STATUS_INVALID_PARAMETER;
 
+#ifdef HAVE_SG_IO_HDR_T_INTERFACE_ID
     RtlZeroMemory(&cmd, sizeof(cmd));
 
     cmd.interface_id   = 'S';
@@ -1578,9 +1574,7 @@ static NTSTATUS CDROM_ScsiPassThrough(in
 
     ret = CDROM_GetStatusCode(io);
 
-#elif defined(__NetBSD__)
-    scsireq_t cmd;
-    int io;
+#elif defined HAVE_SCSIREQ_T_CMD
 
     if (pPacket->Length < sizeof(SCSI_PASS_THROUGH))
 	return STATUS_BUFFER_TOO_SMALL;
@@ -1660,7 +1654,7 @@ static NTSTATUS CDROM_ScsiGetCaps(PIO_SC
     NTSTATUS    ret = STATUS_NOT_IMPLEMENTED;
 
     caps->Length = sizeof(*caps);
-#if defined(linux)
+#ifdef SG_SCATTER_SZ
     caps->MaximumTransferLength = SG_SCATTER_SZ; /* FIXME */
     caps->MaximumPhysicalPages = SG_SCATTER_SZ / getpagesize();
     caps->SupportedAsynchronousEvents = TRUE;
diff -up cvs/hq/wine/include/config.h.in wine/include/config.h.in
--- cvs/hq/wine/include/config.h.in	2005-05-27 13:44:27.000000000 +0900
+++ wine/include/config.h.in	2005-06-27 16:39:26.000000000 +0900
@@ -497,6 +497,9 @@
 /* Define to 1 if you have the `sched_yield' function. */
 #undef HAVE_SCHED_YIELD
 
+/* Define to 1 if `cmd' is member of `scsireq_t'. */
+#undef HAVE_SCSIREQ_T_CMD
+
 /* Define to 1 if you have the <scsi/scsi.h> header file. */
 #undef HAVE_SCSI_SCSI_H
 
@@ -515,6 +518,9 @@
 /* Define to 1 if you have the `settimeofday' function. */
 #undef HAVE_SETTIMEOFDAY
 
+/* Define to 1 if `interface_id' is member of `sg_io_hdr_t'. */
+#undef HAVE_SG_IO_HDR_T_INTERFACE_ID
+
 /* Define if sigaddset is supported */
 #undef HAVE_SIGADDSET
 






More information about the wine-patches mailing list