Cast to char* to be able to do pointer arithmetic.
This commit is contained in:
parent
1aecca529f
commit
9ebf1fa4d2
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: disksubr.c,v 1.24 2006/11/25 11:59:57 scw Exp $ */
|
/* $NetBSD: disksubr.c,v 1.25 2007/03/08 21:50:25 he Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
|
||||||
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.24 2006/11/25 11:59:57 scw Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.25 2007/03/08 21:50:25 he Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -87,7 +87,8 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
|||||||
if (biowait(bp))
|
if (biowait(bp))
|
||||||
msg = "I/O error";
|
msg = "I/O error";
|
||||||
else for (dlp = (struct disklabel *)bp->b_data;
|
else for (dlp = (struct disklabel *)bp->b_data;
|
||||||
dlp <= (struct disklabel *)(bp->b_data + DEV_BSIZE - sizeof(*dlp));
|
dlp <= (struct disklabel *)((char *)bp->b_data + DEV_BSIZE -
|
||||||
|
sizeof(*dlp));
|
||||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||||
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
@ -172,7 +173,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
|||||||
goto done;
|
goto done;
|
||||||
for (dlp = (struct disklabel *)bp->b_data;
|
for (dlp = (struct disklabel *)bp->b_data;
|
||||||
dlp <= (struct disklabel *)
|
dlp <= (struct disklabel *)
|
||||||
(bp->b_data + lp->d_secsize - sizeof(*dlp));
|
((char *)bp->b_data + lp->d_secsize - sizeof(*dlp));
|
||||||
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
|
||||||
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
|
||||||
dkcksum(dlp) == 0) {
|
dkcksum(dlp) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user