diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-07-01 16:50:34 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-07-01 16:50:34 +0000 |
commit | b545b1cfa11001abb9631403bb55140b333a62e9 (patch) | |
tree | 62374e5b8097be1d763970a98ab9a508b60343da /sys/arch/macppc | |
parent | 7937c561d78b712d86ccecc567ac3775851bb59d (diff) |
Eliminate redundant get_le() in favour of letoh32(). Add letoh32()
calls in alpha, hppa, hppa64 and mips63 when accessing the two DOS MBR
u_int32_t fields dp_size and dp_start.
No functional change.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r-- | sys/arch/macppc/include/disklabel.h | 16 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/disksubr.c | 36 |
2 files changed, 19 insertions, 33 deletions
diff --git a/sys/arch/macppc/include/disklabel.h b/sys/arch/macppc/include/disklabel.h index 07ae6dc615b..c6b3e749b29 100644 --- a/sys/arch/macppc/include/disklabel.h +++ b/sys/arch/macppc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.6 2006/06/26 23:11:31 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.7 2006/07/01 16:50:33 krw Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -84,20 +84,6 @@ struct dos_partition { #define DPSECT(s) ((s) & 0x3f) #define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) -static __inline u_int32_t get_le(void *); - -static __inline u_int32_t -get_le(void *p) -{ - u_int8_t *_p = (u_int8_t *)p; - u_int32_t x; - x = _p[0]; - x |= _p[1] << 8; - x |= _p[2] << 16; - x |= _p[3] << 24; - return x; -} - /* HFS/DPME */ /* partition map structure from Inside Macintosh: Devices, SCSI Manager diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index 9b564f34062..e6906a918ca 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.17 2006/06/26 23:11:31 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.18 2006/07/01 16:50:33 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -213,17 +213,17 @@ hfs_done: /* Search for our MBR partition */ for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_OPENBSD) ourpart = i; for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_FREEBSD) ourpart = i; for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_NETBSD) ourpart = i; if (ourpart == -1) @@ -234,15 +234,15 @@ hfs_done: * cylinder for ESDI/ST506/RLL */ dp2 = &dp[ourpart]; - dospartoff = get_le(&dp2->dp_start) + + dospartoff = letoh32(dp2->dp_start) + part_blkno; cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); /* XXX build a temporary disklabel */ lp->d_partitions[0].p_size = - get_le(&dp2->dp_size); + letoh32(dp2->dp_size); lp->d_partitions[0].p_offset = - get_le(&dp2->dp_start) + part_blkno; + letoh32(dp2->dp_start) + part_blkno; if (lp->d_ntracks == 0) lp->d_ntracks = dp2->dp_ehd + 1; if (lp->d_nsectors == 0) @@ -261,13 +261,13 @@ donot: if (dp2->dp_typ == DOSPTYP_OPENBSD) continue; - if (get_le(&dp2->dp_size) > lp->d_secperunit) + if (letoh32(dp2->dp_size) > lp->d_secperunit) continue; - if (get_le(&dp2->dp_size)) - pp->p_size = get_le(&dp2->dp_size); - if (get_le(&dp2->dp_start)) + if (letoh32(dp2->dp_size)) + pp->p_size = letoh32(dp2->dp_size); + if (letoh32(dp2->dp_start)) pp->p_offset = - get_le(&dp2->dp_start) + part_blkno; + letoh32(dp2->dp_start) + part_blkno; switch (dp2->dp_typ) { case DOSPTYP_UNUSED: @@ -301,9 +301,9 @@ donot: break; case DOSPTYP_EXTEND: case DOSPTYP_EXTENDL: - part_blkno = get_le(&dp2->dp_start) + extoff; + part_blkno = letoh32(dp2->dp_start) + extoff; if (!extoff) { - extoff = get_le(&dp2->dp_start); + extoff = letoh32(dp2->dp_start); part_blkno = 0; } wander = 1; @@ -522,15 +522,15 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, NDOSPART * sizeof(*dp)); for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_OPENBSD) ourpart = i; for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_FREEBSD) ourpart = i; for (dp2=dp, i=0; i < NDOSPART && ourpart == -1; i++, dp2++) - if (get_le(&dp2->dp_size) && dp2->dp_typ == + if (letoh32(dp2->dp_size) && dp2->dp_typ == DOSPTYP_NETBSD) ourpart = i; @@ -541,7 +541,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, * need sector address for SCSI/IDE, * cylinder for ESDI/ST506/RLL */ - dospartoff = get_le(&dp2->dp_start); + dospartoff = letoh32(dp2->dp_start); cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); } } |