I can't see any need to swap the bytes of d_checksum. As shown by
the large context, it's just set to 0 and recalculated.
ok?
.... Ken
Index: subr_disk.c
===================================================================
RCS file: /cvs/src/sys/kern/subr_disk.c,v
retrieving revision 1.130
diff -U21 -p -r1.130 subr_disk.c
--- subr_disk.c 6 Jul 2011 16:36:52 -0000 1.130
+++ subr_disk.c 23 Jul 2011 02:19:11 -0000
@@ -281,43 +281,42 @@ checkdisklabel(void *rlp, struct disklab
dlp->d_ntracks = swap32(dlp->d_ntracks);
dlp->d_ncylinders = swap32(dlp->d_ncylinders);
dlp->d_secpercyl = swap32(dlp->d_secpercyl);
dlp->d_secperunit = swap32(dlp->d_secperunit);
/* d_uid is a string */
dlp->d_acylinders = swap32(dlp->d_acylinders);
dlp->d_flags = swap32(dlp->d_flags);
for (i = 0; i < NDDATA; i++)
dlp->d_drivedata[i] = swap32(dlp->d_drivedata[i]);
dlp->d_secperunith = swap16(dlp->d_secperunith);
dlp->d_version = swap16(dlp->d_version);
for (i = 0; i < NSPARE; i++)
dlp->d_spare[i] = swap32(dlp->d_spare[i]);
dlp->d_magic2 = swap32(dlp->d_magic2);
- dlp->d_checksum = swap16(dlp->d_checksum);
dlp->d_npartitions = swap16(dlp->d_npartitions);
dlp->d_bbsize = swap32(dlp->d_bbsize);
dlp->d_sbsize = swap32(dlp->d_sbsize);
for (i = 0; i < MAXPARTITIONS; i++) {
pp = &dlp->d_partitions[i];
pp->p_size = swap32(pp->p_size);
pp->p_offset = swap32(pp->p_offset);
if (dlp->d_version == 0) {
v0pp = (struct __partitionv0 *)pp;
v0pp->p_fsize = swap32(v0pp->p_fsize);
} else {
pp->p_offseth = swap16(pp->p_offseth);
pp->p_sizeh = swap16(pp->p_sizeh);
}
pp->p_cpg = swap16(pp->p_cpg);
}
dlp->d_checksum = 0;
dlp->d_checksum = dkcksum(dlp);