home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / bsd / 11699 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.7 KB  |  66 lines

  1. Path: sparky!uunet!usc!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!news.lth.se!jh
  2. From: jh@efd.lth.se (Joergen Haegg)
  3. Newsgroups: comp.unix.bsd
  4. Subject: Problems with wt-driver, or rawwrite. (using QIC-02)
  5. Message-ID: <1993Jan22.091450.25072@lth.se>
  6. Date: 22 Jan 93 09:14:50 GMT
  7. Sender: news@lth.se
  8. Organization: Lund Institute of Technology, Sweden
  9. Lines: 55
  10.  
  11. I have a Everex 831 QIC-02 with a QIC36 streamer.
  12. Reading works OK, but writing is erroneous.
  13.  
  14. The problem seems to be that the wt-driver writes a record (512 byte)
  15. when the computer fails to feed the driver with data. So far all good.
  16. But it will write the record even if it is not completely filled with data!
  17. The result is that records are filled with nulls up to 512 byte.
  18.  
  19. No data loss, instead a lot of extra nulls appear when I read from the tape.
  20. Makes tar crazy...
  21.  
  22. It might also be the rawwrite-routine which is incorrect, I don't know.
  23.  
  24. The following program demonstrates the problem.
  25. Try it and read the result back with dd. Examine with less.
  26.  
  27.  
  28. #include <stdio.h>
  29. #include <fcntl.h>
  30.  
  31. main()
  32. {
  33.     int    i, j, fd;
  34.     char    buf[65], buf2[513];
  35.  
  36.     setbuf(stdout, NULL);
  37.     if ((fd = open("/dev/rwt0", O_WRONLY)) < 0)
  38.     {
  39.         perror("open");
  40.         exit(1);
  41.     }
  42.  
  43.     for (i = 0; i < 1000; i++)
  44.     {
  45.         *buf2 = '\0';
  46.         for (j = 0; j < 10; j++)
  47.         {
  48.             sprintf(buf, "%04d.%d.--AAAAAAAAAABBBBBBBBBBCCCCCCCCCC"
  49.                 "DDDDDDDDDD\n", i, j);
  50.             strcat(buf2, buf);
  51.         }
  52.         write(fd, buf2, 500);
  53.  
  54.         printf("%4d\r", i);
  55.         if (!(i % 100))
  56.             sleep(1);
  57.     }
  58.     close(fd);
  59. }
  60.  
  61. -- 
  62. Joergen Haegg                jh@efd.lth.se
  63. System manager @ efd            Phone: international +46 46 107492
  64. Lund Institute of Technology        Snailmail: DDG, Maildelivery 7, BOX 118
  65. Fax: +46 46 104013            S-221 00 LUND, Sweden
  66.