mirror of
https://github.com/moibenko/mtx.git
synced 2026-01-03 10:55:16 +00:00
Add files via upload
Allow setting of scsi commands timeout. For IBM TS4500 the timeout is 16 min as stated by IBM developer (this timeout is set in IBM driver). Linux ssci command timeot is set to 5 min, which causes problems and confusions during heavy mount / dismount activity.
This commit is contained in:
committed by
GitHub
parent
280fa25936
commit
3396b63b27
@@ -80,8 +80,7 @@ static int argc;
|
||||
static char **argv;
|
||||
|
||||
char *device=NULL; /* the device name passed as argument */
|
||||
int absolute_addressing=1; /* if not 0 - use absolute adresses of storage and tranport elements as known to the robot */
|
||||
|
||||
int absolute_addressing=0; /* if not 0 - use absolute adresses of storage and tranport elements as known to the robot */
|
||||
/* Unfortunately this must be true for SGI, because SGI does not
|
||||
use an int :-(.
|
||||
*/
|
||||
@@ -1064,6 +1063,15 @@ int parse_args(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_scsi_timeout(int timeout) /* in seconds */
|
||||
{
|
||||
set_timeout(timeout);
|
||||
}
|
||||
|
||||
void get_scsi_timeout(void)
|
||||
{
|
||||
return get_timeout( );
|
||||
}
|
||||
|
||||
|
||||
int main(int ArgCount, char *ArgVector[])
|
||||
|
||||
@@ -57,10 +57,21 @@ $Revision: 193 $
|
||||
|
||||
static int pack_id;
|
||||
static int sg_timeout;
|
||||
int sg_scsi_default_timeout = SG_SCSI_DEFAULT_TIMEOUT;
|
||||
|
||||
void set_timeout(int timeout)
|
||||
{
|
||||
sg_scsi_default_timeout = HZ*timeout;
|
||||
}
|
||||
|
||||
int get_timeout(void)
|
||||
{
|
||||
return(sg_scsi_default_timeout/HZ);
|
||||
}
|
||||
|
||||
DEVICE_TYPE SCSI_OpenDevice(char *DeviceName)
|
||||
{
|
||||
int timeout = SG_SCSI_DEFAULT_TIMEOUT;
|
||||
int timeout = sg_scsi_default_timeout;
|
||||
#ifdef SG_IO
|
||||
int k; /* version */
|
||||
#endif
|
||||
@@ -93,7 +104,7 @@ void SCSI_Set_Timeout(int secs)
|
||||
|
||||
void SCSI_Default_Timeout(void)
|
||||
{
|
||||
sg_timeout = SG_SCSI_DEFAULT_TIMEOUT;
|
||||
sg_timeout = sg_scsi_default_timeout;
|
||||
}
|
||||
|
||||
void SCSI_CloseDevice(char *DeviceName, DEVICE_TYPE DeviceFD)
|
||||
@@ -256,13 +267,13 @@ int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD,
|
||||
|
||||
int write_length = sizeof(struct sg_header)+CDB_Length;
|
||||
int i; /* a random index... */
|
||||
int result; /* the result of the write... */
|
||||
int result; /* the result of the write... */
|
||||
|
||||
struct sg_header *Header; /* we actually point this into Command... */
|
||||
struct sg_header *ResultHeader; /* we point this into ResultBuf... */
|
||||
|
||||
/* First, see if we need to set our SCSI timeout to something different */
|
||||
if (sg_timeout != SG_SCSI_DEFAULT_TIMEOUT)
|
||||
if (sg_timeout != sg_scsi_default_timeout)
|
||||
{
|
||||
/* if not default, set it: */
|
||||
#ifdef DEBUG_TIMEOUT
|
||||
@@ -448,9 +459,9 @@ int SCSI_ExecuteCommand(DEVICE_TYPE DeviceFD,
|
||||
}
|
||||
|
||||
/* See if we need to reset our SCSI timeout */
|
||||
if (sg_timeout != SG_SCSI_DEFAULT_TIMEOUT)
|
||||
if (sg_timeout != sg_scsi_default_timeout)
|
||||
{
|
||||
sg_timeout = SG_SCSI_DEFAULT_TIMEOUT; /* reset it back to default */
|
||||
sg_timeout = sg_scsi_default_timeout; /* reset it back to default */
|
||||
|
||||
#ifdef DEBUG_TIMEOUT
|
||||
fprintf(stderr,"Setting timeout to %d\n", sg_timeout);
|
||||
|
||||
Reference in New Issue
Block a user