diff --git a/usr.bin/mt/mt.1 b/usr.bin/mt/mt.1 index 6500ad53774d..9a526b34d5bc 100644 --- a/usr.bin/mt/mt.1 +++ b/usr.bin/mt/mt.1 @@ -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). diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c index 9c87191ce54d..ff2a2d64b574 100644 --- a/usr.bin/mt/mt.c +++ b/usr.bin/mt/mt.c @@ -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; }