From owner-freebsd-hackers Tue Sep 9 12:50:49 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id MAA00923 for hackers-outgoing; Tue, 9 Sep 1997 12:50:49 -0700 (PDT) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id MAA00916 for ; Tue, 9 Sep 1997 12:50:44 -0700 (PDT) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id VAA24741 for hackers@FreeBSD.ORG; Tue, 9 Sep 1997 21:50:42 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id VAA00332; Tue, 9 Sep 1997 21:48:13 +0200 (MET DST) Message-ID: <19970909214812.EW16886@uriah.heep.sax.de> Date: Tue, 9 Sep 1997 21:48:12 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG Subject: Re: Tape question References: <19970908073710.TX24990@uriah.heep.sax.de> <199709082106.OAA08434@usr09.primenet.com> X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199709082106.OAA08434@usr09.primenet.com>; from Terry Lambert on Sep 8, 1997 21:06:22 +0000 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Terry Lambert wrote: > Similarly, you may *request* a 8192 byte read, and the driver may > not accept a shorter block being returned by the device in response > to the larger request. Terry, again: the latter was exactly what the originator of the question was suspecting for the FreeBSD driver. This would IMNSHO be broken behaviour. My entire case was to prove that the FreeBSD driver does *not* behave this way. (And no, it doesn't pad garbage when writing either.) So in short, for variable-length recording media (*), the FreeBSD driver does: . Write a tape block of whatever size has been passed down to the write(2) syscall, with a lower limit of 1 byte (**) per tape block, and an upper limit of 64 KB per tape block. The latter is mainly caused by known limitations of physio(9). . Read a tape block of whatever size has been recorded onto the tape, provided the read(2) syscall has been requested with at least this size (or more). If the tape block is shorter than the requested size, a short read byte count will be returned. If the request was shorter than the next tape block, the read will fail, and an error condition will be returned (IMHO an EINVAL). Again, the upper limit is 64 KB, so if your source machine could record larger tape blocks, you cannot read them on FreeBSD. IRIX machines are known to be notorious suckers in this respect, by writing 256 KB blocks, regard- less of claiming to default to 10 KB blocks in their tar(1) man page. (They do this in the name of performance, albeit this is bogus. The block overhead is neglicible between ~ 32 KB and larger blocking.) The above is believed to be compatible behaviour to other operating systems as well. The second part of the above hasn't been this way all the time, IMHO it was broken up to and including FreeBSD 2.0. (*) QIC >= 525 MB, DAT, Exb 8 mm, DLT (**) Here's the prove that 1-byte tape blocking is possible. (Someone was suspecting it weren't.) j@uriah 52% dd if=/dev/zero bs=1 count=10 of=/dev/rst0 10+0 records in 10+0 records out 10 bytes transferred in 0.107958 secs (93 bytes/sec) j@uriah 53% dd of=/dev/zero bs=100 count=10 if=/dev/rst0 0+10 records in 0+10 records out 10 bytes transferred in 1.503833 secs (7 bytes/sec) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)