summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_sunlabel_enc.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-21 19:42:36 +0000
committerphk <phk@FreeBSD.org>2003-04-21 19:42:36 +0000
commitd5b1803a962e483f67f929122f863e6a0aed0a9c (patch)
tree17288de78bbfd859fcaa80bc61fbd1924210b162 /sys/geom/geom_sunlabel_enc.c
parenta8a7c6ab615821a4e4294eaf7b3adc8833696fee (diff)
downloadFreeBSD-src-d5b1803a962e483f67f929122f863e6a0aed0a9c.zip
FreeBSD-src-d5b1803a962e483f67f929122f863e6a0aed0a9c.tar.gz
Use #defines from <sys/sun_disklabel.h> instead of private ones.
Diffstat (limited to 'sys/geom/geom_sunlabel_enc.c')
-rw-r--r--sys/geom/geom_sunlabel_enc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/geom/geom_sunlabel_enc.c b/sys/geom/geom_sunlabel_enc.c
index afa3e0b..f2b5df3 100644
--- a/sys/geom/geom_sunlabel_enc.c
+++ b/sys/geom/geom_sunlabel_enc.c
@@ -52,10 +52,6 @@
#define SL_MAGIC 0x1fc
#define SL_CKSUM 0x1fe
-#define SL_LENGTH 0x200
-
-#define SL_NPART 0x8
-
#define SDKP_CYLOFFSET 0
#define SDKP_NSECTORS 0x4
#define SDKP_SIZEOF 0x8
@@ -82,14 +78,14 @@ sunlabel_dec(void const *pp, struct sun_disklabel *sl)
sl->sl_acylinders = be16dec(p + SL_ACYLINDERS);
sl->sl_ntracks = be16dec(p + SL_NTRACKS);
sl->sl_nsectors = be16dec(p + SL_NSECTORS);
- for (i = 0; i < SL_NPART; i++) {
+ for (i = 0; i < SUN_NPART; i++) {
sl->sl_part[i].sdkp_cyloffset = be32dec(p + SL_PART +
(i * SDKP_SIZEOF) + SDKP_CYLOFFSET);
sl->sl_part[i].sdkp_nsectors = be32dec(p + SL_PART +
(i * SDKP_SIZEOF) + SDKP_NSECTORS);
}
sl->sl_magic = be16dec(p + SL_MAGIC);
- for (i = u = 0; i < SL_LENGTH; i += 2)
+ for (i = u = 0; i < SUN_SIZE; i += 2)
u ^= be16dec(p + i);
if (u == 0 && sl->sl_magic == SUN_DKMAGIC)
return (0);
@@ -118,14 +114,14 @@ sunlabel_enc(void *pp, struct sun_disklabel *sl)
be16enc(p + SL_ACYLINDERS, sl->sl_acylinders);
be16enc(p + SL_NTRACKS, sl->sl_ntracks);
be16enc(p + SL_NSECTORS, sl->sl_nsectors);
- for (i = 0; i < SL_NPART; i++) {
+ for (i = 0; i < SUN_NPART; i++) {
be32enc(p + SL_PART + (i * SDKP_SIZEOF) + SDKP_CYLOFFSET,
sl->sl_part[i].sdkp_cyloffset);
be32enc(p + SL_PART + (i * SDKP_SIZEOF) + SDKP_NSECTORS,
sl->sl_part[i].sdkp_nsectors);
}
be16enc(p + SL_MAGIC, sl->sl_magic);
- for (i = u = 0; i < SL_LENGTH; i += 2)
+ for (i = u = 0; i < SUN_SIZE; i += 2)
u ^= be16dec(p + i);
be16enc(p + SL_CKSUM, u);
}
OpenPOWER on IntegriCloud