4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / sys / hp300 / hp300 / dkbad.c
CommitLineData
88a7e859 1/*
921517e8
KB
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
88a7e859
KM
4 *
5 * %sccs.include.redist.c%
6 *
921517e8 7 * @(#)dkbad.c 8.1 (Berkeley) %G%
88a7e859
KM
8 */
9
10#ifndef NOBADSECT
38a01dbe
KB
11#include <sys/param.h>
12#include <sys/buf.h>
13#include <sys/dkbad.h>
88a7e859
KM
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
21isbad(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