3 Commits

Author SHA1 Message Date
Alexander Moibenko
3718d257b2 CentOS last version with applied patches. 2018-07-31 17:07:29 -05:00
Alexander Moibenko
efde4187b4 Squashed commit of the following:
commit 093eacf325
Author: Alexander Moibenko <moibenko@fnal.gov>
Date:   Tue Jul 31 16:48:21 2018 -0500

    Added patches.

commit ebdb735d13
Author: Alexander Moibenko <moibenko@fnal.gov>
Date:   Tue Jul 31 16:43:07 2018 -0500

    Spec and patches to build CentOS rpm 1.3.12-14

    Replace mtx.spec in SPECS
    Put *.patch into SOURCES
    and build rpm
2018-07-31 16:49:35 -05:00
Alexander Moibenko
4edb12f775 Spec and patches to build rpm 1.3.12-5
Replace mtx.spec in SPECS
    Put *.patch into SOURCES
    and build rpm.
2018-07-31 16:20:56 -05:00
13 changed files with 524 additions and 89 deletions

View File

@@ -33,6 +33,7 @@ INSTALL_DOC = $(INSTALL) -m 644
INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DIR = $(INSTALL) -m 755 -d
DESTDIR =
prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
@@ -109,13 +110,13 @@ all: $(BINS)
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

@@ -488,7 +488,6 @@ int main(int argc, char **argv)
argv0=argv[0];
if (argc != 3)
{
fprintf(stderr,"argc=%d",argc);
usage();
}

View File

@@ -131,13 +131,16 @@ may need to eject the tape using your OS's tape control commands
first). Note that this command may not be what you want on large
tape libraries -- e.g. on Exabyte 220, the first slot is usually a
cleaning tape. If <drivenum> is omitted, defaults to first drive.
.TP 10
.B last [<drivenum>]
Loads drive <drivenum> from the last slot in the media changer. Unloads
the drive if there is already a tape in it. (Note: you may need to eject
the tape using your OS's tape control commands first).
.TP 10
.B previous [<drivenum>]
Unloads the drive and loads the previous tape in sequence. If the drive
was empty, loads the first tape into the drive.
.TP 10
.B next [<drivenum>]
Unloads the drive and loads the next tape in sequence. If the drive was
empty, loads the first tape into the drive.
@@ -145,6 +148,9 @@ empty, loads the first tape into the drive.
.B position <slotnum>
Positions the robot at a specific slot. Needed by some changers to
move to and open the import/export, or mailbox, slot.
.TP 10
.B eject
Eject the tape currently in the drive.
.SH AUTHORS
The original 'mtx' program was written by Leonard Zubkoff and extensively

View File

@@ -1,94 +1,227 @@
Name: mtx
Version: 1.3.12
Release: 1%{?dist}
Release: 14%{?dist}
Summary: SCSI media changer control program
License: GPL
Group: Utilities/System
Source0: ftp://ftp.opensource-sw.net/pub/mtx/stable/%{name}-%{version}.tar.gz
Url: http://%{name}.sourceforge.net
BuildRoot: /var/tmp/%{name}-%{version}
License: GPLv2
Group: Applications/System
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
# http://mtx.opensource-sw.net/bugs/view.php?id=9
Patch0: %{name}-1.3.12-destdir.patch
# http://mtx.opensource-sw.net/bugs/view.php?id=13
# https://bugzilla.redhat.com/show_bug.cgi?id=538403
Patch1: %{name}-1.3.12-argc.patch
Patch2: emc-fix-fail-with-too-high-slot-count_cleanupver.patch
Patch3: mtx-1.3.12-fix-resource-leak.patch
Patch4: mtx-1.3.12-scsitape-usage--add-erase.patch
Patch5: mtx-1.3.12-man-Document-mtx-eject-and-previous-operations.patch
URL: http://mtx.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%description
The MTX program controls the robotic mechanism in autoloaders and tape
libraries such as the HP SureStore DAT 40x6, Exabyte EZ-17, and
Exabyte 220. This program is also reported to work with a variety of other tape
libraries and autochangers from Tandberg/Overland, Breece Hill, HP, and
Seagate.
Exabyte 220. This program is also reported to work with a variety of
other tape libraries and autochangers from ADIC, Tandberg/Overland,
Breece Hill, HP, and Seagate.
If you have a backup tape device capable of handling more than one
tape at a time, you should install MTX.
%prep
%setup -q
%patch0 -p2 -b .destdir
%patch1 -p2 -b .argc
%patch2 -p1 -b .emc_slot_count
%patch3 -p1 -b .fixresourceleak
%patch4 -p1 -b .scsitape_adderase
%patch5 -p1 -b .mtxman1upd
# remove exec permission
chmod a-x contrib/config_sgen_solaris.sh contrib/mtx-changer
%build
export CFLAGS="$RPM_OPT_FLAGS"
%configure
make
make %{?_smp_mflags}
%install
mkdir -p $RPM_BUILD_ROOT/sbin
install mtx $RPM_BUILD_ROOT/sbin/mtx
mkdir -p $RPM_BUILD_ROOT/usr/sbin
install loaderinfo $RPM_BUILD_ROOT/usr/sbin/loaderinfo
install scsieject $RPM_BUILD_ROOT/usr/sbin/scsieject
install scsitape $RPM_BUILD_ROOT/usr/sbin/scsitape
install tapeinfo $RPM_BUILD_ROOT/usr/sbin/tapeinfo
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
install mtx.1 $RPM_BUILD_ROOT/%{_mandir}/man1/mtx.1
install loaderinfo.1 $RPM_BUILD_ROOT/%{_mandir}/man1/loaderinfo.1
install scsieject.1 $RPM_BUILD_ROOT/%{_mandir}/man1/scsieject.1
install scsitape.1 $RPM_BUILD_ROOT/%{_mandir}/man1/scsitape.1
install tapeinfo.1 $RPM_BUILD_ROOT/%{_mandir}/man1/tapeinfo.1
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc mtx.doc CHANGES README mtxl.README.html
%doc COMPATABILITY FAQ LICENSE* TODO contrib
%files
%defattr(-,root,root,-)
%doc CHANGES COMPATABILITY contrib FAQ LICENSE
%doc mtx.doc mtxl.README.html README TODO
%{_mandir}/man1/*
/sbin/mtx
/usr/sbin/*
%{_sbindir}/*
%changelog
* Fri Sep 27 2002 Eric Green <eric@badtux.org>
- 1.3.0rel
- move changelog to end.
- change source directory to ftp.badtux.net.
- use * for files to catch new files.
* Wed Mar 16 2016 David Sommerseth <davids@redhat.com> - 1.3.12-14
- Update scsitape --help screen to show the erase command and improved mtx.1 man page (#948459)
* Wed Apr 18 2001 Kenneth Porter <shiva@well.com>
- 1.2.12pre1
- Need to create usr/sbin for install
* Wed Mar 16 2016 David Sommerseth <davids@redhat.com> - 1.3.12-13
- Fix resource leak during processing of import/export information
* Fri Mar 02 2001 Eric Green <eric@estinc.com>
- 1.2.11pre6
- Move tapeinfo,loaderinfo, scsitape to /usr/sbin rather than /sbin
* Fri Mar 11 2016 David Sommerseth <davids@redhat.com> - 1.3.12-12
- Fix fail with too high slot count (#1298647)
* Wed Feb 28 2001 Kenneth Porter <shiva@well.com>
- 1.2.11pre5
- Remove commented-out patch.
- Use mandir FHS macro and configure macro.
- Install more stuff.
- Use build policy for stripping.
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.3.12-11
- Mass rebuild 2014-01-24
* Wed Jan 17 2001 Eric Green <eric@estinc.com>
- 1.2.11pre3
- Removed patch, now use ./configure.
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.3.12-10
- Mass rebuild 2013-12-27
* Mon Nov 27 2000 Eric Green <eric@estinc.com>
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.12-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.12-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.12-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.12-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Thu Nov 19 2009 Dan Horák <dan[at]danny.cz> 1.3.12-5
- dropped debug output when tools are called with wrong number of arguments (#538403)
- added patch to support DESTDIR for installing
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Sun Dec 21 2008 Dan Horák <dan[at]danny.cz> 1.3.12-2
- spec file cleanup for better compliance with the guidelines
* Mon Aug 25 2008 Dan Horák <dan[at]danny.cz> 1.3.12-1
- update to mtx-1.3.12
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.3.11-3
- Autorebuild for GCC 4.3
* Thu Aug 23 2007 Jindrich Novy <jnovy@redhat.com> 1.3.11-2
- update License
- rebuild for BuildID
* Wed Mar 28 2007 Jindrich Novy <jnovy@redhat.com> 1.3.11-1
- update to 1.3.11 (adds new scsieject utility, bugfixes)
- sync nostrip patch
* Tue Feb 06 2007 Jindrich Novy <jnovy@redhat.com> 1.3.10-1
- update to mtx-1.3.10
- update URL, Source0
- don't strip debuginfo
* Tue Dec 12 2006 Jindrich Novy <jnovy@redhat.com> 1.2.18-9
- spec cleanup
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.2.18-8.2.2
- rebuild
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.2.18-8.2.1
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.2.18-8.2
- rebuilt for new gcc4.1 snapshot and glibc changes
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Mon Mar 7 2005 Jindrich Novy <jnovy@redhat.com> 1.2.18-8
- fix type confusion in SCSI_writet(), SCSI_readt(), slow_memcopy()
and slow_bzero()
- rebuilt with gcc4
* Thu Feb 10 2005 Jindrich Novy <jnovy@redhat.com> 1.2.18-7
- remove -D_FORTIFY_SOURCE=2 from CFLAGS, present in RPM_OPT_FLAGS
* Wed Feb 9 2005 Jindrich Novy <jnovy@redhat.com> 1.2.18-6
- rebuilt with -D_FORTIFY_SOURCE=2
* Wed Aug 11 2004 Jindrich Novy <jnovy@redhat.com> 1.2.18-5
- dead code elimination
- updated spec link to recent source
- removed spec link to obsolete URL
- rebuilt
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Tue Jan 13 2004 Than Ngo <than@redhat.com> 1.2.18-2
- rebuild
* Fri Sep 26 2003 Harald Hoyer <harald@redhat.de> 1.2.18-1
- 1.2.18
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt
* Wed Dec 11 2002 Tim Powers <timp@redhat.com> 1.2.16-6
- rebuild on all arches
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Wed Jun 19 2002 Than Ngo <than@redhat.com> 1.2.16-4
- don't forcibly strip binaries
* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Tue Feb 26 2002 Than Ngo <than@redhat.com> 1.2.16-2
- rebuild
* Tue Feb 19 2002 Bernhard Rosenkraenzer <bero@redhat.com> 1.2.16-1
- 1.2.16
* Wed Jan 09 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Fri Dec 14 2001 Than Ngo <than@redhat.com> 1.2.15-1
- update to 1.2.15
* Mon Aug 13 2001 Preston Brown <pbrown@redhat.com> 1.2.13-1
- 1.2.13 fixes "+ Too many Data Transfer Elements Reported" problem (#49258)
* Mon Jun 25 2001 Preston Brown <pbrown@redhat.com>
- 1.2.12
- moved binaries to /usr/sbin from /sbin
* Wed Feb 14 2001 Michael Stefaniuc <mstefani@redhat.com>
- 1.2.10
- Fixed patching to use the portable.patch.
- updated %%doc
* Tue Jul 25 2000 Eric Green <eric@estinc.com>
- 1.2.8
- Added portability patch to mtx.spec so should compile on Red Hat Alpha etc.
* Mon Dec 11 2000 Preston Brown <pbrown@redhat.com>
- 1.2.9
* Thu Jun 6 2000 Eric Green <eric@estinc.com>
* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild
* Thu Jun 15 2000 Preston Brown <pbrown@redhat.com>
- 1.2.7
- Fixed single-drive Exabyte 220 special case.
- Fixed ADIC DAT Autochanger special case.
- Fixed mtx.spec to move the binaries to /sbin since we need root access
* Tue May 23 2000 Preston Brown <pbrown@redhat.com>
- adopted for Winston
* Fri May 12 2000 Kenneth Porter <shiva@well.com>
- 1.2.6

View File

@@ -39,6 +39,9 @@
/* zap the following define when we finally add real import/export support */
#define IMPORT_EXPORT_HACK 1 /* for the moment, import/export == storage */
/* only so many element per SCSI Read Element Status */
#define SCSI_RES_ELEMENTS 5000
/* First, do some SCSI routines: */
/* the camlib is used on FreeBSD. */
@@ -1055,7 +1058,7 @@ static void ParseElementStatus( int *EmptyStorageElementAddress,
ElementStatus->DataTransferElementSourceStorageElementNumber[ElementStatus->DataTransferElementCount] =
BigEndian16(TransportElementDescriptor->SourceStorageElementAddress);
#if DEBUG
#ifdef DEBUG
fprintf(stderr, "%d: ElementAddress = %d, Full = %d, SourceElement = %d\n",
ElementStatus->DataTransferElementCount,
ElementStatus->DataTransferElementAddress[ElementStatus->DataTransferElementCount],
@@ -1141,6 +1144,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
int empty_idx = 0;
boolean is_attached = false;
int i,j;
int FirstElem, NumElements, NumThisRES;
ElementModeSense_T *mode_sense = NULL;
@@ -1205,35 +1209,46 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
{
#ifdef DEBUG
fprintf(stderr,"Using original element status polling method (storage, import/export, drivers etc independantly)\n");
fprintf(stderr,"Storage start %d, Num %d, max %d\n", mode_sense->StorageStart, mode_sense->NumStorage - mode_sense->NumImportExport, mode_sense->MaxReadElementStatusData);
#endif
flags->elementtype = StorageElement; /* sigh! */
DataBuffer = SendElementStatusRequest( MediumChangerFD, RequestSense,
inquiry_info, flags,
mode_sense->StorageStart,
/* adjust for import/export. */
mode_sense->NumStorage - mode_sense->NumImportExport,
mode_sense->MaxReadElementStatusData);
if (!DataBuffer)
NumElements = mode_sense->NumStorage - mode_sense->NumImportExport;
FirstElem = mode_sense->StorageStart;
do
{
NumThisRES = (NumElements > SCSI_RES_ELEMENTS ? SCSI_RES_ELEMENTS : NumElements);
DataBuffer = SendElementStatusRequest( MediumChangerFD, RequestSense,
inquiry_info, flags,
FirstElem,
/* adjust for import/export. */
NumThisRES,
SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG
fprintf(stderr,"Had no elements!\n");
fprintf(stderr,"Had no elements!\n");
#endif
/* darn. Free up stuff and return. */
/* darn. Free up stuff and return. */
#ifdef DEBUG_MODE_SENSE
PrintRequestSense(RequestSense);
PrintRequestSense(RequestSense);
#endif
FreeElementData(ElementStatus);
return NULL;
}
FreeElementData(ElementStatus);
return NULL;
}
#ifdef DEBUG
fprintf(stderr, "Parsing storage elements\n");
fprintf(stderr, "Parsing storage elements\n");
#endif
ParseElementStatus(EmptyStorageElementAddress, &EmptyStorageElementCount,
DataBuffer,ElementStatus,mode_sense,NULL);
ParseElementStatus(EmptyStorageElementAddress, &EmptyStorageElementCount,
DataBuffer,ElementStatus,mode_sense,NULL);
free(DataBuffer); /* sigh! */
free(DataBuffer); /* sigh! */
FirstElem += SCSI_RES_ELEMENTS;
NumElements -= SCSI_RES_ELEMENTS;
} while ( NumElements > 0 );
/* --------------IMPORT/EXPORT--------------- */
/* Next let's see if we need to do Import/Export: */
@@ -1247,8 +1262,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
inquiry_info, flags,
mode_sense->ImportExportStart,
mode_sense->NumImportExport,
mode_sense->MaxReadElementStatusData);
SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG
@@ -1269,7 +1283,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
#endif
ParseElementStatus( EmptyStorageElementAddress, &EmptyStorageElementCount,
DataBuffer, ElementStatus, mode_sense, NULL);
free(DataBuffer);
ElementStatus->StorageElementCount += ElementStatus->ImportExportCount;
}
@@ -1283,7 +1297,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
inquiry_info, flags,
mode_sense->DataTransferStart,
mode_sense->NumDataTransfer,
mode_sense->MaxReadElementStatusData);
SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG
@@ -1322,7 +1336,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
inquiry_info, flags,
mode_sense->MediumTransportStart,
1, /* only get 1, sigh. */
mode_sense->MaxReadElementStatusData);
SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG

