Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.unix Subject: Re: write(2) to tape with odd byte count Message-ID: <6215@utzoo.UUCP> Date: Tue, 10-Dec-85 17:30:33 EST Article-I.D.: utzoo.6215 Posted: Tue Dec 10 17:30:33 1985 Date-Received: Tue, 10-Dec-85 17:30:33 EST References: <1758@uwmacc.UUCP>, <320@brl-tgr.ARPA> Organization: U of Toronto Zoology Lines: 28 > > Is it possible to create a tape with an odd number of bytes > > per record? When I try such an operation with write(2), I > > get a return code of -1 (Oh, sorry, this is 2.8BSD)... > > Magtapes can be written with any number of bytes between about > 14 and 2K (often up to 64K-1) per record (block). However, some > brain-damaged operating systems maintain the transfer count > internally as PDP-11 words, instead of bytes. On such systems, > you can only request an even number of bytes. I don't know why > you would get an error return instead of having your request > rounded to an even number of bytes. I am also surprised if 2.8BSD > really still has the old 6th Edition word counts instead of the > 7th Edition byte counts... The problem is historical in origin. Most pdp11 device controllers, back in the good (?) old days, did their transfers a word at a time and hence were restricted to working in even numbers of bytes. Virtually all pdp11 disks worked that way, for example. The magtape was practically the sole exception. So raw disk i/o (*not* via the file system, which hides all this) had to be an even number of bytes. The V[67] physio() routine, which copes with the details of raw i/o setup, therefore rejects odd byte counts; they are literally impossible on pdp11 disks. Unfortunately, the magtape driver also uses physio() to do its dirty work, and hence inherits the unnecessary even-counts-only restriction. I'm surprised that 2.8BSD hasn't fixed this particular mistake; it's not hard. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry