From owner-freebsd-hackers Sun Aug 12 18: 3:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from beppo.feral.com (beppo.feral.com [192.67.166.79]) by hub.freebsd.org (Postfix) with ESMTP id 9971437B407 for ; Sun, 12 Aug 2001 18:03:07 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from mailhost.feral.com (mailhost.feral.com [192.67.166.1]) by beppo.feral.com (8.11.3/8.11.3) with ESMTP id f7D131I65670; Sun, 12 Aug 2001 18:03:01 -0700 (PDT) (envelope-from mjacob@feral.com) Date: Sun, 12 Aug 2001 18:03:00 -0700 (PDT) From: Matthew Jacob X-Sender: mjacob@beppo Reply-To: mjacob@feral.com To: Bernd Walter Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: mtio questions In-Reply-To: <20010812140406.A7326@cicely20.cicely.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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