diff options
author | bouyer <bouyer@pkgsrc.org> | 2015-07-09 10:27:39 +0000 |
---|---|---|
committer | bouyer <bouyer@pkgsrc.org> | 2015-07-09 10:27:39 +0000 |
commit | ecace4bbb684b03d7a8c985e17845259f1dba21d (patch) | |
tree | 8a266ac64a788263a3553c158d51d961d0e5d4e9 /sysutils/mtx | |
parent | b6bf33756b426420b6155d9644d192e6e57acd5f (diff) | |
download | pkgsrc-ecace4bbb684b03d7a8c985e17845259f1dba21d.tar.gz |
Import mtx version 1.3.12 to pkgsrc, based on the FreeBSD port.
Mtx(1) is a set of low level driver programs to control features of SCSI
backup related devices such as autoloaders, tape changers, mediajukeboxes,
and tape drives. It can also report much data, including serial numbers,
maximum block sizes, and TapeAlert(tm) messages that most modern tape
drives implement, as well as do raw SCSI READ and WRITE commands to
tape drives.
It works like chio(1) but supports more features and drives and runs in
users land. There are some amanda (sysutils/amanda-server) scripts, which
depend on mtx.
Diffstat (limited to 'sysutils/mtx')
-rw-r--r-- | sysutils/mtx/DESCR | 10 | ||||
-rw-r--r-- | sysutils/mtx/Makefile | 16 | ||||
-rw-r--r-- | sysutils/mtx/PLIST | 10 | ||||
-rw-r--r-- | sysutils/mtx/distinfo | 9 | ||||
-rw-r--r-- | sysutils/mtx/patches/patch-Makefile.in | 31 | ||||
-rw-r--r-- | sysutils/mtx/patches/patch-mtx.h | 16 | ||||
-rw-r--r-- | sysutils/mtx/patches/patch-mtxl.c | 13 | ||||
-rw-r--r-- | sysutils/mtx/patches/patch-scsi_netbsd.c | 162 |
8 files changed, 267 insertions, 0 deletions
diff --git a/sysutils/mtx/DESCR b/sysutils/mtx/DESCR new file mode 100644 index 00000000000..f8a17c204aa --- /dev/null +++ b/sysutils/mtx/DESCR @@ -0,0 +1,10 @@ +Mtx(1) is a set of low level driver programs to control features of SCSI +backup related devices such as autoloaders, tape changers, mediajukeboxes, +and tape drives. It can also report much data, including serial numbers, +maximum block sizes, and TapeAlert(tm) messages that most modern tape +drives implement, as well as do raw SCSI READ and WRITE commands to +tape drives. + +It works like chio(1) but supports more features and drives and runs in +users land. There are some amanda (sysutils/amanda-server) scripts, which +depend on mtx. diff --git a/sysutils/mtx/Makefile b/sysutils/mtx/Makefile new file mode 100644 index 00000000000..6ec8c9ce76a --- /dev/null +++ b/sysutils/mtx/Makefile @@ -0,0 +1,16 @@ +# $NetBSD: Makefile,v 1.1.1.1 2015/07/09 10:27:39 bouyer Exp $ + +DISTNAME= mtx-1.3.12 +CATEGORIES= sysutils +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=mtx/mtx-stable/1.3.12/} + +MAINTAINER= bouyer@NetBSD.org +HOMEPAGE= http://mtx.badtux.net/ +COMMENT= Control SCSI media changer devices + +USE_TOOLS+= gmake +GNU_CONFIGURE= yes + +LICENSE= gnu-gpl-v2 + +.include "../../mk/bsd.pkg.mk" diff --git a/sysutils/mtx/PLIST b/sysutils/mtx/PLIST new file mode 100644 index 00000000000..18351414df7 --- /dev/null +++ b/sysutils/mtx/PLIST @@ -0,0 +1,10 @@ +sbin/mtx +sbin/tapeinfo +sbin/loaderinfo +sbin/scsitape +sbin/scsieject +man/man1/loaderinfo.1 +man/man1/mtx.1 +man/man1/tapeinfo.1 +man/man1/scsitape.1 +man/man1/scsieject.1 diff --git a/sysutils/mtx/distinfo b/sysutils/mtx/distinfo new file mode 100644 index 00000000000..8be6b348ba5 --- /dev/null +++ b/sysutils/mtx/distinfo @@ -0,0 +1,9 @@ +$NetBSD: distinfo,v 1.1.1.1 2015/07/09 10:27:39 bouyer Exp $ + +SHA1 (mtx-1.3.12.tar.gz) = 9823426934261c9186ed5954f67068e44d3f7cf3 +RMD160 (mtx-1.3.12.tar.gz) = 7c9a762b489c1923e5508225cf8a5da8c53cc50f +Size (mtx-1.3.12.tar.gz) = 235214 bytes +SHA1 (patch-Makefile.in) = d503b4af0c3c4681ec8c0b46873715f32ccc3a98 +SHA1 (patch-mtx.h) = 5781cc7f2df760f1329a666ab00c81b6f69dcc3c +SHA1 (patch-mtxl.c) = f745d030caad76e8d73b88c9d494ae39fadf49db +SHA1 (patch-scsi_netbsd.c) = 80bdcf3cea4d654b1750401d8b575245a6719b27 diff --git a/sysutils/mtx/patches/patch-Makefile.in b/sysutils/mtx/patches/patch-Makefile.in new file mode 100644 index 00000000000..6a30494aafd --- /dev/null +++ b/sysutils/mtx/patches/patch-Makefile.in @@ -0,0 +1,31 @@ +--- Makefile.in.orig 2015-07-08 16:29:12.000000000 +0200 ++++ Makefile.in 2015-07-08 17:04:46.000000000 +0200 +@@ -62,6 +62,10 @@ + LIBS += -lcam + endif + ++ifeq ($(TARGET),netbsd) ++CPPFLAGS += -DLONG_PRINT_REQUEST_SENSE=1 ++endif ++ + ifeq ($(TARGET),hpux) + CFLAGS += -O -D_HPUX_SOURCE -D __hpux__ + endif +@@ -109,13 +113,13 @@ + dbgs: $(DBGS) + + install: $(BINS) +- $(INSTALL_DIR) $(sbindir) ++ $(INSTALL_DIR) ${DESTDIR}$(sbindir) + for file in $(BINS); do \ +- $(INSTALL_BIN) "$$file" $(sbindir) ; \ ++ $(INSTALL_BIN) "$$file" ${DESTDIR}$(sbindir) ; \ + done +- $(INSTALL_DIR) $(mandir) $(mandir)/man1 ++ $(INSTALL_DIR) ${DESTDIR}$(mandir) ${DESTDIR}$(mandir)/man1 + for file in mtx.1 tapeinfo.1 scsitape.1 scsieject.1 loaderinfo.1 ; do \ +- $(INSTALL_DOC) "$$file" $(mandir)/man1 ; \ ++ $(INSTALL_DOC) "$$file" ${DESTDIR}$(mandir)/man1 ; \ + done + + clean: diff --git a/sysutils/mtx/patches/patch-mtx.h b/sysutils/mtx/patches/patch-mtx.h new file mode 100644 index 00000000000..37d9e3fe93a --- /dev/null +++ b/sysutils/mtx/patches/patch-mtx.h @@ -0,0 +1,16 @@ +--- mtx.h.orig 2015-07-08 16:23:01.000000000 +0200 ++++ mtx.h 2015-07-08 16:24:24.000000000 +0200 +@@ -68,6 +68,13 @@ + # include <sys/param.h> + #endif + ++#ifdef __NetBSD__ ++/* use NetBSD's scsiio interface */ ++#include <sys/scsiio.h> ++typedef int DEVICE_TYPE; ++#endif ++ ++ + /* Now greatly modified to use GNU Autoconf stuff: */ + /* If we use the 'sg' interface, like Linux, do this: */ + #if HAVE_SCSI_SG_H diff --git a/sysutils/mtx/patches/patch-mtxl.c b/sysutils/mtx/patches/patch-mtxl.c new file mode 100644 index 00000000000..41ed6ade3b2 --- /dev/null +++ b/sysutils/mtx/patches/patch-mtxl.c @@ -0,0 +1,13 @@ +--- mtxl.c.orig 2015-07-08 16:25:32.000000000 +0200 ++++ mtxl.c 2015-07-08 16:26:04.000000000 +0200 +@@ -41,6 +41,10 @@ + + /* First, do some SCSI routines: */ + ++#ifdef __NetBSD__ ++# include "scsi_netbsd.c" ++#endif ++ + /* the camlib is used on FreeBSD. */ + #if HAVE_CAMLIB_H + # include "scsi_freebsd.c" diff --git a/sysutils/mtx/patches/patch-scsi_netbsd.c b/sysutils/mtx/patches/patch-scsi_netbsd.c new file mode 100644 index 00000000000..ea6a51a0618 --- /dev/null +++ b/sysutils/mtx/patches/patch-scsi_netbsd.c @@ -0,0 +1,162 @@ +--- /dev/null 2015-07-08 16:44:57.000000000 +0200 ++++ scsi_netbsd.c 2015-07-08 16:58:09.000000000 +0200 +@@ -0,0 +1,159 @@ ++/* Changes 2003 Steve Heck <steve.heck@am.sony.com> ++ Copyright 2007-2008 by Robert Nelson <robertn@the-nelsons.org> ++ ++$Date: 2015/07/09 10:27:39 $ ++$Revision: 1.1.1.1 $ ++ ++ This program is free software; you may redistribute and/or modify it under ++ the terms of the GNU General Public License Version 2 as published by the ++ Free Software Foundation. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ for complete details. ++ ++*/ ++ ++ ++/* This is the SCSI commands for NetBSD using scsiio Interface. */ ++ ++DEVICE_TYPE SCSI_OpenDevice(char *DeviceName) ++{ ++ int DeviceFD = open(DeviceName, O_RDWR, 0); ++ ++ if (DeviceFD < 0) ++ FatalError("cannot open SCSI device '%s' - %m\n", DeviceName); ++ return (DEVICE_TYPE) DeviceFD; ++} ++ ++ ++void SCSI_CloseDevice(char *DeviceName, DEVICE_TYPE DeviceFD) ++{ ++ if (close(DeviceFD) < 0) ++ FatalError("cannot close SCSI device '%s' - %m\n", DeviceName); ++} ++ ++ ++#define HAS_SCSI_TIMEOUT ++ ++static int timeout = 9 * 60; ++ ++void SCSI_Set_Timeout(int to) ++{ ++ timeout = to; ++} ++ ++void SCSI_Default_Timeout(void) ++{ ++ timeout = 9 * 60; /* the default */ ++} ++ ++#ifdef DEBUG ++int SCSI_DumpBuffer(int DataBufferLength, unsigned char *DataBuffer) ++{ ++ int i, j; ++ j = 0; ++ ++ for (i = 0; i < DataBufferLength; i++) ++ { ++ if (j == 25) ++ { ++ fprintf(stderr, "\n"); ++ j = 0; ++ } ++ ++ if (j == 0) ++ { ++ fprintf(stderr, "%04x:", i); ++ } ++ ++ if (j > 0) ++ { ++ fprintf(stderr, " "); ++ } ++ ++ fprintf(stderr, "%02x", (int)DataBuffer[i]); ++ j++; ++ } ++ fprintf(stderr, "\n"); ++} ++#endif ++ ++ ++ ++int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD, ++ Direction_T Direction, ++ CDB_T *CDB, ++ int CDB_Length, ++ void *DataBuffer, ++ int DataBufferLength, ++ RequestSense_T *RequestSense) ++{ ++ int ioctl_result; ++ scsireq_t req; ++ ++ ++#ifdef DEBUG_SCSI ++ fprintf(stderr,"------CDB--------\n"); ++ SCSI_DumpBuffer(CDB_Length,(char *)CDB); ++#endif ++ ++ memset(&req, 0, sizeof(scsireq_t)); ++ memset(RequestSense, 0, sizeof(RequestSense_T)); ++ switch (Direction) ++ { ++ case Input: ++ req.flags = SCCMD_READ; ++ if (DataBufferLength > 0) ++ { ++ memset(DataBuffer, 0, DataBufferLength); ++ } ++ break; ++ ++ case Output: ++ req.flags = SCCMD_WRITE; ++ break; ++ } ++ /* Set timeout to 5 minutes. */ ++#ifdef DEBUG_TIMEOUT ++ fprintf(stderr,"timeout=%d\n",timeout); ++ fflush(stderr); ++#endif ++ ++ req.timeout = timeout * 1000; ++ ++ memset(&req.cmd[0], 0, sizeof(req.cmd)); ++ memcpy(&req.cmd[0], CDB, CDB_Length); ++ req.cmdlen = CDB_Length; ++ ++ req.databuf = DataBuffer; ++ req.datalen = DataBufferLength; ++ ++ req.senselen = SENSEBUFLEN; ++ req.senselen_used = 0; ++ ioctl_result = ioctl(DeviceFD, SCIOCCOMMAND, &req); ++ ++ if (ioctl_result < 0) ++ { ++ perror("mtx: SCIOCCOMMAND"); ++ return ioctl_result; ++ } ++ if (req.senselen_used > 0) { ++ memcpy(RequestSense, &req.sense[0], ++ min(req.senselen_used, sizeof(RequestSense_T))); ++ } ++ ++ if (req.retsts != SCCMD_OK) ++ { ++ return -1; ++ } ++#ifdef DEBUG_SCSI ++ if (Direction==Input) ++ { ++ fprintf(stderr,"--------input data-----------\n"); ++ SCSI_DumpBuffer(DataBufferLength,DataBuffer); ++ } ++#endif ++ return 0; ++} |