summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-10-01 20:28:13 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-10-01 20:28:13 +0000
commit4ab23710cdd747c81b3f3a7ed37e7d39167ada08 (patch)
tree239c6bd620e40ad8f1875e27f121137271ae3a23
parente6a0a6e216ba3a5bebbb9dc72bd315eb388b8083 (diff)
Use DOS_LABELSECTOR rather than LABELSECTOR to indicate offset into an
OpenBSD partition when accessing the disklabel. For these files both are '1', but this makes the usage consistent across all archs. ok guenther@ miod@
-rw-r--r--sys/arch/amd64/stand/efiboot/efidev.c7
-rw-r--r--sys/arch/amd64/stand/libsa/biosdev.c7
-rw-r--r--sys/arch/amd64/stand/libsa/softraid.c7
-rw-r--r--sys/arch/armish/stand/boot/wd.c4
-rw-r--r--sys/arch/i386/stand/libsa/biosdev.c7
-rw-r--r--sys/arch/i386/stand/libsa/softraid.c7
-rw-r--r--sys/arch/loongson/stand/boot/dev.c4
-rw-r--r--sys/arch/socppc/stand/boot/wd.c4
8 files changed, 21 insertions, 26 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efidev.c b/sys/arch/amd64/stand/efiboot/efidev.c
index 04f96d2e57d..7a6a1b5581e 100644
--- a/sys/arch/amd64/stand/efiboot/efidev.c
+++ b/sys/arch/amd64/stand/efiboot/efidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efidev.c,v 1.5 2015/09/12 21:55:14 yasuoka Exp $ */
+/* $OpenBSD: efidev.c,v 1.6 2015/10/01 20:28:12 krw Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -353,15 +353,14 @@ efi_getdisklabel(efi_diskinfo_t ed, struct disklabel *label)
return (err);
return "no OpenBSD partition\n";
}
- start = LABELSECTOR + start;
/* Load BSD disklabel */
#ifdef BIOS_DEBUG
if (debug)
- printf("loading disklabel @ %u\n", start);
+ printf("loading disklabel @ %u\n", start + DOS_LABELSECTOR);
#endif
/* read disklabel */
- error = efid_io(F_READ, ed, start, 1, buf);
+ error = efid_io(F_READ, ed, start + DOS_LABELSECTOR, 1, buf);
if (error)
return "failed to read disklabel";
diff --git a/sys/arch/amd64/stand/libsa/biosdev.c b/sys/arch/amd64/stand/libsa/biosdev.c
index eafbe08fcab..0f91d8ff2e0 100644
--- a/sys/arch/amd64/stand/libsa/biosdev.c
+++ b/sys/arch/amd64/stand/libsa/biosdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosdev.c,v 1.26 2015/10/01 16:16:23 krw Exp $ */
+/* $OpenBSD: biosdev.c,v 1.27 2015/10/01 20:28:12 krw Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -441,15 +441,14 @@ bios_getdisklabel(bios_diskinfo_t *bd, struct disklabel *label)
return "no OpenBSD partition\n";
}
}
- start = LABELSECTOR + start;
/* Load BSD disklabel */
#ifdef BIOS_DEBUG
if (debug)
- printf("loading disklabel @ %u\n", start);
+ printf("loading disklabel @ %u\n", start + DOS_LABELSECTOR);
#endif
/* read disklabel */
- error = biosd_io(F_READ, bd, start, 1, buf);
+ error = biosd_io(F_READ, bd, start + DOS_LABELSECTOR, 1, buf);
if (error)
return "failed to read disklabel";
diff --git a/sys/arch/amd64/stand/libsa/softraid.c b/sys/arch/amd64/stand/libsa/softraid.c
index 992b59b954a..bf46d86b85e 100644
--- a/sys/arch/amd64/stand/libsa/softraid.c
+++ b/sys/arch/amd64/stand/libsa/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.12 2015/09/02 01:52:26 yasuoka Exp $ */
+/* $OpenBSD: softraid.c,v 1.13 2015/10/01 20:28:12 krw Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
@@ -421,10 +421,9 @@ sr_getdisklabel(struct sr_boot_volume *bv, struct disklabel *label)
}
}
- start += LABELSECTOR;
-
/* Read the disklabel. */
- sr_strategy(bv, F_READ, start, sizeof(struct disklabel), buf, NULL);
+ sr_strategy(bv, F_READ, start + DOS_LABELSECTOR,
+ sizeof(struct disklabel), buf, NULL);
#ifdef BIOS_DEBUG
printf("sr_getdisklabel: magic %lx\n",
diff --git a/sys/arch/armish/stand/boot/wd.c b/sys/arch/armish/stand/boot/wd.c
index bf384af899d..1447582611f 100644
--- a/sys/arch/armish/stand/boot/wd.c
+++ b/sys/arch/armish/stand/boot/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.12 2015/10/01 16:08:19 krw Exp $ */
+/* $OpenBSD: wd.c,v 1.13 2015/10/01 20:28:12 krw Exp $ */
/* $NetBSD: wd.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */
/*-
@@ -181,7 +181,7 @@ wdgetdisklabel(wd)
}
}
- if (wdstrategy(wd, F_READ, sector + LABELSECTOR, DEV_BSIZE,
+ if (wdstrategy(wd, F_READ, sector + DOS_LABELSECTOR, DEV_BSIZE,
buf, &rsize))
return EOFFSET;
diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c
index 8725de1f005..19cfa3b77a7 100644
--- a/sys/arch/i386/stand/libsa/biosdev.c
+++ b/sys/arch/i386/stand/libsa/biosdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosdev.c,v 1.91 2015/09/19 21:07:04 semarie Exp $ */
+/* $OpenBSD: biosdev.c,v 1.92 2015/10/01 20:28:12 krw Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -442,15 +442,14 @@ bios_getdisklabel(bios_diskinfo_t *bd, struct disklabel *label)
return "no OpenBSD partition\n";
}
}
- start = LABELSECTOR + start;
/* Load BSD disklabel */
#ifdef BIOS_DEBUG
if (debug)
- printf("loading disklabel @ %u\n", start);
+ printf("loading disklabel @ %u\n", start + DOS_LABELSECTOR);
#endif
/* read disklabel */
- error = biosd_io(F_READ, bd, start, 1, buf);
+ error = biosd_io(F_READ, bd, start + DOS_LABELSECTOR, 1, buf);
if (error)
return "failed to read disklabel";
diff --git a/sys/arch/i386/stand/libsa/softraid.c b/sys/arch/i386/stand/libsa/softraid.c
index 2f45421f6fb..bf46d86b85e 100644
--- a/sys/arch/i386/stand/libsa/softraid.c
+++ b/sys/arch/i386/stand/libsa/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.12 2015/09/02 04:09:24 yasuoka Exp $ */
+/* $OpenBSD: softraid.c,v 1.13 2015/10/01 20:28:12 krw Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
@@ -421,10 +421,9 @@ sr_getdisklabel(struct sr_boot_volume *bv, struct disklabel *label)
}
}
- start += LABELSECTOR;
-
/* Read the disklabel. */
- sr_strategy(bv, F_READ, start, sizeof(struct disklabel), buf, NULL);
+ sr_strategy(bv, F_READ, start + DOS_LABELSECTOR,
+ sizeof(struct disklabel), buf, NULL);
#ifdef BIOS_DEBUG
printf("sr_getdisklabel: magic %lx\n",
diff --git a/sys/arch/loongson/stand/boot/dev.c b/sys/arch/loongson/stand/boot/dev.c
index 5cd6f192b53..cd093a951bc 100644
--- a/sys/arch/loongson/stand/boot/dev.c
+++ b/sys/arch/loongson/stand/boot/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.7 2014/07/12 21:03:38 tedu Exp $ */
+/* $OpenBSD: dev.c,v 1.8 2015/10/01 20:28:12 krw Exp $ */
/*
* Copyright (c) 2010 Miodrag Vallat.
@@ -206,7 +206,7 @@ pmon_getdisklabel(struct pmon_iodata *pi)
}
}
- if (pmon_iostrategy(pi, F_READ, sector + LABELSECTOR, DEV_BSIZE,
+ if (pmon_iostrategy(pi, F_READ, sector + DOS_LABELSECTOR, DEV_BSIZE,
buf, &rsize))
return ENXIO;
diff --git a/sys/arch/socppc/stand/boot/wd.c b/sys/arch/socppc/stand/boot/wd.c
index 0f1c3c349af..c55e550eddc 100644
--- a/sys/arch/socppc/stand/boot/wd.c
+++ b/sys/arch/socppc/stand/boot/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.8 2015/10/01 16:08:20 krw Exp $ */
+/* $OpenBSD: wd.c,v 1.9 2015/10/01 20:28:12 krw Exp $ */
/* $NetBSD: wd.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */
/*-
@@ -200,7 +200,7 @@ wdgetdisklabel(wd)
}
}
- if (wdstrategy(wd, F_READ, sector + LABELSECTOR, DEV_BSIZE,
+ if (wdstrategy(wd, F_READ, sector + DOS_LABELSECTOR, DEV_BSIZE,
buf, &rsize))
return EOFFSET;