View | Details | Raw Unified | Return to bug 39785
Collapse All | Expand All

(-)hercules/Makefile (+1 lines)
Lines 7-12 Link Here
7
7
8
PORTNAME=	hercules
8
PORTNAME=	hercules
9
PORTVERSION=	2.15
9
PORTVERSION=	2.15
10
PORTREVISION=	1
10
CATEGORIES=	emulators
11
CATEGORIES=	emulators
11
MASTER_SITES=	http://www.conmicro.cx/hercules/
12
MASTER_SITES=	http://www.conmicro.cx/hercules/
12
13
(-)hercules/files/patch-aa (+57 lines)
Line 0 Link Here
1
diff -uNr ckddasd.c
2
--- ckddasd.c	Tue Nov 20 17:39:46 2001
3
+++ ckddasd.c	Tue Jan 15 22:03:48 2002
4
@@ -786,7 +786,7 @@
5
         {
6
             /* if lazy write, write the last track image */
7
             if (dev->ckdlazywrt)
8
-                ckd_lseek (dev, -1, -1, -1);
9
+                ckd_lseek (dev, -1, (off_t)-1, -1);
10
 
11
             /* free the cache */
12
             for (i = 0; i < dev->ckdcachenbr; i++)
13
@@ -1240,7 +1240,7 @@
14
 
15
     DEVTRACE("ckddasd: skipping %d bytes\n", skiplen);
16
 
17
-    rc = ckd_lseek (dev, dev->fd, skiplen, SEEK_CUR);
18
+    rc = ckd_lseek (dev, dev->fd, (off_t)skiplen, SEEK_CUR);
19
     if (rc == -1)
20
     {
21
 #ifdef OPTION_SYNCIO
22
@@ -1734,7 +1734,7 @@
23
     ckdlen = CKDDASD_RECHDR_SIZE + keylen + datalen;
24
 
25
     /* Determine the current position in the file */
26
-    curpos = ckd_lseek (dev, dev->fd, 0, SEEK_CUR);
27
+    curpos = ckd_lseek (dev, dev->fd, (off_t)0, SEEK_CUR);
28
     if (curpos == -1)
29
     {
30
 #ifdef OPTION_SYNCIO
31
@@ -1782,7 +1782,7 @@
32
     }
33
 
34
     /* Backspace over end of track marker */
35
-    rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
36
+    rc = ckd_lseek (dev, dev->fd, -(off_t)(CKDDASD_RECHDR_SIZE), SEEK_CUR);
37
     if (rc == -1)
38
     {
39
 #ifdef OPTION_SYNCIO
40
@@ -1854,7 +1854,7 @@
41
     ckdlen = CKDDASD_RECHDR_SIZE + keylen + datalen;
42
 
43
     /* Determine the current position in the file */
44
-    curpos = ckd_lseek (dev, dev->fd, 0, SEEK_CUR);
45
+    curpos = ckd_lseek (dev, dev->fd, (off_t)0, SEEK_CUR);
46
     if (curpos == -1)
47
     {
48
 #ifdef OPTION_SYNCIO
49
@@ -1938,7 +1938,7 @@
50
     }
51
 
52
     /* Backspace over end of track marker */
53
-    rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
54
+    rc = ckd_lseek (dev, dev->fd, -(off_t)(CKDDASD_RECHDR_SIZE), SEEK_CUR);
55
     if (rc == -1)
56
     {
57
 #ifdef OPTION_SYNCIO
(-)hercules/files/patch-ab (+12 lines)
Line 0 Link Here
1
--- Makefile.am	Tue Oct 30 16:44:39 2001
2
+++ Makefile.am	Mon Mar 11 02:44:03 2002
3
@@ -93,8 +93,8 @@
4
 
5
 tar: dist
6
 
7
+install-exec-local:
8
 if SETUID_HERCIFC
9
-install-exec-local:
10
 	chown root $(DESTDIR)$(bindir)/hercifc
11
 	chmod 0751 $(DESTDIR)$(bindir)/hercifc
12
 	chmod +s $(DESTDIR)$(bindir)/hercifc
(-)hercules/files/patch-ad (+50 lines)
Line 0 Link Here
1
diff -uNr configure.ac
2
--- configure.ac	Wed Dec 19 07:20:00 2001
3
+++ configure.ac	Thu Jan 17 22:50:57 2002
4
@@ -72,6 +72,19 @@
5
 
6
 AM_CONDITIONAL(BUILD_FTHREADS, [test x$build_fthreads = xtrue])
7
 
8
+dnl AC_MSG_NOTICE([Checking to see if -pthread is needed to compile])
9
+
10
+AC_MSG_CHECKING([wether ${CC-cc} accepts -pthread])
11
+
12
+echo 'void f(){}' >conftest.c
13
+if test -z "`${CC-cc} -pthread -c conftest.c 2>&1`"; then
14
+        LIBS="-pthread $LIBS"
15
+        AC_MSG_RESULT([yes])
16
+else
17
+        AC_MSG_RESULT([no])
18
+fi
19
+rm -f conftest*
20
+
21
 # Headers
22
 AC_CHECK_HEADERS(byteswap.h)
23
 AC_CHECK_HEADER(fenv.h,,[AC_DEFINE([NO_IEEE_SUPPORT])])
24
@@ -105,6 +118,16 @@
25
                                [AC_DEFINE([HAVE_U_INT])],
26
                                [AC_MSG_ERROR([Unable to find fixed-size data types])] )] )
27
 
28
+dnl AC_MSG_NOTICE([Checking for SCSI tape support and what type])
29
+AC_CHECK_HEADER(sys/mtio.h,
30
+                [AC_DEFINE([HAVE_MTIO_H])])
31
+
32
+AC_TRY_COMPILE([#include mtio.h],
33
+               [mtget test;
34
+                int result;
35
+                result = test.mt_gstat; ],
36
+               [AC_DEFINE([GNU_MTIO_SUPPORT])])
37
+
38
 # Compiler characteristics
39
 
40
 AC_C_BIGENDIAN
41
@@ -306,5 +329,9 @@
42
             [Define to provide additional information about this build])
43
 AH_TEMPLATE([DEBUG],
44
             [Define to enable extra debugging code])
45
+AH_TEMPLATE([HAVE_MTIO_H],
46
+            [Define if your system has sys/mtio.h])
47
+AH_TEMPLATE([GNU_MTIO_SUPPORT],
48
+            [Define if you have the GNU version of mtio.h (Linux)])
49
 
50
 AC_OUTPUT(Makefile util/Makefile html/Makefile)
(-)hercules/files/patch-ae (+11 lines)
Line 0 Link Here
1
diff -uNr hercules.h
2
--- hercules.h	Wed Dec 19 07:18:17 2001
3
+++ hercules.h	Tue Jan 15 20:26:56 2002
4
@@ -215,6 +215,7 @@
5
         pthread_cond_timedwait((pcond),(plk),(timeout))
6
 #define initialize_detach_attr(pat) \
7
         pthread_attr_init((pat)); \
8
+		pthread_attr_setstacksize((pat),1048576); \
9
         pthread_attr_setdetachstate((pat),PTHREAD_CREATE_DETACHED)
10
 typedef void*THREAD_FUNC(void*);
11
 #define create_thread(ptid,pat,fn,arg) \
(-)hercules/files/patch-af (+64 lines)
Line 0 Link Here
1
diff -uNr tapecopy.c
2
--- tapecopy.c	Thu Nov 29 07:53:46 2001
3
+++ tapecopy.c	Thu Jan 17 14:04:09 2002
4
@@ -32,6 +32,7 @@
5
 static BYTE hdrlbl[] = "\xC8\xC4\xD9";  /* EBCDIC characters "HDR"   */
6
 static BYTE eoflbl[] = "\xC5\xD6\xC6";  /* EBCDIC characters "EOF"   */
7
 static BYTE eovlbl[] = "\xC5\xD6\xE5";  /* EBCDIC characters "EOV"   */
8
+#ifdef GNU_MTIO_SUPPORT
9
 static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
10
 static struct mt_tape_info densinfo[] = {
11
     {0x01, "NRZI (800 bpi)"},
12
@@ -59,6 +60,7 @@
13
     {0x8C, "EXB-8505 compressed"},
14
     {0x90, "EXB-8205 compressed"},
15
     {0, NULL}};
16
+#endif
17
 static BYTE buf[65500];
18
 
19
 /*-------------------------------------------------------------------*/
20
@@ -71,6 +73,7 @@
21
 /*-------------------------------------------------------------------*/
22
 static void print_status (BYTE *devname, long stat)
23
 {
24
+#ifdef GNU_MTIO_SUPPORT
25
     printf ("%s status: %8.8lX", devname, stat);
26
     if (GMT_EOF(stat)) printf (" EOF");
27
     if (GMT_BOT(stat)) printf (" BOT");
28
@@ -84,6 +87,7 @@
29
     if (GMT_D_800(stat)) printf (" 800");
30
     if (GMT_DR_OPEN(stat)) printf (" NOTAPE");
31
     printf ("\n");
32
+#endif
33
 
34
 } /* end function print_status */
35
 
36
@@ -104,10 +108,12 @@
37
         return -1;
38
     }
