Return to BSD News archive
Newsgroups: comp.unix.bsd Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sunic!aun.uninett.no!barsoom!barsoom!tih From: tih@barsoom.nhh.no (Tom Ivar Helbekkmo) Subject: [386bsd] A bugfix to my modified wd driver! Message-ID: <tih.716534020@barsoom> Sender: news@barsoom.nhh.no (USENET News System) Organization: Norwegian School of Economics Date: Tue, 15 Sep 1992 05:13:40 GMT Lines: 52 Well, it turns out that there's a bug in the bad144 handling in my modified wd driver after all! (And of course, luck (and insufficient testing on my part) caused me never to run into it because I only have bad sectors in partitions that start at the beginning of the disk!) The problem was pointed out to me, with the fix, by Terry Lee (terry@uivlsi.csl.uiuc.edu), and is caused by not correcting the block numbers we're looking for for partition offset. (In my code, I used a variable, blknum, that wasn't corrected originally because it was never used again.) Thanks, Terry! Here's the patch *to the last version of my wd.c*. If you're picked up my stuff from barsoom.nhh.no, and this patch doesn't match your line numbers perfectly, ftp the wd.c file again. There have been some efficiency updates lately... :-) *** wd.c.old Tue Sep 15 06:55:09 1992 --- wd.c Tue Sep 15 06:55:15 1992 *************** *** 418,429 **** lp = &du->dk_dd; secpertrk = lp->d_nsectors; secpercyl = lp->d_secpercyl; cylin = blknum / secpercyl; head = (blknum % secpercyl) / secpertrk; sector = blknum % secpertrk; - if ((du->dk_flags & DKFL_BSDLABEL) != 0 && wdpart(bp->b_dev) != WDRAW) - cylin += lp->d_partitions[wdpart(bp->b_dev)].p_offset - / secpercyl; #ifdef TIHBAD144 /* Check for bad sectors if we have them, and not formatting */ --- 418,428 ---- lp = &du->dk_dd; secpertrk = lp->d_nsectors; secpercyl = lp->d_secpercyl; + if ((du->dk_flags & DKFL_BSDLABEL) != 0 && wdpart(bp->b_dev) != WDRAW) + blknum += lp->d_partitions[wdpart(bp->b_dev)].p_offset; cylin = blknum / secpercyl; head = (blknum % secpercyl) / secpertrk; sector = blknum % secpertrk; #ifdef TIHBAD144 /* Check for bad sectors if we have them, and not formatting */ -tih -- Tom Ivar Helbekkmo, NHH, Bergen, Norway. Telephone: +47-5-959205 Postmaster for domain nhh.no. Internet mail: tih@barsoom.nhh.no