delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/04/00:56:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Delivered-To: corinna-cygwin AT cygwin DOT com
X-Originating-IP: [210.84.179.88]
X-Originating-Email: [jasonwinter AT hotmail DOT com]
X-Sender: jasonwinter AT hotmail DOT com
From: "Jason Winter" <jasonwinter AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Cc: corinna-cygwin AT cygwin DOT com
Subject: Re: read(): varblk tape records...(& Fix for : read())
Date: Thu, 04 Mar 2004 05:55:48 +0000
Mime-Version: 1.0
Message-ID: <Sea2-F60lBLMasiZAPG00007efc@hotmail.com>
X-OriginalArrivalTime: 04 Mar 2004 05:55:49.0251 (UTC) FILETIME=[581D6D30:01C401AD]

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019