39
 
40
+#ifdef GNU_MTIO_SUPPORT
41
     print_status (devname, stblk.mt_gstat);
42
 
43
     if (GMT_EOD(stblk.mt_gstat)) return 1;
44
     if (GMT_EOT(stblk.mt_gstat)) return 1;
45
+#endif
46
 
47
     return 0;
48
 } /* end function print_status */
49
@@ -174,6 +180,7 @@
50
         exit (7);
51
     }
52
 
53
+#ifdef GNU_MTIO_SUPPORT
54
     /* Display tape status information */
55
     for (i = 0; tapeinfo[i].t_type != 0
56
                 && tapeinfo[i].t_type != stblk.mt_type; i++);
57
@@ -201,6 +208,7 @@
58
 
59
     /* Set the tape device to process variable length blocks */
60
     opblk.mt_op = MTSETBLK;
61
+#endif
62
     opblk.mt_count = 0;
63
     rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
64
     if (rc < 0)
(-)hercules/files/patch-ag (+276 lines)
Line 0 Link Here
1
diff -uNr tapedev.c
2
--- tapedev.c	Tue Nov 20 17:39:47 2001
3
+++ tapedev.c	Thu Jan 17 15:07:35 2002
4
@@ -194,6 +194,7 @@
5
 /*-------------------------------------------------------------------*/
6
 /* Static data areas                                                 */
7
 /*-------------------------------------------------------------------*/
8
+#ifdef GNU_MTIO_SUPPORT
9
 static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
10
 static struct mt_tape_info densinfo[] = {
11
     {0x01, "NRZI (800 bpi)"},
12
@@ -221,6 +222,7 @@
13
     {0x8C, "EXB-8505 compressed"},
14
     {0x90, "EXB-8205 compressed"},
15
     {0, NULL}};
16
+#endif
17
 
18
 static PARSER ptab[] =
19
 {
20
@@ -1142,6 +1144,7 @@
21
 /*-------------------------------------------------------------------*/
22
 static U32 status_scsitape (DEVBLK *dev)
23
 {
24
+#ifdef HAVE_MTIO_H
25
 U32             stat;                   /* Tape status bits          */
26
 int             rc;                     /* Return code               */
27
 struct mtget    stblk;                  /* Area for MTIOCGET ioctl   */
28
@@ -1158,6 +1161,7 @@
29
                 dev->filename, strerror(errno));
30
         return 0;
31
     }
32
+#ifdef GNU_MTIO_SUPPORT
33
     stat = stblk.mt_gstat;
34
 
35
     /* Display tape status */