View File

@@ -0,0 +1,123 @@
diff --git a/mtxl.c b/mtxl.c
index 3ae77a6..12ea157 100644
--- a/mtxl.c
+++ b/mtxl.c
@@ -39,6 +39,9 @@
/* zap the following define when we finally add real import/export support */
#define IMPORT_EXPORT_HACK 1 /* for the moment, import/export == storage */
+/* only so many element per SCSI Read Element Status */
+#define SCSI_RES_ELEMENTS 5000
+
/* First, do some SCSI routines: */
/* the camlib is used on FreeBSD. */
@@ -1055,7 +1058,7 @@ static void ParseElementStatus( int *EmptyStorageElementAddress,
ElementStatus->DataTransferElementSourceStorageElementNumber[ElementStatus->DataTransferElementCount] =
BigEndian16(TransportElementDescriptor->SourceStorageElementAddress);
-#if DEBUG
+#ifdef DEBUG
fprintf(stderr, "%d: ElementAddress = %d, Full = %d, SourceElement = %d\n",
ElementStatus->DataTransferElementCount,
ElementStatus->DataTransferElementAddress[ElementStatus->DataTransferElementCount],
@@ -1141,6 +1144,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
int empty_idx = 0;
boolean is_attached = false;
int i,j;
+ int FirstElem, NumElements, NumThisRES;
ElementModeSense_T *mode_sense = NULL;
@@ -1205,35 +1209,46 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
{
#ifdef DEBUG
fprintf(stderr,"Using original element status polling method (storage, import/export, drivers etc independantly)\n");
+ fprintf(stderr,"Storage start %d, Num %d, max %d\n", mode_sense->StorageStart, mode_sense->NumStorage - mode_sense->NumImportExport, mode_sense->MaxReadElementStatusData);
#endif
flags->elementtype = StorageElement; /* sigh! */
- DataBuffer = SendElementStatusRequest( MediumChangerFD, RequestSense,
+
+ NumElements = mode_sense->NumStorage - mode_sense->NumImportExport;
+ FirstElem = mode_sense->StorageStart;
+
+ do
+ {
+ NumThisRES = (NumElements > SCSI_RES_ELEMENTS ? SCSI_RES_ELEMENTS : NumElements);
+ DataBuffer = SendElementStatusRequest( MediumChangerFD, RequestSense,
inquiry_info, flags,
- mode_sense->StorageStart,
+ FirstElem,
/* adjust for import/export. */
- mode_sense->NumStorage - mode_sense->NumImportExport,
- mode_sense->MaxReadElementStatusData);
+ NumThisRES,
+ SCSI_RES_ELEMENTS * 52 +120);
- if (!DataBuffer)
- {
+ if (!DataBuffer)
+ {
#ifdef DEBUG
- fprintf(stderr,"Had no elements!\n");
+ fprintf(stderr,"Had no elements!\n");
#endif
- /* darn. Free up stuff and return. */
+ /* darn. Free up stuff and return. */
#ifdef DEBUG_MODE_SENSE
- PrintRequestSense(RequestSense);
+ PrintRequestSense(RequestSense);
#endif
- FreeElementData(ElementStatus);
- return NULL;
- }
+ FreeElementData(ElementStatus);
+ return NULL;
+ }
#ifdef DEBUG
- fprintf(stderr, "Parsing storage elements\n");
+ fprintf(stderr, "Parsing storage elements\n");
#endif
- ParseElementStatus(EmptyStorageElementAddress, &EmptyStorageElementCount,
- DataBuffer,ElementStatus,mode_sense,NULL);
+ ParseElementStatus(EmptyStorageElementAddress, &EmptyStorageElementCount,
+ DataBuffer,ElementStatus,mode_sense,NULL);
- free(DataBuffer); /* sigh! */
+ free(DataBuffer); /* sigh! */
+ FirstElem += SCSI_RES_ELEMENTS;
+ NumElements -= SCSI_RES_ELEMENTS;
+ } while ( NumElements > 0 );
/* --------------IMPORT/EXPORT--------------- */
/* Next let's see if we need to do Import/Export: */
@@ -1247,8 +1262,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
inquiry_info, flags,
mode_sense->ImportExportStart,
mode_sense->NumImportExport,
- mode_sense->MaxReadElementStatusData);
-
+ SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG
@@ -1283,7 +1297,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
inquiry_info, flags,
mode_sense->DataTransferStart,
mode_sense->NumDataTransfer,
- mode_sense->MaxReadElementStatusData);
+ SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG
@@ -1322,7 +1336,7 @@ ElementStatus_T *ReadElementStatus(DEVICE_TYPE MediumChangerFD, RequestSense_T *
inquiry_info, flags,
mode_sense->MediumTransportStart,
1, /* only get 1, sigh. */
- mode_sense->MaxReadElementStatusData);
+ SCSI_RES_ELEMENTS * 52 +120);
if (!DataBuffer)
{
#ifdef DEBUG

View File

@@ -0,0 +1,45 @@
From f8e0af006f6a85243f0882ed08d31016032531b1 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Thu, 19 Nov 2009 15:45:54 +0100
Subject: [PATCH 2/2] remove the weird debugging-like info
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
The loaderinfo and tapeinfo utilities print a debugging-like information
about the number of arguments on command line when started with wrong number
of arguments.
Signed-off-by: Dan Horák <dan@danny.cz>
---
mtx/loaderinfo.c | 1 -
mtx/tapeinfo.c | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/mtx/loaderinfo.c b/mtx/loaderinfo.c
index 534666f..27d22d9 100644
--- a/mtx/loaderinfo.c
+++ b/mtx/loaderinfo.c
@@ -488,7 +488,6 @@ int main(int argc, char **argv)
argv0=argv[0];
if (argc != 3)
{
- fprintf(stderr,"argc=%d",argc);
usage();
}
diff --git a/mtx/tapeinfo.c b/mtx/tapeinfo.c
index 4d9c283..67547a6 100644
--- a/mtx/tapeinfo.c
+++ b/mtx/tapeinfo.c
@@ -933,7 +933,6 @@ int main(int argc, char **argv)
if (argc != 3)
{
- fprintf(stderr,"argc=%d",argc);
usage();
}
--
1.6.3.3

View File

@@ -0,0 +1,47 @@
From a5d4d1c2fbdad8b24c2938b00406bccb037e5ab4 Mon Sep 17 00:00:00 2001
From: Dan Horak <dan@danny.cz>
Date: Sat, 24 Jan 2009 18:06:43 +0100
Subject: [PATCH 1/2] add support for DESTDIR
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Dan Horák <dan@danny.cz>
---
mtx/Makefile.in | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/mtx/Makefile.in b/mtx/Makefile.in
index 6b967cf..05894d2 100644
--- a/mtx/Makefile.in
+++ b/mtx/Makefile.in
@@ -33,6 +33,7 @@ INSTALL_DOC = $(INSTALL) -m 644
INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DIR = $(INSTALL) -m 755 -d
+DESTDIR =
prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
@@ -109,13 +110,13 @@ all: $(BINS)
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:
--
1.6.3.3

View File

@@ -0,0 +1,11 @@
--- a/mtxl.c 2016-03-16 18:53:48.947779146 +0100
+++ b/mtxl.c 2016-03-16 18:55:15.592873800 +0100
@@ -1283,7 +1283,7 @@
#endif
ParseElementStatus( EmptyStorageElementAddress, &EmptyStorageElementCount,
DataBuffer, ElementStatus, mode_sense, NULL);
-
+ free(DataBuffer);
ElementStatus->StorageElementCount += ElementStatus->ImportExportCount;
}

