mirror of
https://github.com/moibenko/mtx.git
synced 2026-01-03 10:55:16 +00:00
Synchronized with gitlab
This commit is contained in:
@@ -1012,6 +1012,60 @@ void execute_command(struct command_table_struct *command)
|
|||||||
command->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():
|
/* parse_args():
|
||||||
* Basically, we are parsing argv/argc. We can have multiple commands
|
* 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
|
* on a line now, such as "unload 3 0 load 4 0" to unload one tape and
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Name: mtx
|
Name: mtx
|
||||||
Version: 1.3.12
|
Version: 1.3.12
|
||||||
Release: 22fnal_jinr%{?dist}
|
Release: 29fnal_jinr%{?dist}
|
||||||
Summary: SCSI media changer control program
|
Summary: SCSI media changer control program
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
@@ -51,6 +51,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%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
|
* Wed Aug 28 2024 Alexander Moibenko <moibenko@fnal.gov> - 1.3.12.22fnal_jinr
|
||||||
- More fixes in copying serial number
|
- More fixes in copying serial number
|
||||||
* Thu Dec 07 2023 Alexander Moibenko <moibenko@jinr.ru> - 1.3.12-19fnal
|
* Thu Dec 07 2023 Alexander Moibenko <moibenko@jinr.ru> - 1.3.12-19fnal
|
||||||
|
|||||||
@@ -626,6 +626,7 @@ void copy_char_buffer(unsigned char *src, unsigned char *dest, int num)
|
|||||||
{
|
{
|
||||||
*dest_tmp++ = 0;
|
*dest_tmp++ = 0;
|
||||||
}
|
}
|
||||||
|
dest_tmp = dest;
|
||||||
/* there happen cases when serial number begins with several ' ' */
|
/* there happen cases when serial number begins with several ' ' */
|
||||||
/* skip them */
|
/* skip them */
|
||||||
while (*src == ' ') {
|
while (*src == ' ') {
|
||||||
@@ -638,6 +639,12 @@ void copy_char_buffer(unsigned char *src, unsigned char *dest, int num)
|
|||||||
}
|
}
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
|
/* there happen cases when serial number is '' */
|
||||||
|
/* take care of this */
|
||||||
|
if (strlen(dest_tmp) == 0) {
|
||||||
|
*dest++ = 'X';
|
||||||
|
*dest = 'X';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This #%!@# routine has more parameters than I can count! */
|
/* This #%!@# routine has more parameters than I can count! */
|
||||||
@@ -1122,7 +1129,6 @@ static void ParseElementStatus( int *EmptyStorageElementAddress,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
copy_char_buffer(inqs->SerialNumber, ElementStatus->DataTransferElementSerialNumber[ElementStatus->DataTransferElementCount], 12);
|
copy_char_buffer(inqs->SerialNumber, ElementStatus->DataTransferElementSerialNumber[ElementStatus->DataTransferElementCount], 12);
|
||||||
copy_char_buffer(inqs->ProductIdentification+2, ElementStatus->DataTransferElementProductId[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])
|
if (result->data[i])
|
||||||
{
|
{
|
||||||
printf("TapeAlert[%d]: %s.\n", i, tapealert_messages[i]);
|
printf("TapeAlert[%x]: %s.\n", i, tapealert_messages[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user