diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-01 17:20:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-01 17:20:37 +0000 |
commit | 982210ebf32f9c040aca497ce86c958098caf8a8 (patch) | |
tree | 391c60eb2973a8379055bd62d91f0213bd5b49e5 | |
parent | 38ea65ae3d5e4b8f11597ab027f386599ca38925 (diff) |
Add the function isbad(), needed by xd/xy drivers
-rw-r--r-- | sys/arch/sun3/sun3/disksubr.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/sys/arch/sun3/sun3/disksubr.c b/sys/arch/sun3/sun3/disksubr.c index 8167194c3f9..779d1569831 100644 --- a/sys/arch/sun3/sun3/disksubr.c +++ b/sys/arch/sun3/sun3/disksubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.9 1995/05/30 15:38:14 gwr Exp $ */ +/* $NetBSD: disksubr.c,v 1.9.2.1 1995/10/30 23:36:34 gwr Exp $ */ /* * Copyright (c) 1994, 1995 Gordon W. Ross @@ -46,10 +46,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/buf.h> -#include <sys/disklabel.h> - #include <sys/device.h> +#include <sys/disklabel.h> #include <sys/disk.h> +#include <sys/dkbad.h> #include <machine/sun_disklabel.h> @@ -424,3 +424,27 @@ disklabel_bsd_to_sun(lp, cp) return(0); } + +/* + * Search the bad sector table looking for the specified sector. + * Return index if found. + * Return -1 if not found. + */ +int +isbad(bt, cyl, trk, sec) + register struct dkbad *bt; +{ + register int i; + register long blk, bblk; + + blk = ((long)cyl << 16) + (trk << 8) + sec; + for (i = 0; i < 126; i++) { + bblk = ((long)bt->bt_bad[i].bt_cyl << 16) + + bt->bt_bad[i].bt_trksec; + if (blk == bblk) + return (i); + if (blk < bblk || bblk < 0) + break; + } + return (-1); +} |