Commit ea64a36a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

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

presence.
parent 1040952e
......@@ -19426,6 +19426,238 @@ _ACEOF
fi
echo "$as_me:$LINENO: checking for scsireq_t.cmd" >&5
echo $ECHO_N "checking for scsireq_t.cmd... $ECHO_C" >&6
if test "${ac_cv_member_scsireq_t_cmd+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#ifdef HAVE_SCSI_SG_H
#include <scsi/sg.h>
#endif
int
main ()
{
static scsireq_t ac_aggr;
if (ac_aggr.cmd)
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_member_scsireq_t_cmd=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#ifdef HAVE_SCSI_SG_H
#include <scsi/sg.h>
#endif
int
main ()
{
static scsireq_t ac_aggr;
if (sizeof ac_aggr.cmd)
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_member_scsireq_t_cmd=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_member_scsireq_t_cmd=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_member_scsireq_t_cmd" >&5
echo "${ECHO_T}$ac_cv_member_scsireq_t_cmd" >&6
if test $ac_cv_member_scsireq_t_cmd = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_SCSIREQ_T_CMD 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for sg_io_hdr_t.interface_id" >&5
echo $ECHO_N "checking for sg_io_hdr_t.interface_id... $ECHO_C" >&6
if test "${ac_cv_member_sg_io_hdr_t_interface_id+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#ifdef HAVE_SCSI_SG_H
#include <scsi/sg.h>
#endif
int
main ()
{
static sg_io_hdr_t ac_aggr;
if (ac_aggr.interface_id)
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_member_sg_io_hdr_t_interface_id=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#ifdef HAVE_SCSI_SG_H
#include <scsi/sg.h>
#endif
int
main ()
{
static sg_io_hdr_t ac_aggr;
if (sizeof ac_aggr.interface_id)
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_member_sg_io_hdr_t_interface_id=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_member_sg_io_hdr_t_interface_id=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_member_sg_io_hdr_t_interface_id" >&5
echo "${ECHO_T}$ac_cv_member_sg_io_hdr_t_interface_id" >&6
if test $ac_cv_member_sg_io_hdr_t_interface_id = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_SG_IO_HDR_T_INTERFACE_ID 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for siginfo_t.si_fd" >&5
echo $ECHO_N "checking for siginfo_t.si_fd... $ECHO_C" >&6
if test "${ac_cv_member_siginfo_t_si_fd+set}" = set; then
......
......@@ -1463,6 +1463,13 @@ AC_CHECK_MEMBERS([struct msghdr.msg_accrights, struct sockaddr.sa_len, struct so
# include <sys/un.h>
#endif])
dnl Check for scsireq_t and sg_io_hdr_t members
AC_CHECK_MEMBERS([scsireq_t.cmd, sg_io_hdr_t.interface_id],,,
[#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>])
......
......@@ -1403,9 +1403,11 @@ static NTSTATUS CDROM_RawRead(int fd, const RAW_READ_INFO* raw, void* buffer, DW
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_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pP
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_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pP
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_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pP
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(int fd, PSCSI_PASS_THROUGH pPacket)
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(int fd, PSCSI_PASS_THROUGH pPacket)
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_SCSI_CAPABILITIES caps)
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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment