|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)dkbad.c 7.1 (Berkeley) 6/5/86 ! 7: */ ! 8: ! 9: #ifndef NOBADSECT ! 10: #include "param.h" ! 11: #include "buf.h" ! 12: #include "dkbad.h" ! 13: ! 14: /* ! 15: * Search the bad sector table looking for ! 16: * the specified sector. Return index if found. ! 17: * Return -1 if not found. ! 18: */ ! 19: ! 20: isbad(bt, cyl, trk, sec) ! 21: register struct dkbad *bt; ! 22: { ! 23: register int i; ! 24: register long blk, bblk; ! 25: ! 26: blk = ((long)cyl << 16) + (trk << 8) + sec; ! 27: for (i = 0; i < 126; i++) { ! 28: bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + bt->bt_bad[i].bt_trksec; ! 29: if (blk == bblk) ! 30: return (i); ! 31: if (blk < bblk || bblk < 0) ! 32: break; ! 33: } ! 34: return (-1); ! 35: } ! 36: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.