|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)dkbad.c 7.1 (Berkeley) 5/8/90 ! 21: */ ! 22: ! 23: #ifndef NOBADSECT ! 24: #include "param.h" ! 25: #include "buf.h" ! 26: #include "dkbad.h" ! 27: ! 28: /* ! 29: * Search the bad sector table looking for ! 30: * the specified sector. Return index if found. ! 31: * Return -1 if not found. ! 32: */ ! 33: ! 34: isbad(bt, cyl, trk, sec) ! 35: register struct dkbad *bt; ! 36: { ! 37: register int i; ! 38: register long blk, bblk; ! 39: ! 40: blk = ((long)cyl << 16) + (trk << 8) + sec; ! 41: for (i = 0; i < 126; i++) { ! 42: bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + bt->bt_bad[i].bt_trksec; ! 43: if (blk == bblk) ! 44: return (i); ! 45: if (blk < bblk || bblk < 0) ! 46: break; ! 47: } ! 48: return (-1); ! 49: } ! 50: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.