Refresh elements data.

If absolute_addressing == 1 refresh elements data when status command is executed.
This is needed to update tape library information in the calling application.
This commit is contained in:
Alexander Moibenko
2019-01-23 15:07:57 -06:00
parent b338d5f9a0
commit 60a1e55727
4 changed files with 44 additions and 35 deletions

Binary file not shown.

View File

@@ -929,7 +929,6 @@ void open_device(void)
void execute_command(struct command_table_struct *command)
{
RequestSense_T RequestSense;
if (device == NULL && command->need_device)
{
/* try to get it from TAPE environment variable... */
@@ -944,6 +943,11 @@ void execute_command(struct command_table_struct *command)
}
open_device();
}
if (command->need_status && absolute_addressing)
{
FreeElementData(ElementStatus);
ElementStatus = NULL;
}
if (!ElementStatus && command->need_status)
{
inquiry_info = RequestInquiry(MediumChangerFD,&RequestSense);

View File

@@ -523,8 +523,12 @@ ElementModeSense_T *ReadAssignmentPage(DEVICE_TYPE MediumChangerFD)
return retval;
}
static void FreeElementData(ElementStatus_T *data)
void FreeElementData(ElementStatus_T *data)
{
if (!data)
{
return;
}
free(data->DataTransferElementAddress);
free(data->DataTransferElementSourceStorageElementNumber);
free(data->DataTransferElementPhysicalLocation);

View File

@@ -60,6 +60,7 @@ ElementStatus_T *ReadElementStatus( DEVICE_TYPE MediumChangerFD,
RequestSense_T *RequestSense,
Inquiry_T *inquiry_info,
SCSI_Flags_T *flags);
void FreeElementData(ElementStatus_T *data);
Inquiry_T *RequestInquiry( DEVICE_TYPE fd,
RequestSense_T *RequestSense);