1/2" tape cleaners?

From: Fred N. van Kempen <waltje_at_pdp11.nl>
Date: Sun Oct 24 15:46:56 2004

On Sun, 24 Oct 2004, Ethan Dicks wrote:

> On Sun, Oct 24, 2004 at 03:11:33PM -0500, Doc Shipley wrote:
> > Linux has the Unix-standard mt command, too, which allows setting the
> > blocksize the system device uses, either explicitly or to a variable
> > blocksize.
>
> Ah... I have never used that facet of 'mt' before (but I use mt on Linux
> all the time, practically daily, with our SDLTs).
You dont need 'mt' (under any UNIX system) to read non-local tape
formats. It doesn't even work that way: by using 'mt' to set the
block size, you only set its *reblocking* factor.

When reading raw tapes (meaning: read them, as they come), you need
to tell the driver exactly that: no cooking up block sizes, just
give the user whatever comes in.

Usually, this is handled by opening the "raw" mode device for that
tape. I don't use Linux, but assuming it at least TRIES to adhere
to a standard, you should be able to use

        /dev/r{nameoftape}{unitnumber}
as in
        /dev/rst0

for the first detected tape unit on the SCSI bus.

This causes the driver to disable reblocking, and allocate a large
buffer space so it can cope with whatever comes its way. Older
systems had a limit of 16KB in that buffer, this is probably more
like 64KB nowadays.

So, your program does

        fd = open("/dev/rst0", READ)

and then enters a loop, reading blocks from the tape:

        for(;;) {
                len = read(fd, mybuff, sizeof(mybuff))
                if (len < 0)
                        /* we have problems, scotty, beam us up! */

                /* len now has the size of the block we just read */
        }

where usually, a length of 0 indicates an EOF (end of logical file,
aka "first tape mark detected") or EOT (end of tape, aka "second
consequtive tape mark detected") situation.

--f
Received on Sun Oct 24 2004 - 15:46:56 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:37:24 BST