ntdll: Use struct mtget.mt_blkno on those systems providing that (and

avoid using struct mtpos which may not be present on such systems).
This commit is contained in:
Gerald Pfeifer 2006-02-06 20:59:44 +01:00 committed by Alexandre Julliard
parent 03434c728e
commit 571d9fb0f0
4 changed files with 125 additions and 1 deletions

113
configure vendored
View File

@ -18299,6 +18299,119 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
fi
echo "$as_me:$LINENO: checking for struct mtget.mt_blkno" >&5
echo $ECHO_N "checking for struct mtget.mt_blkno... $ECHO_C" >&6
if test "${ac_cv_member_struct_mtget_mt_blkno+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. */
#ifdef HAVE_SYS_MTIO_H
#include <sys/mtio.h>
#endif
int
main ()
{
static struct mtget ac_aggr;
if (ac_aggr.mt_blkno)
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_struct_mtget_mt_blkno=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. */
#ifdef HAVE_SYS_MTIO_H
#include <sys/mtio.h>
#endif
int
main ()
{
static struct mtget ac_aggr;
if (sizeof ac_aggr.mt_blkno)
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_struct_mtget_mt_blkno=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_member_struct_mtget_mt_blkno=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_struct_mtget_mt_blkno" >&5
echo "${ECHO_T}$ac_cv_member_struct_mtget_mt_blkno" >&6
if test $ac_cv_member_struct_mtget_mt_blkno = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_MTGET_MT_BLKNO 1
_ACEOF
fi

View File

@ -1428,7 +1428,7 @@ dnl Check for siginfo_t members
AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
dnl Check for struct mtget members
AC_CHECK_MEMBERS([struct mtget.mt_blksiz, struct mtget.mt_gstat],,,
AC_CHECK_MEMBERS([struct mtget.mt_blksiz, struct mtget.mt_gstat, struct mtget.mt_blkno],,,
[#ifdef HAVE_SYS_MTIO_H
#include <sys/mtio.h>
#endif])

View File

@ -238,7 +238,9 @@ static NTSTATUS TAPE_GetPosition( int fd, ULONG type, TAPE_GET_POSITION *data )
{
#ifdef HAVE_SYS_MTIO_H
struct mtget get;
#ifndef HAVE_STRUCT_MTGET_MT_BLKNO
struct mtpos pos;
#endif
NTSTATUS status;
TRACE( "fd: %d type: 0x%08lx\n", fd, type );
@ -249,16 +251,22 @@ static NTSTATUS TAPE_GetPosition( int fd, ULONG type, TAPE_GET_POSITION *data )
if (status != STATUS_SUCCESS)
return status;
#ifndef HAVE_STRUCT_MTGET_MT_BLKNO
status = TAPE_GetStatus( ioctl( fd, MTIOCPOS, &pos ) );
if (status != STATUS_SUCCESS)
return status;
#endif
switch (type)
{
case TAPE_ABSOLUTE_BLOCK:
data->Type = type;
data->Partition = get.mt_resid;
#ifdef HAVE_STRUCT_MTGET_MT_BLKNO
data->OffsetLow = get.mt_blkno;
#else
data->OffsetLow = pos.mt_blkno;
#endif
break;
case TAPE_LOGICAL_BLOCK:
case TAPE_PSEUDO_LOGICAL_BLOCK:

View File

@ -614,6 +614,9 @@
/* Define to 1 if `msg_accrights' is member of `struct msghdr'. */
#undef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
/* Define to 1 if `mt_blkno' is member of `struct mtget'. */
#undef HAVE_STRUCT_MTGET_MT_BLKNO
/* Define to 1 if `mt_blksiz' is member of `struct mtget'. */
#undef HAVE_STRUCT_MTGET_MT_BLKSIZ