Path: utzoo!attcan!sobmips!uunet!cs.utexas.edu!rice!uw-beaver!Teknowledge.COM!polya!shelby!portia!name From: name@portia.Stanford.EDU (tony cooper) Newsgroups: comp.unix.wizards Subject: How do I tell physio that my device has reached EOF? Keywords: driver buf resid Message-ID: <6705@portia.Stanford.EDU> Date: 16 Nov 89 12:06:18 GMT Sender: tony cooper Organization: Stanford University Lines: 29 In the context of a raw device driver for a tape drive, physio() tells my strategy routine to schedule that 16 blocks of data be put into a buf buffer. My device transfers 14 blocks then reaches EOF. My question is this: How do I report back to physio() that 14 blocks have been put into the buf structure and that EOF has been reached. When I try: bp->b_resid = 2*512; /* 2 blocks unread */ bp->b_flags &= ~B_ERROR; bp->b_error = 0; iodone(bp); physio() realises that only 14 blocks were read and does the right thing with them. But then it comes back and asks for another 16 blocks, not realizing that EOF has been reached. The device obliges by reading 16 blocks from the next file on the tape drive since the tape was positioned ready for the next file. In the case that 16 blocks were unread instead of 2 before the EOF was reached then bp->b_resid equals 16 blocks and physio() accepts that EOF has been reached and doesn't ask for any more. But for less than 16 blocks unread, this does not work. I have tried things such as setting b_count to zero or to b_resid, but with no luck. A solution to this problem would be greatly appreciated. Thanks. Tony Cooper tony@popserver.stanford.edu name@portia.stanford.edu