1 /* 2 * Copyright (c) 1982, 1986, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)dkbad.c 8.1 (Berkeley) 06/10/93 8 */ 9 10 #ifndef NOBADSECT 11 #include <sys/param.h> 12 #include <sys/buf.h> 13 #include <sys/dkbad.h> 14 15 /* 16 * Search the bad sector table looking for 17 * the specified sector. Return index if found. 18 * Return -1 if not found. 19 */ 20 21 isbad(bt, cyl, trk, sec) 22 register struct dkbad *bt; 23 { 24 register int i; 25 register long blk, bblk; 26 27 blk = ((long)cyl << 16) + (trk << 8) + sec; 28 for (i = 0; i < 126; i++) { 29 bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + bt->bt_bad[i].bt_trksec; 30 if (blk == bblk) 31 return (i); 32 if (blk < bblk || bblk < 0) 33 break; 34 } 35 return (-1); 36 } 37 #endif 38