summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-06-09 00:39:26 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-06-09 00:39:26 +0000
commit081be1b89451f9644ad3c81d56ccfb4f813db023 (patch)
tree492fd438dcbb4e92d7d3a197661f145faafd3a51 /sys/arch
parentb07cb06fc402de2936a67c1b50dc1d3a249af301 (diff)
Eliminate some duplicate code. No functional change.
ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/mvme68k/mvme68k/disksubr.c171
-rw-r--r--sys/arch/mvme88k/mvme88k/disksubr.c171
2 files changed, 112 insertions, 230 deletions
diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c
index 41988697b2c..fa2175fc62c 100644
--- a/sys/arch/mvme68k/mvme68k/disksubr.c
+++ b/sys/arch/mvme68k/mvme68k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.49 2007/06/08 22:17:06 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.50 2007/06/09 00:39:25 krw Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -370,123 +370,64 @@ cputobsdlabel(struct disklabel *lp, struct cpu_disklabel *clp)
{
int i;
- lp->d_version = 0;
- if (clp->version == 0) {
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
- strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- if (DL_GETDSIZE(lp) == 0)
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_sparespertrack = clp->sparespertrack;
- lp->d_sparespercyl = clp->sparespercyl;
- lp->d_acylinders = clp->acylinders;
- lp->d_rpm = clp->rpm;
- lp->d_interleave = clp->cfg_ilv;
- lp->d_trackskew = clp->cfg_sof;
- lp->d_cylskew = clp->cylskew;
- lp->d_headswitch = clp->headswitch;
-
- /* this silly table is for winchester drives */
- switch (clp->cfg_ssr) {
- case 0:
- lp->d_trkseek = 0;
- break;
- case 1:
- lp->d_trkseek = 6;
- break;
- case 2:
- lp->d_trkseek = 10;
- break;
- case 3:
- lp->d_trkseek = 15;
- break;
- case 4:
- lp->d_trkseek = 20;
- break;
- default:
- lp->d_trkseek = 0;
- }
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
-
- lp->d_magic2 = clp->magic2;
- lp->d_checksum = clp->checksum;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
- bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
- bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
- } else {
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
- strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- if (DL_GETDSIZE(lp) == 0)
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_sparespertrack = clp->sparespertrack;
- lp->d_sparespercyl = clp->sparespercyl;
- lp->d_acylinders = clp->acylinders;
- lp->d_rpm = clp->rpm;
- lp->d_interleave = clp->cfg_ilv;
- lp->d_trackskew = clp->cfg_sof;
- lp->d_cylskew = clp->cylskew;
- lp->d_headswitch = clp->headswitch;
-
- /* this silly table is for winchester drives */
- switch (clp->cfg_ssr) {
- case 0:
- lp->d_trkseek = 0;
- break;
- case 1:
- lp->d_trkseek = 6;
- break;
- case 2:
- lp->d_trkseek = 10;
- break;
- case 3:
- lp->d_trkseek = 15;
- break;
- case 4:
- lp->d_trkseek = 20;
- break;
- default:
- lp->d_trkseek = 0;
- }
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
-
- lp->d_magic2 = clp->magic2;
- lp->d_checksum = clp->checksum;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
- bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
- bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
+ lp->d_magic = clp->magic1;
+ lp->d_type = clp->type;
+ lp->d_subtype = clp->subtype;
+ strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
+ strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
+ lp->d_secsize = clp->cfg_psm;
+ lp->d_nsectors = clp->cfg_spt;
+ lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
+ lp->d_ntracks = clp->cfg_hds;
+
+ lp->d_secpercyl = clp->secpercyl;
+ if (DL_GETDSIZE(lp) == 0)
+ DL_SETDSIZE(lp, clp->secperunit);
+ lp->d_sparespertrack = clp->sparespertrack;
+ lp->d_sparespercyl = clp->sparespercyl;
+ lp->d_acylinders = clp->acylinders;
+ lp->d_rpm = clp->rpm;
+ lp->d_interleave = clp->cfg_ilv;
+ lp->d_trackskew = clp->cfg_sof;
+ lp->d_cylskew = clp->cylskew;
+ lp->d_headswitch = clp->headswitch;
+
+ /* this silly table is for winchester drives */
+ switch (clp->cfg_ssr) {
+ case 1:
+ lp->d_trkseek = 6;
+ break;
+ case 2:
+ lp->d_trkseek = 10;
+ break;
+ case 3:
+ lp->d_trkseek = 15;
+ break;
+ case 4:
+ lp->d_trkseek = 20;
+ break;
+ default:
+ lp->d_trkseek = 0;
}
+ lp->d_flags = clp->flags;
+ for (i = 0; i < NDDATA; i++)
+ lp->d_drivedata[i] = clp->drivedata[i];
+ for (i = 0; i < NSPARE; i++)
+ lp->d_spare[i] = clp->spare[i];
+
+ lp->d_magic2 = clp->magic2;
+ lp->d_checksum = 0;
+ lp->d_npartitions = clp->partitions;
+ lp->d_bbsize = clp->bbsize;
+ lp->d_sbsize = clp->sbsize;
+
+ bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
+ bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
if (clp->version == 2)
lp->d_version = 1;
- lp->d_checksum = 0;
+ else
+ lp->d_version = 0;
+
lp->d_checksum = dkcksum(lp);
}
diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c
index 01b194c612b..34cf8b2bb92 100644
--- a/sys/arch/mvme88k/mvme88k/disksubr.c
+++ b/sys/arch/mvme88k/mvme88k/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.45 2007/06/08 22:17:10 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.46 2007/06/09 00:39:25 krw Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
@@ -370,123 +370,64 @@ cputobsdlabel(struct disklabel *lp, struct cpu_disklabel *clp)
{
int i;
- lp->d_version = 0;
- if (clp->version == 0) {
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
- strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- if (DL_GETDSIZE(lp) == 0)
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_sparespertrack = clp->sparespertrack;
- lp->d_sparespercyl = clp->sparespercyl;
- lp->d_acylinders = clp->acylinders;
- lp->d_rpm = clp->rpm;
- lp->d_interleave = clp->cfg_ilv;
- lp->d_trackskew = clp->cfg_sof;
- lp->d_cylskew = clp->cylskew;
- lp->d_headswitch = clp->headswitch;
-
- /* this silly table is for winchester drives */
- switch (clp->cfg_ssr) {
- case 0:
- lp->d_trkseek = 0;
- break;
- case 1:
- lp->d_trkseek = 6;
- break;
- case 2:
- lp->d_trkseek = 10;
- break;
- case 3:
- lp->d_trkseek = 15;
- break;
- case 4:
- lp->d_trkseek = 20;
- break;
- default:
- lp->d_trkseek = 0;
- }
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
-
- lp->d_magic2 = clp->magic2;
- lp->d_checksum = clp->checksum;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
- bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
- bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
- } else {
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
- strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- if (DL_GETDSIZE(lp) == 0)
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_sparespertrack = clp->sparespertrack;
- lp->d_sparespercyl = clp->sparespercyl;
- lp->d_acylinders = clp->acylinders;
- lp->d_rpm = clp->rpm;
- lp->d_interleave = clp->cfg_ilv;
- lp->d_trackskew = clp->cfg_sof;
- lp->d_cylskew = clp->cylskew;
- lp->d_headswitch = clp->headswitch;
-
- /* this silly table is for winchester drives */
- switch (clp->cfg_ssr) {
- case 0:
- lp->d_trkseek = 0;
- break;
- case 1:
- lp->d_trkseek = 6;
- break;
- case 2:
- lp->d_trkseek = 10;
- break;
- case 3:
- lp->d_trkseek = 15;
- break;
- case 4:
- lp->d_trkseek = 20;
- break;
- default:
- lp->d_trkseek = 0;
- }
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
-
- lp->d_magic2 = clp->magic2;
- lp->d_checksum = clp->checksum;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
- bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
- bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
+ lp->d_magic = clp->magic1;
+ lp->d_type = clp->type;
+ lp->d_subtype = clp->subtype;
+ strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
+ strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
+ lp->d_secsize = clp->cfg_psm;
+ lp->d_nsectors = clp->cfg_spt;
+ lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
+ lp->d_ntracks = clp->cfg_hds;
+
+ lp->d_secpercyl = clp->secpercyl;
+ if (DL_GETDSIZE(lp) == 0)
+ DL_SETDSIZE(lp, clp->secperunit);
+ lp->d_sparespertrack = clp->sparespertrack;
+ lp->d_sparespercyl = clp->sparespercyl;
+ lp->d_acylinders = clp->acylinders;
+ lp->d_rpm = clp->rpm;
+ lp->d_interleave = clp->cfg_ilv;
+ lp->d_trackskew = clp->cfg_sof;
+ lp->d_cylskew = clp->cylskew;
+ lp->d_headswitch = clp->headswitch;
+
+ /* this silly table is for winchester drives */
+ switch (clp->cfg_ssr) {
+ case 1:
+ lp->d_trkseek = 6;
+ break;
+ case 2:
+ lp->d_trkseek = 10;
+ break;
+ case 3:
+ lp->d_trkseek = 15;
+ break;
+ case 4:
+ lp->d_trkseek = 20;
+ break;
+ default:
+ lp->d_trkseek = 0;
}
+ lp->d_flags = clp->flags;
+ for (i = 0; i < NDDATA; i++)
+ lp->d_drivedata[i] = clp->drivedata[i];
+ for (i = 0; i < NSPARE; i++)
+ lp->d_spare[i] = clp->spare[i];
+
+ lp->d_magic2 = clp->magic2;
+ lp->d_checksum = 0;
+ lp->d_npartitions = clp->partitions;
+ lp->d_bbsize = clp->bbsize;
+ lp->d_sbsize = clp->sbsize;
+
+ bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
+ bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
if (clp->version == 2)
lp->d_version = 1;
- lp->d_checksum = 0;
+ else
+ lp->d_version = 0;
+
lp->d_checksum = dkcksum(lp);
}