36
@@ -1190,10 +1194,14 @@
37
         dev->prvblkpos = -1;
38
         dev->blockid = 0;
39
     }
40
+#else
41
+	stat = 0;
42
+#endif
43
 
44
     /* Return tape status */
45
     return stat;
46
 
47
+#endif
48
 } /* end function status_scsitape */
49
 
50
 /*-------------------------------------------------------------------*/
51
@@ -1204,6 +1212,7 @@
52
 /*-------------------------------------------------------------------*/
53
 static int open_scsitape (DEVBLK *dev, BYTE *unitstat)
54
 {
55
+#ifdef HAVE_MTIO_H
56
 int             rc;                     /* Return code               */
57
 int             i;                      /* Array subscript           */
58
 struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
59
@@ -1248,6 +1257,7 @@
60
         return -1;
61
     }
62
 
63
+#ifdef GNU_MTIO_SUPPORT
64
     /* Intervention required if no tape is mounted */
65
     if (GMT_DR_OPEN(stblk.mt_gstat))
66
     {
67
@@ -1283,6 +1293,7 @@
68
 
69
     /* Set the tape device to process variable length blocks */
70
     opblk.mt_op = MTSETBLK;
71
+#endif
72
     opblk.mt_count = 0;
73
     rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
74
     if (rc < 0)
75
@@ -1311,6 +1322,12 @@
76
 
77
     return 0;
78
 
79
+#else
80
+
81
+	logmsg ("HHC286I SCSI Support is disabled\n");
82
+	return -1;
83
+
84
+#endif
85
 } /* end function open_scsitape */
86
 
87
 /*-------------------------------------------------------------------*/
88
@@ -1323,6 +1340,7 @@
89
 /*-------------------------------------------------------------------*/
90
 static int read_scsitape (DEVBLK *dev, BYTE *buf, BYTE *unitstat)
91
 {
92
+#ifdef HAVE_MTIO_H
93
 int             rc;                     /* Return code               */
94
 
95
     /* Read data block from SCSI tape device */
96
@@ -1346,6 +1364,12 @@
97
     /* Return block length or zero if tapemark  */
98
     return rc;
99
 
100
+#else
101
+
102
+	logmsg ("HHC286I SCSI Support is disabled\n");
103
+	return -1;
104
+
105
+#endif
106
 } /* end function read_scsitape */
107
 
108
 /*-------------------------------------------------------------------*/
109
@@ -1357,6 +1381,7 @@
110
 static int write_scsitape (DEVBLK *dev, BYTE *buf, U16 len,
111
                         BYTE *unitstat)
112
 {
113
+#ifdef HAVE_MTIO_H
114
 int             rc;                     /* Return code               */
115
 
116
     /* Write data block to SCSI tape device */
117
@@ -1376,6 +1401,12 @@
118
     /* Return normal status */
119
     return 0;
120
 
121
+#else
122
+
123
+	logmsg ("HHC286I SCSI Support is disabled\n");
124
+	return -1;
125
+
126
+#endif
127
 } /* end function write_scsitape */
128
 
129
 /*-------------------------------------------------------------------*/
130
@@ -1386,6 +1417,7 @@
131
 /*-------------------------------------------------------------------*/
132
 static int write_scsimark (DEVBLK *dev, BYTE *unitstat)
133
 {
134
+#ifdef HAVE_MTIO_H
135
 int             rc;                     /* Return code               */
136
 struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
137
 
138
@@ -1408,6 +1440,12 @@
139
     /* Return normal status */
140
     return 0;
141
 
142
+#else
143
+
144
+	logmsg ("HHC286I SCSI Support is disabled\n");
145
+	return -1;
146
+
147
+#endif
148
 } /* end function write_scsimark */
149
 
150
 /*-------------------------------------------------------------------*/
151
@@ -1420,6 +1458,7 @@
152
 /*-------------------------------------------------------------------*/
153
 static int fsb_scsitape (DEVBLK *dev, BYTE *unitstat)
154
 {
155
+#ifdef HAVE_MTIO_H
156
 int             rc;                     /* Return code               */
157
 int             fsrerrno;               /* Value of errno after MTFSR*/
158
 U32             stat;                   /* Tape status bits          */
159
@@ -1434,6 +1473,7 @@
160
     /* Obtain tape status after forward space */
161
     stat = status_scsitape (dev);
162
 
163
+#ifdef GNU_MTIO_SUPPORT
164
     /* If I/O error and status indicates EOF, then a tapemark
165
        was detected, so increment the file number and return 0 */
166
     if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat))
167
@@ -1442,6 +1482,7 @@
168
         dev->blockid++;
169
         return 0;
170
     }
171
+#endif
172
 
173
     /* Handle MTFSR error condition */
174
     if (rc < 0)
175
@@ -1460,6 +1501,12 @@
176
     /* Return +1 to indicate forward space successful */
177
     return +1;
178
 
179
+#else
180
+
181
+	logmsg ("HHC286I SCSI Support is disabled\n");
182
+	return -1;
183
+
184
+#endif
185
 } /* end function fsb_scsitape */
186
 
187
 /*-------------------------------------------------------------------*/
188
@@ -1472,6 +1519,7 @@
189
 /*-------------------------------------------------------------------*/
190
 static int bsb_scsitape (DEVBLK *dev, BYTE *unitstat)
191
 {
192
+#ifdef HAVE_MTIO_H
193
 int             rc;                     /* Return code               */
194
 int             bsrerrno;               /* Value of errno after MTBSR*/
195
 U32             stat;                   /* Tape status bits          */
196
@@ -1480,6 +1528,7 @@
197
     /* Obtain tape status before backward space */
198
     stat = status_scsitape (dev);
199
 
200
+#ifdef GNU_MTIO_SUPPORT
201
     /* Unit check if already at start of tape */
202
     if (GMT_BOT(stat))
203
     {
204
@@ -1488,6 +1537,7 @@
205
         *unitstat = CSW_CE | CSW_DE | CSW_UC;
206
         return -1;
207
     }
208
+#endif
209
 
210
     /* Backspace block on SCSI tape */
211
     opblk.mt_op = MTBSR;
212
@@ -1526,6 +1576,12 @@
213
     /* Return +1 to indicate backspace successful */
214
     return +1;
215
 
216
+#else
217
+
218
+	logmsg ("HHC286I SCSI Support is disabled\n");
219
+	return -1;
220
+
221
+#endif
222
 } /* end function bsb_scsitape */
223
 
224
 /*-------------------------------------------------------------------*/
225
@@ -1537,6 +1593,7 @@
226
 /*-------------------------------------------------------------------*/
227
 static int fsf_scsitape (DEVBLK *dev, BYTE *unitstat)
228
 {
229
+#ifdef HAVE_MTIO_H
230
 int             rc;                     /* Return code               */
231
 struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
232
 
233
@@ -1562,6 +1619,12 @@
234
     /* Return normal status */
235
     return 0;
236
 
237
+#else
238
+
239
+	logmsg ("HHC286I SCSI Support is disabled\n");
240
+	return -1;
241
+
242
+#endif
243
 } /* end function fsf_scsitape */
244
 
245
 /*-------------------------------------------------------------------*/
246
@@ -1573,6 +1636,7 @@
247
 /*-------------------------------------------------------------------*/
248
 static int bsf_scsitape (DEVBLK *dev, BYTE *unitstat)
249
 {
250
+#ifdef HAVE_MTIO_H
251
 int             rc;                     /* Return code               */
252
 struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
253
 
254
@@ -1599,6 +1663,12 @@
255
     /* Return normal status */
256
     return 0;
257
 
258
+#else
259
+
260
+	logmsg ("HHC286I SCSI Support is disabled\n");
261
+	return -1;
262
+
263
+#endif
264
 } /* end function bsf_scsitape */
265
 
266
 /*-------------------------------------------------------------------*/
267
@@ -2725,7 +2795,9 @@
268
 
269
         case TAPEDEVT_SCSITAPE:
270
             stat = status_scsitape (dev);
271
+#ifdef GNU_MTIO_SUPPORT
272
             if (GMT_BOT(stat)) dev->sense[1] |= SENSE1_TAPE_LOADPT;
273
+#endif
274
             break;
275
 
276
         case TAPEDEVT_OMATAPE:
(-)hercules/files/patch-ah (+18 lines)
Line 0 Link Here
1
diff -uNr version.c
2
--- version.c	Thu Nov 29 08:05:47 2001
3
+++ version.c	Thu Jan 17 14:10:55 2002
4
@@ -77,6 +77,14 @@
5
     "No HET BZIP2 support",
6
 #endif
7
 
8
+#if defined(GNU_MTIO_SUPPORT)
9
+	"Using GNU tape handling",
10
+#elif defined(HAVE_MTIO_H)
11
+	"Using generic Unix tape handling",
12
+#else 
13
+	"No SCSI tape support",
14
+#endif
15
+
16
 #if defined(CUSTOM_BUILD_STRING)
17
     CUSTOM_BUILD_STRING,
18
 #endif
(-)hercules/files/patch-tapecopy.c (-363 lines)
Lines 1-363 Link Here
1
--- tapecopy.c.orig	Thu Nov 29 13:53:46 2001
2
+++ tapecopy.c	Thu Jan 31 13:26:01 2002
3
@@ -8,357 +8,18 @@
4
 /* prints a summary of the tape files and blocksizes.                */
5
 /*-------------------------------------------------------------------*/
6
 
7
-#include "hercules.h"
8
-
9
-/*-------------------------------------------------------------------*/
10
-/* Structure definition for AWSTAPE block header                     */
11
-/*-------------------------------------------------------------------*/
12
-typedef struct _AWSTAPE_BLKHDR {
13
-        HWORD   curblkl;                /* Length of this block      */
14
-        HWORD   prvblkl;                /* Length of previous block  */
15
-        BYTE    flags1;                 /* Flags byte 1              */
16
-        BYTE    flags2;                 /* Flags byte 2              */
17
-    } AWSTAPE_BLKHDR;
18
-
19
-/* Definitions for AWSTAPE_BLKHDR flags byte 1 */
20
-#define AWSTAPE_FLAG1_NEWREC    0x80    /* Start of new record       */
21
-#define AWSTAPE_FLAG1_TAPEMARK  0x40    /* Tape mark                 */
22
-#define AWSTAPE_FLAG1_ENDREC    0x20    /* End of record             */
23
-
24
-/*-------------------------------------------------------------------*/
25
-/* Static data areas                                                 */
26
-/*-------------------------------------------------------------------*/
27
-static BYTE vollbl[] = "\xE5\xD6\xD3";  /* EBCDIC characters "VOL"   */
28
-static BYTE hdrlbl[] = "\xC8\xC4\xD9";  /* EBCDIC characters "HDR"   */
29
-static BYTE eoflbl[] = "\xC5\xD6\xC6";  /* EBCDIC characters "EOF"   */
30
-static BYTE eovlbl[] = "\xC5\xD6\xE5";  /* EBCDIC characters "EOV"   */
31
-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
32
-static struct mt_tape_info densinfo[] = {
33
-    {0x01, "NRZI (800 bpi)"},
34
-    {0x02, "PE (1600 bpi)"},
35
-    {0x03, "GCR (6250 bpi)"},
36
-    {0x05, "QIC-45/60 (GCR, 8000 bpi)"},
37
-    {0x06, "PE (3200 bpi)"},
38
-    {0x07, "IMFM (6400 bpi)"},
39
-    {0x08, "GCR (8000 bpi)"},
40
-    {0x09, "GCR /37871 bpi)"},
41
-    {0x0A, "MFM (6667 bpi)"},
42
-    {0x0B, "PE (1600 bpi)"},
43
-    {0x0C, "GCR (12960 bpi)"},
44
-    {0x0D, "GCR (25380 bpi)"},
45
-    {0x0F, "QIC-120 (GCR 10000 bpi)"},
46
-    {0x10, "QIC-150/250 (GCR 10000 bpi)"},
47
-    {0x11, "QIC-320/525 (GCR 16000 bpi)"},
48
-    {0x12, "QIC-1350 (RLL 51667 bpi)"},
49
-    {0x13, "DDS (61000 bpi)"},
50
-    {0x14, "EXB-8200 (RLL 43245 bpi)"},
51
-    {0x15, "EXB-8500 (RLL 45434 bpi)"},
52
-    {0x16, "MFM 10000 bpi"},
53
-    {0x17, "MFM 42500 bpi"},
54
-    {0x24, "DDS-2"},
55
-    {0x8C, "EXB-8505 compressed"},
56
-    {0x90, "EXB-8205 compressed"},
57
-    {0, NULL}};
58
-static BYTE buf[65500];
59
-
60
-/*-------------------------------------------------------------------*/
61
-/* ASCII to EBCDIC translate tables                                  */
62
-/*-------------------------------------------------------------------*/
63
-#include "codeconv.h"
64
-
65
-/*-------------------------------------------------------------------*/
66
-/* Subroutine to print tape status                                   */
67
-/*-------------------------------------------------------------------*/
68
-static void print_status (BYTE *devname, long stat)
69
-{
70
-    printf ("%s status: %8.8lX", devname, stat);
71
-    if (GMT_EOF(stat)) printf (" EOF");
72
-    if (GMT_BOT(stat)) printf (" BOT");
73
-    if (GMT_EOT(stat)) printf (" EOT");
74
-    if (GMT_SM(stat)) printf (" SETMARK");
75
-    if (GMT_EOD(stat)) printf (" EOD");
76
-    if (GMT_WR_PROT(stat)) printf (" WRPROT");
77
-    if (GMT_ONLINE(stat)) printf (" ONLINE");
78
-    if (GMT_D_6250(stat)) printf (" 6250");
79
-    if (GMT_D_1600(stat)) printf (" 1600");
80
-    if (GMT_D_800(stat)) printf (" 800");
81
-    if (GMT_DR_OPEN(stat)) printf (" NOTAPE");
82
-    printf ("\n");
83
-
84
-} /* end function print_status */
85
-
86
-/*-------------------------------------------------------------------*/
87
-/* Subroutine to obtain and print tape status                        */
88
-/* Return value: 0=normal, 1=end of tape, -1=error                   */
89
-/*-------------------------------------------------------------------*/
90
-static int obtain_status (BYTE *devname, int devfd)
91
-{
92
-int             rc;                     /* Return code               */
93
-struct mtget    stblk;                  /* Area for MTIOCGET ioctl   */
94
-
95
-    rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
96
-    if (rc < 0)
97
-    {
98
-        printf ("tapecopy: Error reading status of %s: %s\n",
99
-                devname, strerror(errno));
100
-        return -1;
101
-    }
102
-
103
-    print_status (devname, stblk.mt_gstat);
104
-
105
-    if (GMT_EOD(stblk.mt_gstat)) return 1;
106
-    if (GMT_EOT(stblk.mt_gstat)) return 1;
107
-
108
-    return 0;
109
-} /* end function print_status */
110
 
111
 /*-------------------------------------------------------------------*/
112
 /* TAPECOPY main entry point                                         */
113
 /*-------------------------------------------------------------------*/
114
 int main (int argc, char *argv[])
115
 {
116
-int             rc;                     /* Return code               */
117
-int             i;                      /* Array subscript           */
118
-int             len;                    /* Block length              */
119
-int             prevlen;                /* Previous block length     */
120
-BYTE           *devname;                /* -> Tape device name       */
121
-BYTE           *filename;               /* -> Output file name       */
122
-int             devfd;                  /* Tape file descriptor      */
123
-int             outfd = -1;             /* Output file descriptor    */
124
-int             fileno;                 /* Tape file number          */
125
-int             blkcount;               /* Block count               */
126
-int             minblksz;               /* Minimum block size        */
127
-int             maxblksz;               /* Maximum block size        */
128
-struct mtop     opblk;                  /* Area for MTIOCTOP ioctl   */
129
-struct mtget    stblk;                  /* Area for MTIOCGET ioctl   */
130
-long            density;                /* Tape density code         */
131
-BYTE            labelrec[81];           /* Standard label (ASCIIZ)   */
132
-AWSTAPE_BLKHDR  awshdr;                 /* AWSTAPE block header      */
133
-
134
-    /* Display the program identification message */
135
-    display_version (stderr, "Hercules tape copy program ");
136
-
137
-    /* The first argument is the tape device name */
138
-    if (argc > 1 && argv[1] != NULL && strlen(argv[1]) > 5
139
-        && memcmp (argv[1], "/dev/", 5) == 0)
140
-    {
141
-        devname = argv[1];
142
-    }
143
-    else
144
-    {
145
-        printf ("Usage: tapecopy /dev/st0 [outfile]\n");
146
-        exit (1);
147
-    }
148
-
149
-    /* The second argument is the output file name */
150
-    if (argc > 2 && argv[2] != NULL)
151
-        filename = argv[2];
152
-    else
153
-        filename = NULL;
154
-
155
-    /* Open the tape device */
156
-    devfd = open (devname, O_RDONLY|O_BINARY);
157
-    if (devfd < 0)
158
-    {
159
-        printf ("tapecopy: Error opening %s: %s\n",
160
-                devname, strerror(errno));
161
-        exit (3);
162
-    }
163
 
164
-    /* Obtain the tape status */
165
-    rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
166
-    if (rc < 0)
167
-    {
168
-        printf ("tapecopy: Error reading status of %s: %s\n",
169
-                devname, strerror(errno));
170
-        exit (7);
171
-    }
172
 
173
-    /* Display tape status information */
174
-    for (i = 0; tapeinfo[i].t_type != 0
175
-                && tapeinfo[i].t_type != stblk.mt_type; i++);
176
-
177
-    if (tapeinfo[i].t_name != NULL)
178
-        printf ("%s device type: %s\n", devname, tapeinfo[i].t_name);
179
-    else
180
-        printf ("%s device type: 0x%lX\n", devname, stblk.mt_type);
181
-
182
-    density = (stblk.mt_dsreg & MT_ST_DENSITY_MASK)
183
-                >> MT_ST_DENSITY_SHIFT;
184
-
185
-    for (i = 0; densinfo[i].t_type != 0
186
-                && densinfo[i].t_type != density; i++);
187
-
188
-    if (densinfo[i].t_name != NULL)
189
-        printf ("%s tape density: %s\n", devname, densinfo[i].t_name);
190
-    else
191
-        printf ("%s tape density code: 0x%lX\n", devname, density);
192
-
193
-    if (stblk.mt_gstat != 0)
194
-    {
195
-        print_status (devname, stblk.mt_gstat);
196
-    }
197
-
198
-    /* Set the tape device to process variable length blocks */
199
-    opblk.mt_op = MTSETBLK;
200
-    opblk.mt_count = 0;
201
-    rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
202
-    if (rc < 0)
203
-    {
204
-        printf ("tapecopy: Error setting attributes for %s: %s\n",
205
-                devname, strerror(errno));
206
-        exit (5);
207
-    }
208
-
209
-    /* Rewind the tape to the beginning */
210
-    opblk.mt_op = MTREW;
211
-    opblk.mt_count = 1;
212
-    rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
213
-    if (rc < 0)
214
-    {
215
-        printf ("tapecopy: Error rewinding %s: %s\n",
216
-                devname, strerror(errno));
217
-        exit (6);
218
-    }
219
-
220
-    /* Open the output file */
221
-    if (filename != NULL)
222
-    {
223
-        outfd = open (filename, O_WRONLY | O_CREAT | O_BINARY,
224
-                        S_IRUSR | S_IWUSR | S_IRGRP);
225
-        if (outfd < 0)
226
-        {
227
-            printf ("tapecopy: Error opening %s: %s\n",
228
-                    filename, strerror(errno));
229
-            exit (4);
230
-        }
231
-    }
232
-
233
-    /* Copy blocks from tape to the output file */
234
-    fileno = 1;
235
-    blkcount = 0;
236
-    minblksz = 0;
237
-    maxblksz = 0;
238
-    len = 0;
239
-
240
-    while (1)
241
-    {
242
-        /* Save previous block length */
243
-        prevlen = len;
244
-
245
-        /* Read a block from the tape */
246
-        len = read (devfd, buf, sizeof(buf));
247
-        if (len < 0)
248
-        {
249
-            printf ("tapecopy: Error reading %s: %s\n",
250
-                    devname, strerror(errno));
251
-            obtain_status (devname, devfd);
252
-            exit (8);
253
-        }
254
-
255
-        /* Check for tape mark */
256
-        if (len == 0)
257
-        {
258
-            /* Print summary of current file */
259
-            printf ("File %u: Blocks=%u, block size min=%u, max=%u\n",
260
-                    fileno, blkcount, minblksz, maxblksz);
261
-
262
-            /* Write tape mark to output file */
263
-            if (outfd >= 0)
264
-            {
265
-                /* Build block header for tape mark */
266
-                awshdr.curblkl[0] = 0;
267
-                awshdr.curblkl[1] = 0;
268
-                awshdr.prvblkl[0] = prevlen & 0xFF;
269
-                awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF;
270
-                awshdr.flags1 = AWSTAPE_FLAG1_TAPEMARK;
271
-                awshdr.flags2 = 0;
272
-
273
-                /* Write block header to output file */
274
-                rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR));
275
-                if (rc < sizeof(AWSTAPE_BLKHDR))
276
-                {
277
-                    printf ("tapecopy: Error writing %s: %s\n",
278
-                            filename, strerror(errno));
279
-                    exit (9);
280
-                } /* end if(rc) */
281
-
282
-            } /* end if(outfd) */
283
-
284
-            /* Reset counters for next file */
285
-            fileno++;
286
-            minblksz = 0;
287
-            maxblksz = 0;
288
-            blkcount = 0;
289
-
290
-            /* Determine whether end of tape has been read */
291
-            rc = obtain_status (devname, devfd);
292
-            if (rc == 0) continue;
293
-            if (rc > 0) printf ("End of tape\n");
294
-            break;
295
-
296
-        } /* end if(tapemark) */
297
-
298
-        /* Count blocks and block sizes */
299
-        blkcount++;
300
-        if (len > maxblksz) maxblksz = len;
301
-        if (minblksz == 0 || len < minblksz) minblksz = len;
302
-
303
-        /* Print standard labels */
304
-        if (len == 80 && blkcount < 4
305
-            && (memcmp(buf, vollbl, 3) == 0
306
-                || memcmp(buf, hdrlbl, 3) == 0
307
-                || memcmp(buf, eoflbl, 3) == 0
308
-                || memcmp(buf, eovlbl, 3) == 0))
309
-        {
310
-            for (i=0; i < 80; i++)
311
-                labelrec[i] = ebcdic_to_ascii[buf[i]];
312
-            labelrec[i] = '\0';
313
-            printf ("%s\n", labelrec);
314
-        }
315
-        else
316
-        {
317
-            printf ("File %u: Block %u\r", fileno, blkcount);
318
-        }
319
-
320
-        /* Write block to output file */
321
-        if (outfd >= 0)
322
-        {
323
-            /* Build the block header */
324
-            awshdr.curblkl[0] = len & 0xFF;
325
-            awshdr.curblkl[1] = (len >> 8) & 0xFF;
326
-            awshdr.prvblkl[0] = prevlen & 0xFF;
327
-            awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF;
328
-            awshdr.flags1 = AWSTAPE_FLAG1_NEWREC
329
-                            | AWSTAPE_FLAG1_ENDREC;
330
-            awshdr.flags2 = 0;
331
-
332
-            /* Write block header to output file */
333
-            rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR));
334
-            if (rc < sizeof(AWSTAPE_BLKHDR))
335
-            {
336
-                printf ("tapecopy: Error writing %s: %s\n",
337
-                        filename, strerror(errno));
338
-                exit (10);
339
-            } /* end if(rc) */
340
-
341
-            /* Write data block to output file */
342
-            rc = write (outfd, buf, len);
343
-            if (rc < len)
344
-            {
345
-                printf ("tapecopy: Error writing %s: %s\n",
346
-                        filename, strerror(errno));
347
-                exit (11);
348
-            } /* end if(rc) */
349
-
350
-        } /* end if(outfd) */
351
-
352
-    } /* end while */
353
-
354
-    /* Close files and exit */
355
-    close (devfd);
356
-    if (filename != NULL) close (outfd);
357
+    /* Display the program identification message */
358
+ 
359
 
360
+    printf("Tape copy is broken, sorry\n");
361
     return 0;
362
 
363
 } /* end function main */
(-)hercules/files/patch-tapedev.c (-224 lines)
Lines 1-224 Link Here
1
--- tapedev.c.orig	Tue Nov 20 23:39:47 2001
2
+++ tapedev.c	Thu Jan 31 13:06:43 2002
3
@@ -131,6 +131,11 @@
4
 #define TAPEDEVT_SCSITAPE       3       /* Physical SCSI tape        */
5
 #define TAPEDEVT_HET            4       /* HET format disk file      */
6
 
7
+/* Can you say totally b0rken? */
8
+#define MT_ST_DENSITY_MASK	1
9
+#define MT_TAPE_INFO		2
10
+#define MTSETBLK		3
11
+#define MT_ST_DENSITY_SHIFT	4
12
 /*-------------------------------------------------------------------*/
13
 /* Structure definition for tape block headers                       */
14
 /*-------------------------------------------------------------------*/
15
@@ -194,7 +199,10 @@
16
 /*-------------------------------------------------------------------*/
17
 /* Static data areas                                                 */
18
 /*-------------------------------------------------------------------*/
19
-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
20
+
21
+
22
+/* static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO; 
23
+
24
 static struct mt_tape_info densinfo[] = {
25
     {0x01, "NRZI (800 bpi)"},
26
     {0x02, "PE (1600 bpi)"},
27
@@ -221,7 +229,7 @@
28
     {0x8C, "EXB-8505 compressed"},
29
     {0x90, "EXB-8205 compressed"},
30
     {0, NULL}};
31
-
32
+*/
33
 static PARSER ptab[] =
34
 {
35
     { "awstape", NULL }, 
36
@@ -1151,6 +1159,7 @@
37
     if (dev->fd < 0) return 0;
38
 
39
     /* Obtain tape status */
40
+/*
41
     rc = ioctl (dev->fd, MTIOCGET, (char*)&stblk);
42
     if (rc < 0)
43
     {
44
@@ -1159,8 +1168,9 @@
45
         return 0;
46
     }
47
     stat = stblk.mt_gstat;
48
-
49
+*/
50
     /* Display tape status */
51
+/*
52
     if (dev->ccwtrace || dev->ccwstep)
53
     {
54
         sprintf (buf, "%s status: %8.8X", dev->filename, stat);
55
@@ -1177,10 +1187,11 @@
56
         if (GMT_DR_OPEN(stat)) strcat (buf, " NOTAPE");
57
         logmsg ("HHC215I %s\n", buf);
58
     }
59
-
60
+*/
61
     /* If tape has been ejected, then close the file because
62
        the driver will not recognize that a new tape volume
63
        has been mounted until the file is re-opened */
64
+/*
65
     if (GMT_DR_OPEN(stat))
66
     {
67
         close (dev->fd);
68
@@ -1190,8 +1201,10 @@
69
         dev->prvblkpos = -1;
70
         dev->blockid = 0;
71
     }
72
-
73
+*/
74
     /* Return tape status */
75
+
76
+	fprintf(stderr,"Sorry, tape support is broken.\n");
77
     return stat;
78
 
79
 } /* end function status_scsitape */
80
@@ -1249,6 +1262,7 @@
81
     }
82
 
83
     /* Intervention required if no tape is mounted */
84
+/*
85
     if (GMT_DR_OPEN(stblk.mt_gstat))
86
     {
87
         dev->sense[0] = SENSE_IR;
88
@@ -1256,8 +1270,9 @@
89
         *unitstat = CSW_CE | CSW_DE | CSW_UC;
90
         return -1;
91
     }
92
-
93
+*/
94
     /* Display tape status information */
95
+/*
96
     for (i = 0; tapeinfo[i].t_type != 0
97
                 && tapeinfo[i].t_type != stblk.mt_type; i++);
98
 
99
@@ -1280,8 +1295,9 @@
100
     else
101
         logmsg ("HHC221I %s tape density code: 0x%lX\n",
102
                 dev->filename, density);
103
-
104
+*/
105
     /* Set the tape device to process variable length blocks */
106
+ /*
107
     opblk.mt_op = MTSETBLK;
108
     opblk.mt_count = 0;
109
     rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
110
@@ -1294,8 +1310,9 @@
111
         *unitstat = CSW_CE | CSW_DE | CSW_UC;
112
         return -1;
113
     }
114
-
115
+*/
116
     /* Rewind the tape to the beginning */
117
+/* 
118
     opblk.mt_op = MTREW;
119
     opblk.mt_count = 1;
120
     rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
121
@@ -1308,7 +1325,7 @@
122
         *unitstat = CSW_CE | CSW_DE | CSW_UC;
123
         return -1;
124
     }
125
-
126
+*/
127
     return 0;
