mirror of
https://github.com/moibenko/mtx.git
synced 2026-01-11 14:10:19 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdfb56b4ca | ||
|
|
2d047b1f49 | ||
|
|
e2d0e79652 |
@@ -1012,60 +1012,6 @@ void execute_command(struct command_table_struct *command)
|
||||
command->command();
|
||||
}
|
||||
|
||||
/*
|
||||
execute_command used in python call stopped working with
|
||||
new swig and Alma linux 9. The extern declaration did not work
|
||||
As the only command called over python was Status the call to it was
|
||||
implemented
|
||||
*/
|
||||
void execute_status_command(void)
|
||||
{
|
||||
struct command_table_struct command;
|
||||
RequestSense_T RequestSense;
|
||||
|
||||
command = command_table[1];
|
||||
if (device == NULL && command.need_device)
|
||||
{
|
||||
/* try to get it from TAPE environment variable... */
|
||||
device = getenv("CHANGER");
|
||||
if (device == NULL)
|
||||
{
|
||||
device = getenv("TAPE");
|
||||
if (device == NULL)
|
||||
{
|
||||
device = "/dev/changer"; /* Usage(); */
|
||||
}
|
||||
}
|
||||
open_device();
|
||||
}
|
||||
if (command.need_status && absolute_addressing)
|
||||
{
|
||||
FreeElementData(ElementStatus);
|
||||
ElementStatus = NULL;
|
||||
}
|
||||
if (!ElementStatus && command.need_status)
|
||||
{
|
||||
inquiry_info = RequestInquiry(MediumChangerFD,&RequestSense);
|
||||
if (!inquiry_info)
|
||||
{
|
||||
PrintRequestSense(&RequestSense);
|
||||
FatalError("INQUIRY command Failed\n");
|
||||
}
|
||||
|
||||
ElementStatus = ReadElementStatus(MediumChangerFD, &RequestSense, inquiry_info, &SCSI_Flags);
|
||||
if (!ElementStatus)
|
||||
{
|
||||
PrintRequestSense(&RequestSense);
|
||||
FatalError("READ ELEMENT STATUS Command Failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* okay, now to execute the command... */
|
||||
command.command();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* parse_args():
|
||||
* Basically, we are parsing argv/argc. We can have multiple commands
|
||||
* on a line now, such as "unload 3 0 load 4 0" to unload one tape and
|
||||
@@ -1094,17 +1040,6 @@ int parse_args(void)
|
||||
device = argv[i++];
|
||||
open_device(); /* open the device and do a status scan on it... */
|
||||
}
|
||||
else if (strcmp(argv[i], "-a") == 0)
|
||||
{
|
||||
printf("absolute addressing\n");
|
||||
i++;
|
||||
if (i >= argc)
|
||||
{
|
||||
Usage();
|
||||
}
|
||||
absolute_addressing = 1;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
cmd_tbl_idx = 0; /* default to the first command... */
|
||||
|
||||
@@ -565,10 +565,7 @@ TransportElementDescriptor_T;
|
||||
/* Now for element status data; */
|
||||
|
||||
typedef unsigned char barcode[37];
|
||||
//typedef unsigned char serialnumber[13];
|
||||
typedef unsigned char serialnumber[13];
|
||||
typedef unsigned char devicetype[17];
|
||||
|
||||
|
||||
typedef struct ElementStatus {
|
||||
|
||||
@@ -578,7 +575,7 @@ typedef struct ElementStatus {
|
||||
int *DataTransferElementAddress; /* array. */
|
||||
int *DataTransferElementSourceStorageElementNumber; /* array */
|
||||
int *DataTransferElementPhysicalLocation; /*array */
|
||||
devicetype *DataTransferElementProductId; /*array */
|
||||
serialnumber *DataTransferElementProductId; /*array */
|
||||
serialnumber *DataTransferElementSerialNumber; /*array */
|
||||
barcode *StorageElementPhysicalLocation; /*array */
|
||||
barcode *DataTransferPrimaryVolumeTag; /* array. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Name: mtx
|
||||
Version: 1.3.12
|
||||
Release: 29fnal_jinr%{?dist}
|
||||
Release: 15fnal%{?dist}
|
||||
Summary: SCSI media changer control program
|
||||
License: GPLv2
|
||||
Group: Applications/System
|
||||
@@ -51,14 +51,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Apr 01 2025 Alexander Moibenko <moibenko@jinr.ru> - 1.3.12.29fnal_jinr
|
||||
- execute_command stopped working on new system replaced it
|
||||
* Wed Aug 28 2024 Alexander Moibenko <moibenko@fnal.gov> - 1.3.12.22fnal_jinr
|
||||
- More fixes in copying serial number
|
||||
* Thu Dec 07 2023 Alexander Moibenko <moibenko@jinr.ru> - 1.3.12-19fnal
|
||||
- mtx CLI hasn hidden option (-a) to show status information with absolute addresses
|
||||
- Fixed problem seen in JINR where serial number was missing few last symbols
|
||||
|
||||
* Wed Jan 23 2019 Alexander Moibenko <moibenko@fnal.gov> - 1.3.12-15fnal
|
||||
- For absolute_addressing refresh elements data when status command is executed. This is needed to update tape library infortion in the calling program.
|
||||
- Changes to allow to use mtx as library and show absolute transfer and storage elements as output of status call
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
* overflow :-(. That could be important if mtxl is SUID for some reason.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include "mtx.h"
|
||||
#include "mtxl.h"
|
||||
|
||||
@@ -564,7 +563,7 @@ static ElementStatus_T *AllocateElementData(ElementModeSense_T *mode_sense)
|
||||
retval->DataTransferElementPhysicalLocation =
|
||||
(int *)xzmalloc(sizeof(int) * (mode_sense->NumDataTransfer + 1));
|
||||
retval->DataTransferElementProductId =
|
||||
(devicetype *)xzmalloc(sizeof(devicetype) * (mode_sense->NumDataTransfer + 1));
|
||||
(serialnumber *)xzmalloc(sizeof(serialnumber) * (mode_sense->NumDataTransfer + 1));
|
||||
retval->DataTransferElementSerialNumber =
|
||||
(serialnumber *)xzmalloc(sizeof(serialnumber) * (mode_sense->NumDataTransfer + 1));
|
||||
retval->StorageElementPhysicalLocation =
|
||||
@@ -619,32 +618,21 @@ void copy_physical_location(unsigned char *src, unsigned char *dest)
|
||||
void copy_char_buffer(unsigned char *src, unsigned char *dest, int num)
|
||||
{
|
||||
int i;
|
||||
unsigned char *dest_tmp;
|
||||
dest_tmp = dest;
|
||||
|
||||
for (i=0; i <= num; i++)
|
||||
{
|
||||
*dest_tmp++ = 0;
|
||||
}
|
||||
dest_tmp = dest;
|
||||
/* there happen cases when serial number begins with several ' ' */
|
||||
/* skip them */
|
||||
while (*src == ' ') {
|
||||
while ((*src< 32) || (*src > 127)) {
|
||||
src++;
|
||||
}
|
||||
for (i=0; i < num; i++)
|
||||
{
|
||||
if (isxdigit(*src)) {
|
||||
*dest++ = *src;
|
||||
}
|
||||
src++;
|
||||
*dest = *src++;
|
||||
|
||||
if ((*dest < 32) || (*dest > 127))
|
||||
{
|
||||
*dest = 0;
|
||||
break;
|
||||
}
|
||||
dest++;
|
||||
}
|
||||
/* there happen cases when serial number is '' */
|
||||
/* take care of this */
|
||||
if (strlen(dest_tmp) == 0) {
|
||||
*dest++ = 'X';
|
||||
*dest = 'X';
|
||||
}
|
||||
*dest = 0;
|
||||
}
|
||||
|
||||
/* This #%!@# routine has more parameters than I can count! */
|
||||
@@ -1129,6 +1117,7 @@ static void ParseElementStatus( int *EmptyStorageElementAddress,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
copy_char_buffer(inqs->SerialNumber, ElementStatus->DataTransferElementSerialNumber[ElementStatus->DataTransferElementCount], 12);
|
||||
copy_char_buffer(inqs->ProductIdentification+2, ElementStatus->DataTransferElementProductId[ElementStatus->DataTransferElementCount], 12);
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ static void ReportTapeAlert(DEVICE_TYPE fd)
|
||||
{
|
||||
if (result->data[i])
|
||||
{
|
||||
printf("TapeAlert[%x]: %s.\n", i, tapealert_messages[i]);
|
||||
printf("TapeAlert[%d]: %s.\n", i, tapealert_messages[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user