Need some casts to char* for pointer arithmetic, following caddr_t removal.

This commit is contained in:
he 2007-03-05 15:36:26 +00:00
parent 23e49d8fa8
commit b4a156898e
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.12 2006/11/25 11:59:57 scw Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2007/03/05 15:36:26 he Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.12 2006/11/25 11:59:57 scw Exp $");
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.13 2007/03/05 15:36:26 he Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -71,12 +71,13 @@ mbr_findslice(dp, bp)
int i;
/* Note: Magic number is little-endian. */
mbrmagicp = (u_int16_t *)(bp->b_data + MBR_MAGIC_OFFSET);
mbrmagicp = (u_int16_t *)((char*)bp->b_data + MBR_MAGIC_OFFSET);
if (*mbrmagicp != MBR_MAGIC)
return (NO_MBR_SIGNATURE);
/* XXX how do we check veracity/bounds of this? */
memcpy(dp, bp->b_data + MBR_PART_OFFSET, MBR_PART_COUNT * sizeof(*dp));
memcpy(dp, (char*)bp->b_data + MBR_PART_OFFSET,
MBR_PART_COUNT * sizeof(*dp));
/* look for NetBSD partition */
for (i = 0; i < MBR_PART_COUNT; i++) {
@ -254,7 +255,7 @@ nombrpart:
goto done;
}
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp <= (struct disklabel *)((char*)bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
if (msg == NULL)
@ -440,7 +441,7 @@ nombrpart:
if ((error = biowait(bp)) != 0)
goto done;
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp <= (struct disklabel *)((char*)bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {