Import of pkgsrc-2015Q3

This commit is contained in:
2015-10-03 03:37:01 -07:00
committed by Lionel Sambuc
parent f641581404
commit 9d819b6d54
7578 changed files with 228314 additions and 80018 deletions

10
sysutils/mtx/DESCR Normal file
View File

@@ -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.

17
sysutils/mtx/Makefile Normal file
View File

@@ -0,0 +1,17 @@
# $NetBSD: Makefile,v 1.2 2015/07/14 12:25:36 bouyer Exp $
DISTNAME= mtx-1.3.12
PKGREVISION= 1
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"

10
sysutils/mtx/PLIST Normal file
View File

@@ -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

9
sysutils/mtx/distinfo Normal file
View File

@@ -0,0 +1,9 @@
$NetBSD: distinfo,v 1.3 2015/07/14 12:25:36 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) = 4a526c1b362c08a7c5bd5a39b16ecf336e4b31c1
SHA1 (patch-mtx.h) = 0b1a35ea5dc4dd639cf2bdc79bcfb06d2a551427
SHA1 (patch-mtxl.c) = 6e1318d3501d49c670439da36f3654fc0e6d54f2
SHA1 (patch-scsi_netbsd.c) = 8b14d7553965e303aa2fe693aaa5c9d94d8e7b24

View File

@@ -0,0 +1,35 @@
$NetBSD: patch-Makefile.in,v 1.2 2015/07/10 13:33:41 bouyer Exp $
Fix DESTDIR support
--- 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:

View File

@@ -0,0 +1,18 @@
$NetBSD: patch-mtx.h,v 1.2 2015/07/10 13:33:41 bouyer Exp $
--- 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

View File

@@ -0,0 +1,15 @@
$NetBSD: patch-mtxl.c,v 1.2 2015/07/10 13:33:41 bouyer Exp $
--- 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"

View File

@@ -0,0 +1,162 @@
$NetBSD: patch-scsi_netbsd.c,v 1.3 2015/07/14 12:25:36 bouyer Exp $
--- scsi_netbsd.c.orig 2015-07-14 13:48:44.000000000 +0200
+++ scsi_netbsd.c 2015-07-14 13:58:53.000000000 +0200
@@ -0,0 +1,157 @@
+/* Changes 2003 Steve Heck <steve.heck@am.sony.com>
+ Copyright 2007-2008 by Robert Nelson <robertn@the-nelsons.org>
+
+ 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);
+ SCSI_Default_Timeout(); /* set it back to default, sigh. */
+
+ 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;
+}