dlls/ntdll/tape.c portability

Gerald Pfeifer gerald at pfeifer.com
Fri Feb 3 11:34:31 CST 2006


On Thu, 2 Feb 2006, Gerald Pfeifer wrote:
> This is part two.  FreeBSD does not have struct mtpos, but rather has
> the relevant fields in struct mtget itself.

And this is part three, which addresses the final issues I found on 
FreeBSD.

Gerald

ChangeLog:
Take into account that FreeBSD and others have MTSETBSIZ instead of
MTSETBLK and that struct mt_blksiz is laid out somewhat differently.

Index: tape.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/tape.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 tape.c
--- tape.c	31 Jan 2006 12:08:47 -0000	1.3
+++ tape.c	3 Feb 2006 17:30:28 -0000
@@ -34,6 +34,10 @@
 #if !defined(MTCOMPRESSION) && defined(MTCOMP)
 #define MTCOMPRESSION MTCOMP
 #endif
+/* FreeBSD, for example, has MTSETBSIZ instead of MTSETBLK. */
+#if !defined(MTSETBLK) && defined(MTSETBSIZ)
+#define MTSETBLK MTSETBSIZ
+#endif
 
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
@@ -177,7 +181,11 @@ static NTSTATUS TAPE_GetDriveParams( int
     data->Compression = FALSE;
     data->DataPadding = FALSE;
     data->ReportSetmarks = FALSE;
+#ifdef __FreeBSD__
+    data->DefaultBlockSize = get.mt_blksiz;
+#else
     data->DefaultBlockSize = get.mt_dsreg & MT_ST_BLKSIZE_MASK;
+#endif
     data->MaximumBlockSize = data->DefaultBlockSize;
     data->MinimumBlockSize = data->DefaultBlockSize;
     data->MaximumPartitionCount = 1;
@@ -208,9 +216,17 @@ static NTSTATUS TAPE_GetMediaParams( int
 
     data->Capacity.u.LowPart = 1024 * 1024 * 1024;
     data->Remaining.u.LowPart = 1024 * 1024 * 1024;
+#ifdef __FreeBSD__
+    data->BlockSize = get.mt_blksiz;
+#else
     data->BlockSize = get.mt_dsreg & MT_ST_BLKSIZE_MASK;
+#endif
     data->PartitionCount = 1;
+#ifdef __FreeBSD__
+    data->WriteProtected = 0;
+#else
     data->WriteProtected = GMT_WR_PROT(get.mt_gstat);
+#endif
 
     return status;
 #else



More information about the wine-patches mailing list