-static inline void
-byte_swap_disklabel_common(disk_label_t *dl)
-{
- swapBigLongToHost(dl->dl_version); /* ditto */
- swapBigLongToHost(dl->dl_label_blkno);
- swapBigLongToHost(dl->dl_size);
- swapBigLongToHost(dl->dl_flags);
- swapBigLongToHost(dl->dl_tag);
-// swapBigShortToHost(dl->dl_checksum);
-// if (dl->dl_version >= DL_V3)
-// swapBigShortToHost(dl->dl_un.DL_v3_checksum);
-// else
-// swapBigIntsToHost(dl->dl_un.DL_bad, NBAD);
-}
-
-void
-byte_swap_disklabel_in(disk_label_t *dl)
-{
- byte_swap_disklabel_common(dl);
- byte_swap_disktab_in(&dl->dl_dt);
-}
-
-static inline void
-byte_swap_disktab_common(struct disktab *dt)
-{
- register unsigned int i;
-
- swapBigLongToHost(dt->d_secsize);
- swapBigLongToHost(dt->d_ntracks);
- swapBigLongToHost(dt->d_nsectors);
- swapBigLongToHost(dt->d_ncylinders);
-// swapBigLongToHost(dt->d_rpm);
- swapBigShortToHost(dt->d_front);
- swapBigShortToHost(dt->d_back);
-// swapBigShortToHost(dt->d_ngroups);
-// swapBigShortToHost(dt->d_ag_size);
-// swapBigShortToHost(dt->d_ag_alts);
-// swapBigShortToHost(dt->d_ag_off);
-// swapBigIntsToHost(dt->d_boot0_blkno, NBOOTS);
-
- for (i=0; i < NPART; i++)
- byte_swap_partition(&dt->d_partitions[i]);
-}
-
-/*
- * This is particularly grody. The beginning of the partition array is two
- * bytes low on the 68 wrt natural alignment rules. Furthermore, each
- * element of the partition table is two bytes smaller on 68k due to padding
- * at the end of the struct.
- */
-void
-byte_swap_disktab_in(struct disktab *dt)
-{
- struct partition * pp;
- int i;
-
- /*
- * Shift each struct partition up in memory by 2 + 2 * offset bytes.
- * Do it backwards so we don't overwrite anything.
- */
- for (i=NPART - 1; i >=0; i--) {
- struct partition temp;
- pp = &dt->d_partitions[i];
- /* beware: compiler doesn't do overlapping struct assignment */
- temp = *(struct partition *)(((char *) pp) - 2 * (i + 1));
- *pp = temp;
- }
-
- byte_swap_disktab_common(dt);
-}
-
-void
-byte_swap_partition(struct partition *part)
-{
- swapBigLongToHost(part->p_base);
- swapBigLongToHost(part->p_size);
- swapBigShortToHost(part->p_bsize);
- swapBigShortToHost(part->p_fsize);
- swapBigShortToHost(part->p_cpg);
- swapBigShortToHost(part->p_density);
-}