summaryrefslogtreecommitdiff
path: root/sys/arch/mac68k
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r--sys/arch/mac68k/mac68k/disksubr.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c
index 4455c2014c5..26b7214ec91 100644
--- a/sys/arch/mac68k/mac68k/disksubr.c
+++ b/sys/arch/mac68k/mac68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.34 2007/05/31 16:05:50 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.35 2007/05/31 19:57:43 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */
/*
@@ -558,13 +558,10 @@ done:
* if needed, and signal errors or early completion.
*/
int
-bounds_check_with_label(bp, lp, osdep, wlabel)
- struct buf *bp;
- struct disklabel *lp;
- struct cpu_disklabel *osdep;
- int wlabel;
+bounds_check_with_label(struct buf *bp, struct disklabel *lp,
+ struct cpu_disklabel *osdep, int wlabel)
{
-#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE))
+#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE))
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int labelsect = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) +
LABELSECTOR;
@@ -580,15 +577,16 @@ bounds_check_with_label(bp, lp, osdep, wlabel)
if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) {
sz = blockpersec(p->p_size, lp) - bp->b_blkno;
if (sz == 0) {
- /* if exactly at end of disk, return an EOF */
+ /* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
}
if (sz <= 0) {
+ /* If past end of disk, return EINVAL. */
bp->b_error = EINVAL;
goto bad;
}
- /* or truncate if part of it fits */
+ /* Otherwise, truncate request. */
bp->b_bcount = sz << DEV_BSHIFT;
}