home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / bsd / 5720 < prev    next >
Encoding:
Text File  |  1992-09-15  |  2.3 KB  |  63 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!barsoom!barsoom!tih
  3. From: tih@barsoom.nhh.no (Tom Ivar Helbekkmo)
  4. Subject: [386bsd] A bugfix to my modified wd driver!
  5. Message-ID: <tih.716534020@barsoom>
  6. Sender: news@barsoom.nhh.no (USENET News System)
  7. Organization: Norwegian School of Economics
  8. Date: Tue, 15 Sep 1992 05:13:40 GMT
  9. Lines: 52
  10.  
  11. Well, it turns out that there's a bug in the bad144 handling in my
  12. modified wd driver after all!  (And of course, luck (and insufficient
  13. testing on my part) caused me never to run into it because I only
  14. have bad sectors in partitions that start at the beginning of the
  15. disk!)
  16.  
  17. The problem was pointed out to me, with the fix, by Terry Lee
  18. (terry@uivlsi.csl.uiuc.edu), and is caused by not correcting the
  19. block numbers we're looking for for partition offset.  (In my code,
  20. I used a variable, blknum, that wasn't corrected originally because
  21. it was never used again.)
  22.  
  23. Thanks, Terry!
  24.  
  25. Here's the patch *to the last version of my wd.c*.  If you're picked
  26. up my stuff from barsoom.nhh.no, and this patch doesn't match your
  27. line numbers perfectly, ftp the wd.c file again.  There have been
  28. some efficiency updates lately...  :-)
  29.  
  30. *** wd.c.old    Tue Sep 15 06:55:09 1992
  31. --- wd.c    Tue Sep 15 06:55:15 1992
  32. ***************
  33. *** 418,429 ****
  34.       lp = &du->dk_dd;
  35.       secpertrk = lp->d_nsectors;
  36.       secpercyl = lp->d_secpercyl;
  37.       cylin = blknum / secpercyl;
  38.       head = (blknum % secpercyl) / secpertrk;
  39.       sector = blknum % secpertrk;
  40. -     if ((du->dk_flags & DKFL_BSDLABEL) != 0 && wdpart(bp->b_dev) != WDRAW)
  41. -     cylin += lp->d_partitions[wdpart(bp->b_dev)].p_offset
  42. -         / secpercyl;
  43.       
  44.   #ifdef TIHBAD144
  45.       /* Check for bad sectors if we have them, and not formatting */
  46. --- 418,428 ----
  47.       lp = &du->dk_dd;
  48.       secpertrk = lp->d_nsectors;
  49.       secpercyl = lp->d_secpercyl;
  50. +     if ((du->dk_flags & DKFL_BSDLABEL) != 0 && wdpart(bp->b_dev) != WDRAW)
  51. +     blknum += lp->d_partitions[wdpart(bp->b_dev)].p_offset;
  52.       cylin = blknum / secpercyl;
  53.       head = (blknum % secpercyl) / secpertrk;
  54.       sector = blknum % secpertrk;
  55.       
  56.   #ifdef TIHBAD144
  57.       /* Check for bad sectors if we have them, and not formatting */
  58.  
  59. -tih
  60. --
  61. Tom Ivar Helbekkmo, NHH, Bergen, Norway.  Telephone: +47-5-959205
  62. Postmaster for domain nhh.no.   Internet mail: tih@barsoom.nhh.no
  63.