This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: read(): varblk tape records...(& Fix for : read())


Hi Corinna,

If read() turns out to need a change, could you also check why I need to set varblk mode before each write to remind the API what's going on - from what I remember a second write returns an error unless I reset varblk mode each time. (I call a routine to set it [was:'to'] before each read and write, just to be sure... but would like to know that all the extra code can be removed at some time later.)

Please provide a brief test case to reproduce that problem. I don't see that happening.

The "end-problem" is read() failing with -1 when it should have a tape block ready to read, and if setblk is used for each write - it does find the correct block.


Each run uses a 512 byte buffed with 0123456789...
Each write replaces the leading 0 with A, B etc.
Used SCSI TAPE commands: BackSpace, Rewind, SetBlock
--------------------------------------------------
   opblk.mt_op = MTBSR;
   opblk.mt_count = 1;
   rc = ioctl (fh, MTIOCTOP, (char*)&opblk);
--------------------------------------------------
   opblk.mt_op = MTREW;
   opblk.mt_count = 1;
   rc = ioctl (fh, MTIOCTOP, (char*)&opblk);
--------------------------------------------------
   opblk.mt_op = MTSETBLK;
   opblk.mt_count = len; // (len=0)
   rc = ioctl (fh, MTIOCTOP, (char*)&opblk);
--------------------------------------------------

Run1: With *2* set-var-blk statements...

Opening Tape Handle
stblk.mt_blkno=0
ST0: Status: 41030000 BOT ON-LINE
Setting variable records. rc=0
ST0: Status: 41030000 BOT ON-LINE
rewind... rc=0
ST0: Status: 41030000 BOT ON-LINE
write... rc=512
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=1
backspace... rc=0
ST0: Status: 41030000 BOT ON-LINE
stblk.mt_blkno=0
read... rc=512
A123456789
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=1
Setting variable records. rc=0
ST0: Status: 01030000 ON-LINE
write... rc=512
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=2
backspace... rc=0
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=1
read... rc=512
B123456789
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=2
rewind... rc=0
ST0: Status: 41030000 BOT ON-LINE
Closing Tape Handle

==========================================

Run2: With *only 1* set-var-blk statement...

Opening Tape Handle
stblk.mt_blkno=0
ST0: Status: 41030000 BOT ON-LINE
Setting variable records. rc=0
ST0: Status: 41030000 BOT ON-LINE
rewind... rc=0
ST0: Status: 41030000 BOT ON-LINE
write... rc=512
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=1
backspace... rc=0
ST0: Status: 41030000 BOT ON-LINE
stblk.mt_blkno=0
read... rc=512
A123456789
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=1
write... rc=512
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=2
backspace... rc=0
ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=1
read... rc=-1

ST0: Status: 01030000 ON-LINE
stblk.mt_blkno=2
rewind... rc=0
ST0: Status: 41030000 BOT ON-LINE
Closing Tape Handle

In run2, the second read consistently fails (with no known ERRNO set.)

Jason.

_________________________________________________________________
SEEK: Now with over 50,000 dream jobs! Click here http://ninemsn.seek.com.au?hotmail



-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]