1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-22 20:41:26 +00:00

Merge Mark Daniel Szlaga's tape patches into the port, Fix some PORTDOCS issues.

PR:		39785
Submitted by:	maintainer
This commit is contained in:
Ying-Chieh Liao 2002-06-25 05:22:11 +00:00
parent 545c7b0dbf
commit c1252d8a64
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=61903
12 changed files with 501 additions and 601 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= hercules
PORTVERSION= 2.15
PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://www.conmicro.cx/hercules/

View File

@ -0,0 +1,57 @@
diff -uNr ckddasd.c
--- ckddasd.c Tue Nov 20 17:39:46 2001
+++ ckddasd.c Tue Jan 15 22:03:48 2002
@@ -786,7 +786,7 @@
{
/* if lazy write, write the last track image */
if (dev->ckdlazywrt)
- ckd_lseek (dev, -1, -1, -1);
+ ckd_lseek (dev, -1, (off_t)-1, -1);
/* free the cache */
for (i = 0; i < dev->ckdcachenbr; i++)
@@ -1240,7 +1240,7 @@
DEVTRACE("ckddasd: skipping %d bytes\n", skiplen);
- rc = ckd_lseek (dev, dev->fd, skiplen, SEEK_CUR);
+ rc = ckd_lseek (dev, dev->fd, (off_t)skiplen, SEEK_CUR);
if (rc == -1)
{
#ifdef OPTION_SYNCIO
@@ -1734,7 +1734,7 @@
ckdlen = CKDDASD_RECHDR_SIZE + keylen + datalen;
/* Determine the current position in the file */
- curpos = ckd_lseek (dev, dev->fd, 0, SEEK_CUR);
+ curpos = ckd_lseek (dev, dev->fd, (off_t)0, SEEK_CUR);
if (curpos == -1)
{
#ifdef OPTION_SYNCIO
@@ -1782,7 +1782,7 @@
}
/* Backspace over end of track marker */
- rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
+ rc = ckd_lseek (dev, dev->fd, -(off_t)(CKDDASD_RECHDR_SIZE), SEEK_CUR);
if (rc == -1)
{
#ifdef OPTION_SYNCIO
@@ -1854,7 +1854,7 @@
ckdlen = CKDDASD_RECHDR_SIZE + keylen + datalen;
/* Determine the current position in the file */
- curpos = ckd_lseek (dev, dev->fd, 0, SEEK_CUR);
+ curpos = ckd_lseek (dev, dev->fd, (off_t)0, SEEK_CUR);
if (curpos == -1)
{
#ifdef OPTION_SYNCIO
@@ -1938,7 +1938,7 @@
}
/* Backspace over end of track marker */
- rc = ckd_lseek (dev, dev->fd, -(CKDDASD_RECHDR_SIZE), SEEK_CUR);
+ rc = ckd_lseek (dev, dev->fd, -(off_t)(CKDDASD_RECHDR_SIZE), SEEK_CUR);
if (rc == -1)
{
#ifdef OPTION_SYNCIO

View File

@ -0,0 +1,12 @@
--- Makefile.am Tue Oct 30 16:44:39 2001
+++ Makefile.am Mon Mar 11 02:44:03 2002
@@ -93,8 +93,8 @@
tar: dist
+install-exec-local:
if SETUID_HERCIFC
-install-exec-local:
chown root $(DESTDIR)$(bindir)/hercifc
chmod 0751 $(DESTDIR)$(bindir)/hercifc
chmod +s $(DESTDIR)$(bindir)/hercifc

View File

@ -0,0 +1,50 @@
diff -uNr configure.ac
--- configure.ac Wed Dec 19 07:20:00 2001
+++ configure.ac Thu Jan 17 22:50:57 2002
@@ -72,6 +72,19 @@
AM_CONDITIONAL(BUILD_FTHREADS, [test x$build_fthreads = xtrue])
+dnl AC_MSG_NOTICE([Checking to see if -pthread is needed to compile])
+
+AC_MSG_CHECKING([wether ${CC-cc} accepts -pthread])
+
+echo 'void f(){}' >conftest.c
+if test -z "`${CC-cc} -pthread -c conftest.c 2>&1`"; then
+ LIBS="-pthread $LIBS"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+rm -f conftest*
+
# Headers
AC_CHECK_HEADERS(byteswap.h)
AC_CHECK_HEADER(fenv.h,,[AC_DEFINE([NO_IEEE_SUPPORT])])
@@ -105,6 +118,16 @@
[AC_DEFINE([HAVE_U_INT])],
[AC_MSG_ERROR([Unable to find fixed-size data types])] )] )
+dnl AC_MSG_NOTICE([Checking for SCSI tape support and what type])
+AC_CHECK_HEADER(sys/mtio.h,
+ [AC_DEFINE([HAVE_MTIO_H])])
+
+AC_TRY_COMPILE([#include mtio.h],
+ [mtget test;
+ int result;
+ result = test.mt_gstat; ],
+ [AC_DEFINE([GNU_MTIO_SUPPORT])])
+
# Compiler characteristics
AC_C_BIGENDIAN
@@ -306,5 +329,9 @@
[Define to provide additional information about this build])
AH_TEMPLATE([DEBUG],
[Define to enable extra debugging code])
+AH_TEMPLATE([HAVE_MTIO_H],
+ [Define if your system has sys/mtio.h])
+AH_TEMPLATE([GNU_MTIO_SUPPORT],
+ [Define if you have the GNU version of mtio.h (Linux)])
AC_OUTPUT(Makefile util/Makefile html/Makefile)

View File

@ -0,0 +1,11 @@
diff -uNr hercules.h
--- hercules.h Wed Dec 19 07:18:17 2001
+++ hercules.h Tue Jan 15 20:26:56 2002
@@ -215,6 +215,7 @@
pthread_cond_timedwait((pcond),(plk),(timeout))
#define initialize_detach_attr(pat) \
pthread_attr_init((pat)); \
+ pthread_attr_setstacksize((pat),1048576); \
pthread_attr_setdetachstate((pat),PTHREAD_CREATE_DETACHED)
typedef void*THREAD_FUNC(void*);
#define create_thread(ptid,pat,fn,arg) \

View File

@ -0,0 +1,64 @@
diff -uNr tapecopy.c
--- tapecopy.c Thu Nov 29 07:53:46 2001
+++ tapecopy.c Thu Jan 17 14:04:09 2002
@@ -32,6 +32,7 @@
static BYTE hdrlbl[] = "\xC8\xC4\xD9"; /* EBCDIC characters "HDR" */
static BYTE eoflbl[] = "\xC5\xD6\xC6"; /* EBCDIC characters "EOF" */
static BYTE eovlbl[] = "\xC5\xD6\xE5"; /* EBCDIC characters "EOV" */
+#ifdef GNU_MTIO_SUPPORT
static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
static struct mt_tape_info densinfo[] = {
{0x01, "NRZI (800 bpi)"},
@@ -59,6 +60,7 @@
{0x8C, "EXB-8505 compressed"},
{0x90, "EXB-8205 compressed"},
{0, NULL}};
+#endif
static BYTE buf[65500];
/*-------------------------------------------------------------------*/
@@ -71,6 +73,7 @@
/*-------------------------------------------------------------------*/
static void print_status (BYTE *devname, long stat)
{
+#ifdef GNU_MTIO_SUPPORT
printf ("%s status: %8.8lX", devname, stat);
if (GMT_EOF(stat)) printf (" EOF");
if (GMT_BOT(stat)) printf (" BOT");
@@ -84,6 +87,7 @@
if (GMT_D_800(stat)) printf (" 800");
if (GMT_DR_OPEN(stat)) printf (" NOTAPE");
printf ("\n");
+#endif
} /* end function print_status */
@@ -104,10 +108,12 @@
return -1;
}
+#ifdef GNU_MTIO_SUPPORT
print_status (devname, stblk.mt_gstat);
if (GMT_EOD(stblk.mt_gstat)) return 1;
if (GMT_EOT(stblk.mt_gstat)) return 1;
+#endif
return 0;
} /* end function print_status */
@@ -174,6 +180,7 @@
exit (7);
}
+#ifdef GNU_MTIO_SUPPORT
/* Display tape status information */
for (i = 0; tapeinfo[i].t_type != 0
&& tapeinfo[i].t_type != stblk.mt_type; i++);
@@ -201,6 +208,7 @@
/* Set the tape device to process variable length blocks */
opblk.mt_op = MTSETBLK;
+#endif
opblk.mt_count = 0;
rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
if (rc < 0)

View File

@ -0,0 +1,276 @@
diff -uNr tapedev.c
--- tapedev.c Tue Nov 20 17:39:47 2001
+++ tapedev.c Thu Jan 17 15:07:35 2002
@@ -194,6 +194,7 @@
/*-------------------------------------------------------------------*/
/* Static data areas */
/*-------------------------------------------------------------------*/
+#ifdef GNU_MTIO_SUPPORT
static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
static struct mt_tape_info densinfo[] = {
{0x01, "NRZI (800 bpi)"},
@@ -221,6 +222,7 @@
{0x8C, "EXB-8505 compressed"},
{0x90, "EXB-8205 compressed"},
{0, NULL}};
+#endif
static PARSER ptab[] =
{
@@ -1142,6 +1144,7 @@
/*-------------------------------------------------------------------*/
static U32 status_scsitape (DEVBLK *dev)
{
+#ifdef HAVE_MTIO_H
U32 stat; /* Tape status bits */
int rc; /* Return code */
struct mtget stblk; /* Area for MTIOCGET ioctl */
@@ -1158,6 +1161,7 @@
dev->filename, strerror(errno));
return 0;
}
+#ifdef GNU_MTIO_SUPPORT
stat = stblk.mt_gstat;
/* Display tape status */
@@ -1190,10 +1194,14 @@
dev->prvblkpos = -1;
dev->blockid = 0;
}
+#else
+ stat = 0;
+#endif
/* Return tape status */
return stat;
+#endif
} /* end function status_scsitape */
/*-------------------------------------------------------------------*/
@@ -1204,6 +1212,7 @@
/*-------------------------------------------------------------------*/
static int open_scsitape (DEVBLK *dev, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
int i; /* Array subscript */
struct mtop opblk; /* Area for MTIOCTOP ioctl */
@@ -1248,6 +1257,7 @@
return -1;
}
+#ifdef GNU_MTIO_SUPPORT
/* Intervention required if no tape is mounted */
if (GMT_DR_OPEN(stblk.mt_gstat))
{
@@ -1283,6 +1293,7 @@
/* Set the tape device to process variable length blocks */
opblk.mt_op = MTSETBLK;
+#endif
opblk.mt_count = 0;
rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
if (rc < 0)
@@ -1311,6 +1322,12 @@
return 0;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function open_scsitape */
/*-------------------------------------------------------------------*/
@@ -1323,6 +1340,7 @@
/*-------------------------------------------------------------------*/
static int read_scsitape (DEVBLK *dev, BYTE *buf, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
/* Read data block from SCSI tape device */
@@ -1346,6 +1364,12 @@
/* Return block length or zero if tapemark */
return rc;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function read_scsitape */
/*-------------------------------------------------------------------*/
@@ -1357,6 +1381,7 @@
static int write_scsitape (DEVBLK *dev, BYTE *buf, U16 len,
BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
/* Write data block to SCSI tape device */
@@ -1376,6 +1401,12 @@
/* Return normal status */
return 0;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function write_scsitape */
/*-------------------------------------------------------------------*/
@@ -1386,6 +1417,7 @@
/*-------------------------------------------------------------------*/
static int write_scsimark (DEVBLK *dev, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
struct mtop opblk; /* Area for MTIOCTOP ioctl */
@@ -1408,6 +1440,12 @@
/* Return normal status */
return 0;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function write_scsimark */
/*-------------------------------------------------------------------*/
@@ -1420,6 +1458,7 @@
/*-------------------------------------------------------------------*/
static int fsb_scsitape (DEVBLK *dev, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
int fsrerrno; /* Value of errno after MTFSR*/
U32 stat; /* Tape status bits */
@@ -1434,6 +1473,7 @@
/* Obtain tape status after forward space */
stat = status_scsitape (dev);
+#ifdef GNU_MTIO_SUPPORT
/* If I/O error and status indicates EOF, then a tapemark
was detected, so increment the file number and return 0 */
if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat))
@@ -1442,6 +1482,7 @@
dev->blockid++;
return 0;
}
+#endif
/* Handle MTFSR error condition */
if (rc < 0)
@@ -1460,6 +1501,12 @@
/* Return +1 to indicate forward space successful */
return +1;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function fsb_scsitape */
/*-------------------------------------------------------------------*/
@@ -1472,6 +1519,7 @@
/*-------------------------------------------------------------------*/
static int bsb_scsitape (DEVBLK *dev, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
int bsrerrno; /* Value of errno after MTBSR*/
U32 stat; /* Tape status bits */
@@ -1480,6 +1528,7 @@
/* Obtain tape status before backward space */
stat = status_scsitape (dev);
+#ifdef GNU_MTIO_SUPPORT
/* Unit check if already at start of tape */
if (GMT_BOT(stat))
{
@@ -1488,6 +1537,7 @@
*unitstat = CSW_CE | CSW_DE | CSW_UC;
return -1;
}
+#endif
/* Backspace block on SCSI tape */
opblk.mt_op = MTBSR;
@@ -1526,6 +1576,12 @@
/* Return +1 to indicate backspace successful */
return +1;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function bsb_scsitape */
/*-------------------------------------------------------------------*/
@@ -1537,6 +1593,7 @@
/*-------------------------------------------------------------------*/
static int fsf_scsitape (DEVBLK *dev, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
struct mtop opblk; /* Area for MTIOCTOP ioctl */
@@ -1562,6 +1619,12 @@
/* Return normal status */
return 0;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function fsf_scsitape */
/*-------------------------------------------------------------------*/
@@ -1573,6 +1636,7 @@
/*-------------------------------------------------------------------*/
static int bsf_scsitape (DEVBLK *dev, BYTE *unitstat)
{
+#ifdef HAVE_MTIO_H
int rc; /* Return code */
struct mtop opblk; /* Area for MTIOCTOP ioctl */
@@ -1599,6 +1663,12 @@
/* Return normal status */
return 0;
+#else
+
+ logmsg ("HHC286I SCSI Support is disabled\n");
+ return -1;
+
+#endif
} /* end function bsf_scsitape */
/*-------------------------------------------------------------------*/
@@ -2725,7 +2795,9 @@
case TAPEDEVT_SCSITAPE:
stat = status_scsitape (dev);
+#ifdef GNU_MTIO_SUPPORT
if (GMT_BOT(stat)) dev->sense[1] |= SENSE1_TAPE_LOADPT;
+#endif
break;
case TAPEDEVT_OMATAPE:

View File

@ -0,0 +1,18 @@
diff -uNr version.c
--- version.c Thu Nov 29 08:05:47 2001
+++ version.c Thu Jan 17 14:10:55 2002
@@ -77,6 +77,14 @@
"No HET BZIP2 support",
#endif
+#if defined(GNU_MTIO_SUPPORT)
+ "Using GNU tape handling",
+#elif defined(HAVE_MTIO_H)
+ "Using generic Unix tape handling",
+#else
+ "No SCSI tape support",
+#endif
+
#if defined(CUSTOM_BUILD_STRING)
CUSTOM_BUILD_STRING,
#endif

View File

@ -1,363 +0,0 @@
--- tapecopy.c.orig Thu Nov 29 13:53:46 2001
+++ tapecopy.c Thu Jan 31 13:26:01 2002
@@ -8,357 +8,18 @@
/* prints a summary of the tape files and blocksizes. */
/*-------------------------------------------------------------------*/
-#include "hercules.h"
-
-/*-------------------------------------------------------------------*/
-/* Structure definition for AWSTAPE block header */
-/*-------------------------------------------------------------------*/
-typedef struct _AWSTAPE_BLKHDR {
- HWORD curblkl; /* Length of this block */
- HWORD prvblkl; /* Length of previous block */
- BYTE flags1; /* Flags byte 1 */
- BYTE flags2; /* Flags byte 2 */
- } AWSTAPE_BLKHDR;
-
-/* Definitions for AWSTAPE_BLKHDR flags byte 1 */
-#define AWSTAPE_FLAG1_NEWREC 0x80 /* Start of new record */
-#define AWSTAPE_FLAG1_TAPEMARK 0x40 /* Tape mark */
-#define AWSTAPE_FLAG1_ENDREC 0x20 /* End of record */
-
-/*-------------------------------------------------------------------*/
-/* Static data areas */
-/*-------------------------------------------------------------------*/
-static BYTE vollbl[] = "\xE5\xD6\xD3"; /* EBCDIC characters "VOL" */
-static BYTE hdrlbl[] = "\xC8\xC4\xD9"; /* EBCDIC characters "HDR" */
-static BYTE eoflbl[] = "\xC5\xD6\xC6"; /* EBCDIC characters "EOF" */
-static BYTE eovlbl[] = "\xC5\xD6\xE5"; /* EBCDIC characters "EOV" */
-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
-static struct mt_tape_info densinfo[] = {
- {0x01, "NRZI (800 bpi)"},
- {0x02, "PE (1600 bpi)"},
- {0x03, "GCR (6250 bpi)"},
- {0x05, "QIC-45/60 (GCR, 8000 bpi)"},
- {0x06, "PE (3200 bpi)"},
- {0x07, "IMFM (6400 bpi)"},
- {0x08, "GCR (8000 bpi)"},
- {0x09, "GCR /37871 bpi)"},
- {0x0A, "MFM (6667 bpi)"},
- {0x0B, "PE (1600 bpi)"},
- {0x0C, "GCR (12960 bpi)"},
- {0x0D, "GCR (25380 bpi)"},
- {0x0F, "QIC-120 (GCR 10000 bpi)"},
- {0x10, "QIC-150/250 (GCR 10000 bpi)"},
- {0x11, "QIC-320/525 (GCR 16000 bpi)"},
- {0x12, "QIC-1350 (RLL 51667 bpi)"},
- {0x13, "DDS (61000 bpi)"},
- {0x14, "EXB-8200 (RLL 43245 bpi)"},
- {0x15, "EXB-8500 (RLL 45434 bpi)"},
- {0x16, "MFM 10000 bpi"},
- {0x17, "MFM 42500 bpi"},
- {0x24, "DDS-2"},
- {0x8C, "EXB-8505 compressed"},
- {0x90, "EXB-8205 compressed"},
- {0, NULL}};
-static BYTE buf[65500];
-
-/*-------------------------------------------------------------------*/
-/* ASCII to EBCDIC translate tables */
-/*-------------------------------------------------------------------*/
-#include "codeconv.h"
-
-/*-------------------------------------------------------------------*/
-/* Subroutine to print tape status */
-/*-------------------------------------------------------------------*/
-static void print_status (BYTE *devname, long stat)
-{
- printf ("%s status: %8.8lX", devname, stat);
- if (GMT_EOF(stat)) printf (" EOF");
- if (GMT_BOT(stat)) printf (" BOT");
- if (GMT_EOT(stat)) printf (" EOT");
- if (GMT_SM(stat)) printf (" SETMARK");
- if (GMT_EOD(stat)) printf (" EOD");
- if (GMT_WR_PROT(stat)) printf (" WRPROT");
- if (GMT_ONLINE(stat)) printf (" ONLINE");
- if (GMT_D_6250(stat)) printf (" 6250");
- if (GMT_D_1600(stat)) printf (" 1600");
- if (GMT_D_800(stat)) printf (" 800");
- if (GMT_DR_OPEN(stat)) printf (" NOTAPE");
- printf ("\n");
-
-} /* end function print_status */
-
-/*-------------------------------------------------------------------*/
-/* Subroutine to obtain and print tape status */
-/* Return value: 0=normal, 1=end of tape, -1=error */
-/*-------------------------------------------------------------------*/
-static int obtain_status (BYTE *devname, int devfd)
-{
-int rc; /* Return code */
-struct mtget stblk; /* Area for MTIOCGET ioctl */
-
- rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
- if (rc < 0)
- {
- printf ("tapecopy: Error reading status of %s: %s\n",
- devname, strerror(errno));
- return -1;
- }
-
- print_status (devname, stblk.mt_gstat);
-
- if (GMT_EOD(stblk.mt_gstat)) return 1;
- if (GMT_EOT(stblk.mt_gstat)) return 1;
-
- return 0;
-} /* end function print_status */
/*-------------------------------------------------------------------*/
/* TAPECOPY main entry point */
/*-------------------------------------------------------------------*/
int main (int argc, char *argv[])
{
-int rc; /* Return code */
-int i; /* Array subscript */
-int len; /* Block length */
-int prevlen; /* Previous block length */
-BYTE *devname; /* -> Tape device name */
-BYTE *filename; /* -> Output file name */
-int devfd; /* Tape file descriptor */
-int outfd = -1; /* Output file descriptor */
-int fileno; /* Tape file number */
-int blkcount; /* Block count */
-int minblksz; /* Minimum block size */
-int maxblksz; /* Maximum block size */
-struct mtop opblk; /* Area for MTIOCTOP ioctl */
-struct mtget stblk; /* Area for MTIOCGET ioctl */
-long density; /* Tape density code */
-BYTE labelrec[81]; /* Standard label (ASCIIZ) */
-AWSTAPE_BLKHDR awshdr; /* AWSTAPE block header */
-
- /* Display the program identification message */
- display_version (stderr, "Hercules tape copy program ");
-
- /* The first argument is the tape device name */
- if (argc > 1 && argv[1] != NULL && strlen(argv[1]) > 5
- && memcmp (argv[1], "/dev/", 5) == 0)
- {
- devname = argv[1];
- }
- else
- {
- printf ("Usage: tapecopy /dev/st0 [outfile]\n");
- exit (1);
- }
-
- /* The second argument is the output file name */
- if (argc > 2 && argv[2] != NULL)
- filename = argv[2];
- else
- filename = NULL;
-
- /* Open the tape device */
- devfd = open (devname, O_RDONLY|O_BINARY);
- if (devfd < 0)
- {
- printf ("tapecopy: Error opening %s: %s\n",
- devname, strerror(errno));
- exit (3);
- }
- /* Obtain the tape status */
- rc = ioctl (devfd, MTIOCGET, (char*)&stblk);
- if (rc < 0)
- {
- printf ("tapecopy: Error reading status of %s: %s\n",
- devname, strerror(errno));
- exit (7);
- }
- /* Display tape status information */
- for (i = 0; tapeinfo[i].t_type != 0
- && tapeinfo[i].t_type != stblk.mt_type; i++);
-
- if (tapeinfo[i].t_name != NULL)
- printf ("%s device type: %s\n", devname, tapeinfo[i].t_name);
- else
- printf ("%s device type: 0x%lX\n", devname, stblk.mt_type);
-
- density = (stblk.mt_dsreg & MT_ST_DENSITY_MASK)
- >> MT_ST_DENSITY_SHIFT;
-
- for (i = 0; densinfo[i].t_type != 0
- && densinfo[i].t_type != density; i++);
-
- if (densinfo[i].t_name != NULL)
- printf ("%s tape density: %s\n", devname, densinfo[i].t_name);
- else
- printf ("%s tape density code: 0x%lX\n", devname, density);
-
- if (stblk.mt_gstat != 0)
- {
- print_status (devname, stblk.mt_gstat);
- }
-
- /* Set the tape device to process variable length blocks */
- opblk.mt_op = MTSETBLK;
- opblk.mt_count = 0;
- rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
- if (rc < 0)
- {
- printf ("tapecopy: Error setting attributes for %s: %s\n",
- devname, strerror(errno));
- exit (5);
- }
-
- /* Rewind the tape to the beginning */
- opblk.mt_op = MTREW;
- opblk.mt_count = 1;
- rc = ioctl (devfd, MTIOCTOP, (char*)&opblk);
- if (rc < 0)
- {
- printf ("tapecopy: Error rewinding %s: %s\n",
- devname, strerror(errno));
- exit (6);
- }
-
- /* Open the output file */
- if (filename != NULL)
- {
- outfd = open (filename, O_WRONLY | O_CREAT | O_BINARY,
- S_IRUSR | S_IWUSR | S_IRGRP);
- if (outfd < 0)
- {
- printf ("tapecopy: Error opening %s: %s\n",
- filename, strerror(errno));
- exit (4);
- }
- }
-
- /* Copy blocks from tape to the output file */
- fileno = 1;
- blkcount = 0;
- minblksz = 0;
- maxblksz = 0;
- len = 0;
-
- while (1)
- {
- /* Save previous block length */
- prevlen = len;
-
- /* Read a block from the tape */
- len = read (devfd, buf, sizeof(buf));
- if (len < 0)
- {
- printf ("tapecopy: Error reading %s: %s\n",
- devname, strerror(errno));
- obtain_status (devname, devfd);
- exit (8);
- }
-
- /* Check for tape mark */
- if (len == 0)
- {
- /* Print summary of current file */
- printf ("File %u: Blocks=%u, block size min=%u, max=%u\n",
- fileno, blkcount, minblksz, maxblksz);
-
- /* Write tape mark to output file */
- if (outfd >= 0)
- {
- /* Build block header for tape mark */
- awshdr.curblkl[0] = 0;
- awshdr.curblkl[1] = 0;
- awshdr.prvblkl[0] = prevlen & 0xFF;
- awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF;
- awshdr.flags1 = AWSTAPE_FLAG1_TAPEMARK;
- awshdr.flags2 = 0;
-
- /* Write block header to output file */
- rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR));
- if (rc < sizeof(AWSTAPE_BLKHDR))
- {
- printf ("tapecopy: Error writing %s: %s\n",
- filename, strerror(errno));
- exit (9);
- } /* end if(rc) */
-
- } /* end if(outfd) */
-
- /* Reset counters for next file */
- fileno++;
- minblksz = 0;
- maxblksz = 0;
- blkcount = 0;
-
- /* Determine whether end of tape has been read */
- rc = obtain_status (devname, devfd);
- if (rc == 0) continue;
- if (rc > 0) printf ("End of tape\n");
- break;
-
- } /* end if(tapemark) */
-
- /* Count blocks and block sizes */
- blkcount++;
- if (len > maxblksz) maxblksz = len;
- if (minblksz == 0 || len < minblksz) minblksz = len;
-
- /* Print standard labels */
- if (len == 80 && blkcount < 4
- && (memcmp(buf, vollbl, 3) == 0
- || memcmp(buf, hdrlbl, 3) == 0
- || memcmp(buf, eoflbl, 3) == 0
- || memcmp(buf, eovlbl, 3) == 0))
- {
- for (i=0; i < 80; i++)
- labelrec[i] = ebcdic_to_ascii[buf[i]];
- labelrec[i] = '\0';
- printf ("%s\n", labelrec);
- }
- else
- {
- printf ("File %u: Block %u\r", fileno, blkcount);
- }
-
- /* Write block to output file */
- if (outfd >= 0)
- {
- /* Build the block header */
- awshdr.curblkl[0] = len & 0xFF;
- awshdr.curblkl[1] = (len >> 8) & 0xFF;
- awshdr.prvblkl[0] = prevlen & 0xFF;
- awshdr.prvblkl[1] = (prevlen >> 8) & 0xFF;
- awshdr.flags1 = AWSTAPE_FLAG1_NEWREC
- | AWSTAPE_FLAG1_ENDREC;
- awshdr.flags2 = 0;
-
- /* Write block header to output file */
- rc = write (outfd, &awshdr, sizeof(AWSTAPE_BLKHDR));
- if (rc < sizeof(AWSTAPE_BLKHDR))
- {
- printf ("tapecopy: Error writing %s: %s\n",
- filename, strerror(errno));
- exit (10);
- } /* end if(rc) */
-
- /* Write data block to output file */
- rc = write (outfd, buf, len);
- if (rc < len)
- {
- printf ("tapecopy: Error writing %s: %s\n",
- filename, strerror(errno));
- exit (11);
- } /* end if(rc) */
-
- } /* end if(outfd) */
-
- } /* end while */
-
- /* Close files and exit */
- close (devfd);
- if (filename != NULL) close (outfd);
+ /* Display the program identification message */
+
+ printf("Tape copy is broken, sorry\n");
return 0;
} /* end function main */

View File

@ -1,224 +0,0 @@
--- tapedev.c.orig Tue Nov 20 23:39:47 2001
+++ tapedev.c Thu Jan 31 13:06:43 2002
@@ -131,6 +131,11 @@
#define TAPEDEVT_SCSITAPE 3 /* Physical SCSI tape */
#define TAPEDEVT_HET 4 /* HET format disk file */
+/* Can you say totally b0rken? */
+#define MT_ST_DENSITY_MASK 1
+#define MT_TAPE_INFO 2
+#define MTSETBLK 3
+#define MT_ST_DENSITY_SHIFT 4
/*-------------------------------------------------------------------*/
/* Structure definition for tape block headers */
/*-------------------------------------------------------------------*/
@@ -194,7 +199,10 @@
/*-------------------------------------------------------------------*/
/* Static data areas */
/*-------------------------------------------------------------------*/
-static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
+
+
+/* static struct mt_tape_info tapeinfo[] = MT_TAPE_INFO;
+
static struct mt_tape_info densinfo[] = {
{0x01, "NRZI (800 bpi)"},
{0x02, "PE (1600 bpi)"},
@@ -221,7 +229,7 @@
{0x8C, "EXB-8505 compressed"},
{0x90, "EXB-8205 compressed"},
{0, NULL}};
-
+*/
static PARSER ptab[] =
{
{ "awstape", NULL },
@@ -1151,6 +1159,7 @@
if (dev->fd < 0) return 0;
/* Obtain tape status */
+/*
rc = ioctl (dev->fd, MTIOCGET, (char*)&stblk);
if (rc < 0)
{
@@ -1159,8 +1168,9 @@
return 0;
}
stat = stblk.mt_gstat;
-
+*/
/* Display tape status */
+/*
if (dev->ccwtrace || dev->ccwstep)
{
sprintf (buf, "%s status: %8.8X", dev->filename, stat);
@@ -1177,10 +1187,11 @@
if (GMT_DR_OPEN(stat)) strcat (buf, " NOTAPE");
logmsg ("HHC215I %s\n", buf);
}
-
+*/
/* If tape has been ejected, then close the file because
the driver will not recognize that a new tape volume
has been mounted until the file is re-opened */
+/*
if (GMT_DR_OPEN(stat))
{
close (dev->fd);
@@ -1190,8 +1201,10 @@
dev->prvblkpos = -1;
dev->blockid = 0;
}
-
+*/
/* Return tape status */
+
+ fprintf(stderr,"Sorry, tape support is broken.\n");
return stat;
} /* end function status_scsitape */
@@ -1249,6 +1262,7 @@
}
/* Intervention required if no tape is mounted */
+/*
if (GMT_DR_OPEN(stblk.mt_gstat))
{
dev->sense[0] = SENSE_IR;
@@ -1256,8 +1270,9 @@
*unitstat = CSW_CE | CSW_DE | CSW_UC;
return -1;
}
-
+*/
/* Display tape status information */
+/*
for (i = 0; tapeinfo[i].t_type != 0
&& tapeinfo[i].t_type != stblk.mt_type; i++);
@@ -1280,8 +1295,9 @@
else
logmsg ("HHC221I %s tape density code: 0x%lX\n",
dev->filename, density);
-
+*/
/* Set the tape device to process variable length blocks */
+ /*
opblk.mt_op = MTSETBLK;
opblk.mt_count = 0;
rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
@@ -1294,8 +1310,9 @@
*unitstat = CSW_CE | CSW_DE | CSW_UC;
return -1;
}
-
+*/
/* Rewind the tape to the beginning */
+/*
opblk.mt_op = MTREW;
opblk.mt_count = 1;
rc = ioctl (dev->fd, MTIOCTOP, (char*)&opblk);
@@ -1308,7 +1325,7 @@
*unitstat = CSW_CE | CSW_DE | CSW_UC;
return -1;
}
-
+*/
return 0;
} /* end function open_scsitape */
@@ -1436,13 +1453,14 @@
/* If I/O error and status indicates EOF, then a tapemark
was detected, so increment the file number and return 0 */
+/*
if (rc < 0 && fsrerrno == EIO && GMT_EOF(stat))
{
dev->curfilen++;
dev->blockid++;
return 0;
}
-
+*/
/* Handle MTFSR error condition */
if (rc < 0)
{
@@ -1481,6 +1499,7 @@
stat = status_scsitape (dev);
/* Unit check if already at start of tape */
+/*
if (GMT_BOT(stat))
{
dev->sense[0] = 0;
@@ -1488,7 +1507,7 @@
*unitstat = CSW_CE | CSW_DE | CSW_UC;
return -1;
}
-
+*/
/* Backspace block on SCSI tape */
opblk.mt_op = MTBSR;
opblk.mt_count = 1;
@@ -2703,12 +2722,15 @@
U32 stat; /* SCSI tape status bits */
/* Indicate intervention required if no file */
+/*
if (!strcmp (dev->filename, TAPE_UNLOADED))
dev->sense[0] |= SENSE_IR;
if (!(dev->fd < 0))
{
+ */
/* Set load point indicator if tape is at load point */
+/*
dev->sense[1] &= ~SENSE1_TAPE_LOADPT;
switch (dev->tapedevt)
{
@@ -2732,41 +2754,14 @@
if (dev->nxtblkpos == 0 && dev->curfilen == 1)
dev->sense[1] |= SENSE1_TAPE_LOADPT;
break;
- } /* end switch(dev->tapedevt) */
- } /* !(fd < 0) */
+ }
+ */
+ /* end switch(dev->tapedevt) */
+
/* Indicate Drive online to control unit */
- dev->sense[1] |= SENSE1_TAPE_TUA;
- /* Set file protect indicator if read-only file */
- if (dev->readonly)
- dev->sense[1] |= SENSE1_TAPE_FP;
- else
- dev->sense[1] &= ~SENSE1_TAPE_FP;
- /* Set Error Recovery Action Code */
- if (dev->sense[0] & SENSE_IR)
- dev->sense[3] = 0x43;
- else if (dev->sense[0] & SENSE_CR)
- dev->sense[3] = 0x27;
- else if (dev->sense[1] & SENSE1_TAPE_FP)
- dev->sense[3] = 0x30;
- else
- dev->sense[3] = 0x29;
-
- /* Set sense bytes for 3420 */
- if (dev->devtype != 0x3480)
- {
-// dev->sense[4] |= 0x20;
- dev->sense[5] |= 0xC0;
- dev->sense[6] |= 0x03;
- dev->sense[13] = 0x80;
- dev->sense[14] = 0x01;
- dev->sense[15] = 0x00;
- dev->sense[16] = 0x01;
- dev->sense[19] = 0xFF;
- dev->sense[20] = 0xFF;
- }
} /* end function build_sense */

View File

@ -1,8 +1,6 @@
######################################################################
IMPORTANT
Tape operations and tapecopy are broken in this port (contain Linux
specific code that has not yet been adapted).
Be sure to have a look at the docs and edit the hercules.cnf file to
your needs (The sample is in ${PREFIX}/share/doc/hercules)

View File

@ -17,15 +17,15 @@ bin/hetupd
bin/tapecopy
bin/tapemap
bin/tapesplt
share/doc/hercules/cckddasd.html
share/doc/hercules/hercconf.html
share/doc/hercules/hercfaq.html
share/doc/hercules/hercinst.html
share/doc/hercules/herclic.html
share/doc/hercules/hercload.html
share/doc/hercules/hercnew.html
share/doc/hercules/herctcp.html
share/doc/hercules/hercules.cnf
share/doc/hercules/hercules.css
share/doc/hercules/index.html
@dirrm share/doc/hercules
%%PORTDOCS%%share/doc/hercules/cckddasd.html
%%PORTDOCS%%share/doc/hercules/hercconf.html
%%PORTDOCS%%share/doc/hercules/hercfaq.html
%%PORTDOCS%%share/doc/hercules/hercinst.html
%%PORTDOCS%%share/doc/hercules/herclic.html
%%PORTDOCS%%share/doc/hercules/hercload.html
%%PORTDOCS%%share/doc/hercules/hercnew.html
%%PORTDOCS%%share/doc/hercules/herctcp.html
%%PORTDOCS%%share/doc/hercules/hercules.cnf
%%PORTDOCS%%share/doc/hercules/hercules.css
%%PORTDOCS%%share/doc/hercules/index.html
%%PORTDOCS%%@dirrm share/doc/hercules