dlls/ntdll/tape.c portability
Gerald Pfeifer
gerald at pfeifer.com
Sun Feb 5 15:13:59 CST 2006
On Thu, 2 Feb 2006, Gerald Pfeifer wrote:
> ChangeLog:
> On FreeBSD, struct mtget already contains all required information,
> so we only have that, and not struct mtpos as on Linux.
Alexandre indicated the he'd prefer autoconf over #ifdef __FreeBSD__,
so here we go.
Gerald
ChangeLog:
Use struct mtget.mt_blkno on those systems providing that (and avoid
using struct mtpos which may not be present on such systems).
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.427
diff -u -3 -p -r1.427 configure.ac
--- configure.ac 5 Feb 2006 12:59:20 -0000 1.427
+++ configure.ac 5 Feb 2006 20:48:39 -0000
@@ -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])
Index: dlls/ntdll/tape.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/tape.c,v
retrieving revision 1.4
diff -u -3 -p -r1.4 tape.c
--- dlls/ntdll/tape.c 5 Feb 2006 12:59:20 -0000 1.4
+++ dlls/ntdll/tape.c 5 Feb 2006 20:48:39 -0000
@@ -238,7 +242,9 @@ static NTSTATUS TAPE_GetPosition( int fd
{
#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 +255,22 @@ static NTSTATUS TAPE_GetPosition( int fd
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:
More information about the wine-patches
mailing list