11 Commits

Author SHA1 Message Date
Alexander
a853cdcc02 Synchronized with gitlab 2025-07-09 10:20:34 +03:00
Alexander
7546e2c57e Fixed changelog 2024-08-28 15:13:46 +03:00
Alexander
d34c705ce7 Entered comments 2024-08-28 15:04:54 +03:00
Alexander
9e3d2efa57 New release 2024-08-28 14:54:36 +03:00
Alexander
ab9addfb69 More fixes to make copy of serial number correct 2024-08-28 14:49:48 +03:00
Alexander Moibenko
dad84047e8 One more attempt to fix SN 2024-03-05 09:57:28 +03:00
Alexander Moibenko
8104596ed7 One more fix to copy_char_buffer to make trailing character correct. 2024-02-05 13:54:16 +03:00
Alexander Moibenko
6c234f1c21 One more fix to copy_char_buffer to make trailing charachter correct. 2024-02-05 13:08:02 +03:00
Alexander Moibenko
05ec4400ed More changes for problem with Serial Number copying. 2024-01-22 20:51:20 +03:00
Alexander Moibenko
a56ce2af7b Fix: Serial Number for one os systems had non alpha numeric tail. 2024-01-22 18:17:22 +03:00
Alexander Moibenko
14e20937d3 Update mtx.spec
New release
2024-01-22 15:37:22 +03:00
4 changed files with 81 additions and 19 deletions

View File

@@ -1012,6 +1012,60 @@ 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

View File

@@ -1,6 +1,6 @@
Name: mtx
Version: 1.3.12
Release: 19fnal_jinr%{?dist}
Release: 29fnal_jinr%{?dist}
Summary: SCSI media changer control program
License: GPLv2
Group: Applications/System
@@ -51,6 +51,10 @@ 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

View File

@@ -26,6 +26,7 @@
* overflow :-(. That could be important if mtxl is SUID for some reason.
*/
#include <ctype.h>
#include "mtx.h"
#include "mtxl.h"
@@ -618,28 +619,32 @@ void copy_physical_location(unsigned char *src, unsigned char *dest)
void copy_char_buffer(unsigned char *src, unsigned char *dest, int num)
{
int i;
char *dest_tmp;
unsigned char *dest_tmp;
dest_tmp = dest;
while ((*src<= 32) || (*src > 127)) {
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 == ' ') {
src++;
}
for (i=0; i < num; i++)
{
*dest_tmp++ = 0;
if (isxdigit(*src)) {
*dest++ = *src;
}
src++;
}
for (i=0; i < num; i++)
{
*dest = *src++;
if ((*dest < 32) || (*dest > 127))
{
*dest = 0;
break;
}
dest++;
}
*dest = 0;
/* 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! */
@@ -1124,7 +1129,6 @@ 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);
}

View File

@@ -483,7 +483,7 @@ static void ReportTapeAlert(DEVICE_TYPE fd)
{
if (result->data[i])
{
printf("TapeAlert[%d]: %s.\n", i, tapealert_messages[i]);
printf("TapeAlert[%x]: %s.\n", i, tapealert_messages[i]);
}
}