*BSD News Article 10258


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA7586 ; Mon, 25 Jan 93 12:18:25 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!usc!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!jh
From: jh@efd.lth.se (Joergen Haegg)
Newsgroups: comp.unix.bsd
Subject: Problems with wt-driver, or rawwrite. (using QIC-02)
Message-ID: <1993Jan22.091450.25072@lth.se>
Date: 22 Jan 93 09:14:50 GMT
Sender: news@lth.se
Organization: Lund Institute of Technology, Sweden
Lines: 55

I have a Everex 831 QIC-02 with a QIC36 streamer.
Reading works OK, but writing is erroneous.

The problem seems to be that the wt-driver writes a record (512 byte)
when the computer fails to feed the driver with data. So far all good.
But it will write the record even if it is not completely filled with data!
The result is that records are filled with nulls up to 512 byte.

No data loss, instead a lot of extra nulls appear when I read from the tape.
Makes tar crazy...

It might also be the rawwrite-routine which is incorrect, I don't know.

The following program demonstrates the problem.
Try it and read the result back with dd. Examine with less.


#include <stdio.h>
#include <fcntl.h>

main()
{
	int	i, j, fd;
	char	buf[65], buf2[513];

	setbuf(stdout, NULL);
	if ((fd = open("/dev/rwt0", O_WRONLY)) < 0)
	{
		perror("open");
		exit(1);
	}

	for (i = 0; i < 1000; i++)
	{
		*buf2 = '\0';
		for (j = 0; j < 10; j++)
		{
			sprintf(buf, "%04d.%d.--AAAAAAAAAABBBBBBBBBBCCCCCCCCCC"
				"DDDDDDDDDD\n", i, j);
			strcat(buf2, buf);
		}
		write(fd, buf2, 500);

		printf("%4d\r", i);
		if (!(i % 100))
			sleep(1);
	}
	close(fd);
}

-- 
Joergen Haegg				jh@efd.lth.se
System manager @ efd			Phone: international +46 46 107492
Lund Institute of Technology		Snailmail: DDG, Maildelivery 7, BOX 118
Fax: +46 46 104013			S-221 00 LUND, Sweden