if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
if (bp->b_blkno + p->p_offset <= labelsect &&
int	cpu_writedisklabel __P((dev_t, void (*)(struct buf *),	    struct disklabel *, struct cpu_disklabel *));/* * Determine the size of the transfer, and make sure it is * within the boundaries of the partition. Adjust transfer * if needed, and signal errors or early completion. */intbounds_check_with_label(bp, lp, wlabel)	struct	buf *bp;	struct	disklabel *lp;	int	wlabel;{	struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);	int labelsect = lp->d_partitions[2].p_offset;	int maxsz = p->p_size,		sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;	/* overwriting disk label ? */	if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&#if LABELSECTOR != 0	    bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&#endif	    (bp->b_flags & B_READ) == 0 && wlabel == 0) {		bp->b_error = EROFS;		goto bad;	}	/* beyond partition? */	if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {		/* if exactly at end of disk, return an EOF */		if (bp->b_blkno == maxsz) {			bp->b_resid = bp->b_bcount;			return(0);		}		/* or truncate if part of it fits */		sz = maxsz - bp->b_blkno;		if (sz <= 0) {			bp->b_error = EINVAL;			goto bad;		}		bp->b_bcount = sz << DEV_BSHIFT;	}	/* calculate cylinder for disksort to order transfers with */	bp->b_cylin = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;	return(1);bad:	bp->b_flags |= B_ERROR;	return(-1);}