128
 
129
 } /* end function open_scsitape */
130
@@ -1436,13 +1453,14 @@
131
 
132
     /* If I/O error and status indicates EOF, then a tapemark
133
        was detected, so increment the file number and return 0 */
134
+/*
135
     if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat))
136
     {
137
         dev->curfilen++;
138
         dev->blockid++;
139
         return 0;
140
     }
141
-
142
+*/
143
     /* Handle MTFSR error condition */
144
     if (rc < 0)
145
     {
146
@@ -1481,6 +1499,7 @@
147
     stat = status_scsitape (dev);
148
 
149
     /* Unit check if already at start of tape */
150
+/*
151
     if (GMT_BOT(stat))
152
     {
153
         dev->sense[0] = 0;
154
@@ -1488,7 +1507,7 @@
155
         *unitstat = CSW_CE | CSW_DE | CSW_UC;
156
         return -1;
157
     }
158
-
159
+*/
160
     /* Backspace block on SCSI tape */
161
     opblk.mt_op = MTBSR;
162
     opblk.mt_count = 1;
163
@@ -2703,12 +2722,15 @@
164
 U32             stat;                   /* SCSI tape status bits     */
165
 
166
     /* Indicate intervention required if no file */
167
+/*
168
     if (!strcmp (dev->filename, TAPE_UNLOADED))
169
 	dev->sense[0] |= SENSE_IR;
170
 
171
     if (!(dev->fd < 0))
172
     {
173
+    */
174
         /* Set load point indicator if tape is at load point */
175
+/*
176
         dev->sense[1] &= ~SENSE1_TAPE_LOADPT;
177
         switch (dev->tapedevt)
178
         {
179
@@ -2732,41 +2754,14 @@
180
             if (dev->nxtblkpos == 0 && dev->curfilen == 1)
181
                 dev->sense[1] |= SENSE1_TAPE_LOADPT;
182
             break;
183
-        } /* end switch(dev->tapedevt) */
184
-    } /* !(fd < 0) */
185
+        } 
186
+	*/
187
+	/* end switch(dev->tapedevt) */
188
+    
189
 
190
     /* Indicate Drive online to control unit */
191
-    dev->sense[1] |= SENSE1_TAPE_TUA;
192
 
193
-    /* Set file protect indicator if read-only file */
194
-    if (dev->readonly)
195
-        dev->sense[1] |= SENSE1_TAPE_FP;
196
-    else
197
-        dev->sense[1] &= ~SENSE1_TAPE_FP;
198
 
199
-    /* Set Error Recovery Action Code */
200
-    if (dev->sense[0] & SENSE_IR)
201
-        dev->sense[3] = 0x43;
202
-    else if (dev->sense[0] & SENSE_CR)
203
-        dev->sense[3] = 0x27;
204
-    else if (dev->sense[1] & SENSE1_TAPE_FP)
205
-        dev->sense[3] = 0x30;
206
-    else
207
-        dev->sense[3] = 0x29;
208
-
209
-    /* Set sense bytes for 3420 */
210
-    if (dev->devtype != 0x3480)
211
-    {
212
-//      dev->sense[4] |= 0x20;
213
-        dev->sense[5] |= 0xC0;
214
-        dev->sense[6] |= 0x03;
215
-        dev->sense[13] = 0x80;
216
-        dev->sense[14] = 0x01;
217
-        dev->sense[15] = 0x00;
218
-        dev->sense[16] = 0x01;
219
-        dev->sense[19] = 0xFF;
220
-        dev->sense[20] = 0xFF;
221
-    }
222
 
223
 } /* end function build_sense */
224
 
(-)hercules/pkg-message (-2 lines)
Lines 1-8 Link Here
1
######################################################################
1
######################################################################
2
2
3
                           IMPORTANT
3
                           IMPORTANT
4
  Tape operations and tapecopy are broken in this port (contain Linux
5
specific code that has not yet been adapted).
6
4
7
  Be sure to have a look at the docs and edit the hercules.cnf file to
5
  Be sure to have a look at the docs and edit the hercules.cnf file to
8
your needs (The sample is in ${PREFIX}/share/doc/hercules)
6
your needs (The sample is in ${PREFIX}/share/doc/hercules)
(-)hercules/pkg-plist (-12 / +12 lines)
Lines 17-31 Link Here
17
bin/tapecopy
17
bin/tapecopy
18
bin/tapemap
18
bin/tapemap
19
bin/tapesplt
19
bin/tapesplt
20
share/doc/hercules/cckddasd.html
20
%%PORTDOCS%%share/doc/hercules/cckddasd.html
21
share/doc/hercules/hercconf.html
21
%%PORTDOCS%%share/doc/hercules/hercconf.html
22
share/doc/hercules/hercfaq.html
22
%%PORTDOCS%%share/doc/hercules/hercfaq.html
23
share/doc/hercules/hercinst.html
23
%%PORTDOCS%%share/doc/hercules/hercinst.html
24
share/doc/hercules/herclic.html
24
%%PORTDOCS%%share/doc/hercules/herclic.html
25
share/doc/hercules/hercload.html
25
%%PORTDOCS%%share/doc/hercules/hercload.html
26
share/doc/hercules/hercnew.html
26
%%PORTDOCS%%share/doc/hercules/hercnew.html
27
share/doc/hercules/herctcp.html
27
%%PORTDOCS%%share/doc/hercules/herctcp.html
28
share/doc/hercules/hercules.cnf
28
%%PORTDOCS%%share/doc/hercules/hercules.cnf
29
share/doc/hercules/hercules.css
29
%%PORTDOCS%%share/doc/hercules/hercules.css
30
share/doc/hercules/index.html
30
%%PORTDOCS%%share/doc/hercules/index.html
31
@dirrm share/doc/hercules
31
%%PORTDOCS%%@dirrm share/doc/hercules

Return to bug 39785