Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2001 18:03:00 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        Bernd Walter <ticso@mail.cicely.de>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: mtio questions
Message-ID:  <Pine.BSF.4.21.0108121753040.65085-100000@beppo>
In-Reply-To: <20010812140406.A7326@cicely20.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help

I'll answer based upon -stable FreeBSD code.

On Sun, 12 Aug 2001, Bernd Walter wrote:

> 
> Asume the following code examples:
> 
> int fd;
> struct mtop mo;
> char buf[10240];
> 
> fd = open("/dev/nsa0", O_RDWR | O_EXLOCK);
> mo.mt_op = MTREW;
> mo.mt_count = 0;
> ioctl(fd, MTIOCTOP, &mo);
> write(fd, buf, 10240);
> close(fd);

Let's not ask whether this is variable record or not.
This tape layout depends on whether the EOT model is
single or double filemark. If it's double, then the
layour will be:

BOT ... data ... FilMk ... FilMk ... UNRECORDED MEDIA
                        ^
Note that because you opened the no rewind device, two FileMarks
are written, but the last is backed over.

Single filemark would be:

BOT ... data ... FilMk ... UNRECORDED MEDIA
                           ^  
>
> and:
> 
> int fd;
> struct mtop mo;
> char buf[10240];
> 
> fd = open("/dev/nsa0", O_RDWR | O_EXLOCK);
> mo.mt_op = MTREW;
> mo.mt_count = 0;
> ioctl(fd, MTIOCTOP, &mo);
> write(fd, buf, 10240);
> mo.mt_op = MTWEOF;
> mo.mt_count = 1;
> ioctl(fd, MTIOCTOP, &mo);
> close(fd);

Let's again not ask whether this is variable record or not. This also will
depend on whether the EOT model is single or double filemark. This is supposed
to be the same as the above case. The number filemarks 'needed' is kept track
of. If you want to issue a bunch, suit yourself.


> 
> and:
> 
> int fd;
> struct mtop mo;
> char buf[10240];
> 
> fd = open("/dev/nsa0", O_RDWR | O_EXLOCK);
> mo.mt_op = MTREW;
> mo.mt_count = 0;
> ioctl(fd, MTIOCTOP, &mo);
> write(fd, buf, 10240);
> mo.mt_op = MTWEOF;
> mo.mt_count = 1;
> ioctl(fd, MTIOCTOP, &mo);
> mo.mt_op = MTREW;
> mo.mt_count = 0;
> ioctl(fd, MTIOCTOP, &mo);
> close(fd);
> 
> The question is what filemark layout will I have on the tape?

This case is:

BOT .. FilMk .. UNRECORDED 
^

> If I MTEOD on the tape and write - will I have the same result with
> all examples?

No- unfortunately I can't claim that this works perfectly.

> 
> May I get into trouble with some tape types that use 2 filemarks EOD
> detection?
> 
> Ist the result OS dependend?
> 
> Another point:
> Can we '#define MTEOM MTEOD' as MTEOM is used on NetBSD and Solaris?

Why?

-matt



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0108121753040.65085-100000>