Nake return values from bounds_check_with_label() conform to the man

page: -1 for error, 0 for EOF, 1 otherwise. Inspired by an OpenBSD commit
message, pointed out by Miod Vallat in private mail.
vax/mba/hp.c: check return value <= 0, not < 0 to be concistent with how
other places handle return values from bounds_check_with_label().
This commit is contained in:
bouyer 2003-04-16 15:00:59 +00:00
parent cb61d88cb5
commit aec10dd80c
22 changed files with 65 additions and 85 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.13 2003/01/19 10:06:12 tsutsui Exp $ */
/* $NetBSD: disksubr.c,v 1.14 2003/04/16 15:00:59 bouyer Exp $ */
/* $OpenBSD: disksubr.c,v 1.14 1997/05/08 00:14:29 deraadt Exp $ */
/* NetBSD: disksubr.c,v 1.40 1999/05/06 15:45:51 christos Exp */
@ -530,7 +530,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return 0;
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -558,6 +558,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.3 2002/08/27 17:30:02 thorpej Exp $ */
/* $NetBSD: disksubr.c,v 1.4 2003/04/16 15:01:00 bouyer Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
@ -404,7 +404,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -432,8 +432,7 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}
/* End of disksubr.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.9 2002/02/19 17:09:43 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.10 2003/04/16 15:01:01 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -483,7 +483,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -511,6 +511,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.7 2002/02/19 17:09:43 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.8 2003/04/16 15:01:01 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -424,7 +424,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -452,6 +452,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.2 2003/03/19 03:05:43 simonb Exp $ */
/* $NetBSD: disksubr.c,v 1.3 2003/04/16 15:01:01 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -271,5 +271,5 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
return (1);
bad:
bp->b_flags |= B_ERROR;
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.1 2003/03/04 07:51:01 matt Exp $ */
/* $NetBSD: disksubr.c,v 1.2 2003/04/16 15:01:02 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -278,7 +278,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -306,6 +306,5 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.1 2002/06/06 19:48:05 fredette Exp $ */
/* $NetBSD: disksubr.c,v 1.2 2003/04/16 15:01:02 bouyer Exp $ */
/* $OpenBSD: disksubr.c,v 1.6 2000/10/18 21:00:34 mickey Exp $ */
@ -854,7 +854,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -880,6 +880,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.3 2002/02/19 17:09:43 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.4 2003/04/16 15:01:03 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -469,7 +469,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -497,6 +497,5 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.48 2003/01/31 15:35:04 fvdl Exp $ */
/* $NetBSD: disksubr.c,v 1.49 2003/04/16 15:01:03 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.48 2003/01/31 15:35:04 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.49 2003/04/16 15:01:03 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -490,7 +490,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -518,6 +518,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.42 2002/06/29 19:44:52 scottr Exp $ */
/* $NetBSD: disksubr.c,v 1.43 2003/04/16 15:01:04 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -639,7 +639,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -669,6 +669,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.25 2002/09/28 01:17:10 dbj Exp $ */
/* $NetBSD: disksubr.c,v 1.26 2003/04/16 15:01:04 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -727,7 +727,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If axactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return 0;
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -746,6 +746,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return 0;
return -1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.2 2003/03/19 03:05:43 simonb Exp $ */
/* $NetBSD: disksubr.c,v 1.3 2003/04/16 15:01:05 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -481,7 +481,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -509,6 +509,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.11 2002/09/18 01:44:29 chs Exp $ */
/* $NetBSD: disksubr.c,v 1.12 2003/04/16 15:01:05 bouyer Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@ -340,7 +340,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If axactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return 0;
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -359,6 +359,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return 0;
return -1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.2 2002/02/19 17:09:47 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.3 2003/04/16 15:01:06 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -409,7 +409,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -437,6 +437,5 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.1 2002/05/30 08:51:38 augustss Exp $ */
/* $NetBSD: disksubr.c,v 1.2 2003/04/16 15:01:06 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -474,7 +474,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -502,6 +502,5 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.4 2002/02/19 17:09:48 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.5 2003/04/16 15:01:07 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -482,7 +482,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -510,6 +510,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.2 2002/02/19 17:09:48 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.3 2003/04/16 15:01:07 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -481,7 +481,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -509,6 +509,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.3 2003/03/19 03:05:44 simonb Exp $ */
/* $NetBSD: disksubr.c,v 1.4 2003/04/16 15:01:08 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -424,7 +424,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -452,6 +452,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.9 2002/07/22 15:11:09 tsutsui Exp $ */
/* $NetBSD: disksubr.c,v 1.10 2003/04/16 15:01:08 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -702,7 +702,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -730,6 +730,5 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hp.c,v 1.31 2002/11/01 11:31:55 mrg Exp $ */
/* $NetBSD: hp.c,v 1.32 2003/04/16 15:01:09 bouyer Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -193,7 +193,7 @@ hpstrategy(struct buf *bp)
lp = sc->sc_disk.dk_label;
err = bounds_check_with_label(bp, lp, sc->sc_wlabel);
if (err < 0)
if (err <= 0)
goto done;
bp->b_rawblkno =

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.17 2002/02/19 17:09:50 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.18 2003/04/16 15:01:09 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -491,7 +491,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -519,8 +519,7 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.2 2002/02/19 17:09:50 wiz Exp $ */
/* $NetBSD: disksubr.c,v 1.3 2003/04/16 15:01:10 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -487,7 +487,7 @@ bounds_check_with_label(bp, lp, wlabel)
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
return (0);
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
@ -515,6 +515,5 @@ bounds_check_with_label(bp, lp, wlabel)
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
return (-1);
}