mt: stinit: Add support for setting and clearing MT_ST_NOWAIT_EOF

Add code to set/clear the MT_ST_NO_WAIT option bit for MTSETDRVBUFFER.
The string used in the user interface is 'weof-no-wait'.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
This commit is contained in:
Kai Mäkisara
2024-12-15 19:49:47 +02:00
committed by Iustin Pop
parent 9c8f170d4a
commit ff108770be
4 changed files with 13 additions and 0 deletions

2
mt.1
View File

@@ -187,6 +187,8 @@ write two filemarks when file closed
space directly to eod (and lose file number)
.IP no-wait
don't wait until rewind, etc. complete
.IP weof-no-wait
don't wait until writing filemarks completes
.IP auto-lock
automatically lock/unlock drive door
.IP def-writes

1
mt.c
View File

@@ -250,6 +250,7 @@ static struct booleans {
{ "can-partitions", MT_ST_CAN_PARTITIONS, "drive can handle partitioned tapes" },
{ "scsi2logical", MT_ST_SCSI2LOGICAL, "logical block addresses used with SCSI-2" },
{ "no-wait", MT_ST_NOWAIT, "immediate mode for rewind, etc." },
{ "weof-no-wait", MT_ST_NOWAIT_EOF, "immediate mode for writing filemarks" },
#ifdef MT_ST_SYSV
{ "sysv", MT_ST_SYSV, "enable the SystemV semantics" },
#endif

View File

@@ -159,6 +159,10 @@ The cleaning request notifying parameter is set to
The immediate mode is used with commands like rewind if
.I value
is non-zero (i.e., the driver does not wait for the command to finish).
.IP weof-n[o-wait]
The immediate mode is used when writing filemarks if
.I value
is non-zero (i.e., the driver does not wait for the command to finish).
.IP mode=value
This keyword starts definition of tape mode
.I value.

View File

@@ -58,6 +58,7 @@ typedef struct _devdef_tr {
int long_timeout;
int cleaning;
int nowait;
int weof_nowait;
int sili;
modepar_tr modedefs[4];
} devdef_tr;
@@ -259,6 +260,7 @@ find_pars(FILE *dbf, char *company, char *product, char *rev, devdef_tr *defs, i
defs->long_timeout = (-1);
defs->cleaning = (-1);
defs->nowait = (-1);
defs->weof_nowait = (-1);
defs->sili = (-1);
for (i = 0; i < NBR_MODES; i++) {
defs->modedefs[i].defined = FALSE;
@@ -368,6 +370,8 @@ find_pars(FILE *dbf, char *company, char *product, char *rev, devdef_tr *defs, i
defs->cleaning = num_arg(t);
if ((t = find_string(modebuf, "no-w", line, LINEMAX)) != NULL)
defs->nowait = num_arg(t);
if ((t = find_string(modebuf, "weof-n", line, LINEMAX)) != NULL)
defs->weof_nowait = num_arg(t);
if ((t = find_string(modebuf, "sili", line, LINEMAX)) != NULL)
defs->sili = num_arg(t);
@@ -738,6 +742,8 @@ static int set_defs(devdef_tr *defs, char **fnames)
clear_set[0] = clear_set[1] = 0;
if (defs->nowait >= 0)
clear_set[defs->nowait != 0] |= MT_ST_NOWAIT;
if (defs->weof_nowait >= 0)
clear_set[defs->weof_nowait != 0] |= MT_ST_NOWAIT_EOF;
if (defs->sili >= 0)
clear_set[defs->sili != 0] |= MT_ST_SILI;
if (defs->modedefs[i].buffer_writes >= 0)