View File

@@ -0,0 +1,44 @@
From 26bf6f6794a8a35f69dc2a8a01e69bf50200800f Mon Sep 17 00:00:00 2001
From: David Sommerseth <davids@redhat.com>
Date: Fri, 6 May 2016 21:00:58 +0200
Subject: [PATCH] man: Document mtx eject and previous operations
---
mtx.1 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mtx.1 b/mtx.1
index a5e6cc6..108836e 100644
--- a/mtx.1
+++ b/mtx.1
@@ -131,13 +131,16 @@ may need to eject the tape using your OS's tape control commands
first). Note that this command may not be what you want on large
tape libraries -- e.g. on Exabyte 220, the first slot is usually a
cleaning tape. If <drivenum> is omitted, defaults to first drive.
-
.TP 10
.B last [<drivenum>]
Loads drive <drivenum> from the last slot in the media changer. Unloads
the drive if there is already a tape in it. (Note: you may need to eject
the tape using your OS's tape control commands first).
.TP 10
+.B previous [<drivenum>]
+Unloads the drive and loads the previous tape in sequence. If the drive
+was empty, loads the first tape into the drive.
+.TP 10
.B next [<drivenum>]
Unloads the drive and loads the next tape in sequence. If the drive was
empty, loads the first tape into the drive.
@@ -145,6 +148,9 @@ empty, loads the first tape into the drive.
.B position <slotnum>
Positions the robot at a specific slot. Needed by some changers to
move to and open the import/export, or mailbox, slot.
+.TP 10
+.B eject
+Eject the tape currently in the drive.
.SH AUTHORS
The original 'mtx' program was written by Leonard Zubkoff and extensively
--
1.8.3.1

View File

@@ -0,0 +1,13 @@
diff --git a/scsitape.c b/scsitape.c
index dd52dd5..63f4977 100644
--- a/scsitape.c
+++ b/scsitape.c
@@ -63,7 +63,7 @@
#endif
void Usage(void) {
- FatalError("Usage: scsitape -f <generic-device> <command> where <command> is:\n setblk <n> | fsf <n> | bsf <n> | eod | rewind | eject | mark <n> |\n seek <n> | read [<blksize> [<numblocks]] | write [<blocksize>] \n");
+ FatalError("Usage: scsitape -f <generic-device> <command> where <command> is:\n setblk <n> | fsf <n> | bsf <n> | eod | rewind | eject | erase |\n mark <n> | seek <n> | read [<blksize> [<numblocks]] |\n write [<blocksize>]\n");
}
#define arg1 (arg[0]) /* for backward compatibility, sigh */

View File

@@ -63,7 +63,7 @@
#endif
void Usage(void) {
FatalError("Usage: scsitape -f <generic-device> <command> where <command> is:\n setblk <n> | fsf <n> | bsf <n> | eod | rewind | eject | mark <n> |\n seek <n> | read [<blksize> [<numblocks]] | write [<blocksize>] \n");
FatalError("Usage: scsitape -f <generic-device> <command> where <command> is:\n setblk <n> | fsf <n> | bsf <n> | eod | rewind | eject | erase |\n mark <n> | seek <n> | read [<blksize> [<numblocks]] |\n write [<blocksize>]\n");
}
#define arg1 (arg[0]) /* for backward compatibility, sigh */

View File

@@ -933,7 +933,6 @@ int main(int argc, char **argv)
if (argc != 3)
{
fprintf(stderr,"argc=%d",argc);
usage();
}