add and document seteotmodel and geteotmodel commands

This commit is contained in:
Matt Jacob 1999-05-10 20:05:19 +00:00
parent eaef7baa81
commit dc06ef2775
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46928
2 changed files with 45 additions and 1 deletions

View File

@ -145,6 +145,22 @@ shown in the table, and the first matching entry will be used. If the
given string and the resulting canonical density name do not match
exactly, an informational message is printed about what the given
string has been taken for.
.It Cm geteotmodel
Fetch and print out the current EOT filemark model. The model states how
many filemarks will be written at close if a tape was being written.
.It Cm seteotmodel
Set (from the
.Ar count
argument)
and print out the current and EOT filemark model. Typically this will be
.Ar 2
filemarks, but some devices (typically QIC cartridge drives) can
only write
.Ar 1
filemark. Currently you can only choose a value of
.Ar 1
or
.Ar 2 .
.It Cm eom
Forward space to end of recorded medium
(Count is ignored).

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 5/4/95";
#endif
static const char rcsid[] =
"$Id: mt.c,v 1.23 1999/03/10 00:48:03 mjacob Exp $";
"$Id: mt.c,v 1.24 1999/03/10 18:42:20 mjacob Exp $";
#endif /* not lint */
/*
@ -123,6 +123,10 @@ struct commands {
{ "sethpos", MTIOCHLOCATE, 0, NEED_2ARGS|ZERO_ALLOWED },
{ "setspos", MTIOCSLOCATE, 0, NEED_2ARGS|ZERO_ALLOWED },
{ "errstat", MTIOCERRSTAT, 0 },
{ "setmodel", MTIOCSETEOTMODEL, 0, NEED_2ARGS|ZERO_ALLOWED },
{ "seteotmodel", MTIOCSETEOTMODEL, 0, NEED_2ARGS|ZERO_ALLOWED },
{ "getmodel", MTIOCGETEOTMODEL },
{ "geteotmodel", MTIOCGETEOTMODEL },
#endif /* defined(__FreeBSD__) */
{ NULL }
};
@ -289,6 +293,30 @@ main(argc, argv)
exit(0);
/* NOTREACHED */
}
case MTIOCGETEOTMODEL:
{
u_int32_t om;
if (ioctl(mtfd, MTIOCGETEOTMODEL, (caddr_t)&om) < 0)
err(2, "%s", tape);
(void)printf("%s: the model is %u filemar%s at EOT\n",
tape, om, (om > 1)? "ks" : "k");
exit(0);
/* NOTREACHED */
}
case MTIOCSETEOTMODEL:
{
u_int32_t om, nm = (u_int32_t)mt_com.mt_count;
if (ioctl(mtfd, MTIOCGETEOTMODEL, (caddr_t)&om) < 0)
err(2, "%s", tape);
if (ioctl(mtfd, comp->c_code, (caddr_t)&nm) < 0)
err(2, "%s", tape);
(void)printf("%s: old model was %u filemar%s at EOT\n",
tape, om, (om > 1)? "ks" : "k");
(void)printf("%s: new model is %u filemar%s at EOT\n",
tape, nm, (nm > 1)? "ks" : "k");
exit(0);
/* NOTREACHED */
}
default:
break;
}