diff options
author | 2012-01-11 15:17:48 +0000 | |
---|---|---|
committer | 2012-01-11 15:17:48 +0000 | |
commit | e066a18bc2503174406103cd9d237bc6e8bcab4c (patch) | |
tree | 4d2564e0e0523fe48d05497fd26a0359e5791c88 | |
parent | Teach OpenBSD/amd64 boot(8) how to access softraid(8) volumes. This (diff) | |
download | wireguard-openbsd-e066a18bc2503174406103cd9d237bc6e8bcab4c.tar.xz wireguard-openbsd-e066a18bc2503174406103cd9d237bc6e8bcab4c.zip |
Move softraid root mapping to later in the boot process - this will allow
us to play some tricks in setroot().
-rw-r--r-- | sys/dev/softraid.c | 17 | ||||
-rw-r--r-- | sys/kern/subr_disk.c | 10 |
2 files changed, 21 insertions, 6 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index e50b1c3c2fa..d0433a4d159 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.264 2012/01/11 14:10:50 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.265 2012/01/11 15:17:48 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -73,9 +73,12 @@ uint32_t sr_debug = 0 ; #endif +struct sr_softc *softraid0; + int sr_match(struct device *, void *, void *); void sr_attach(struct device *, struct device *, void *); int sr_detach(struct device *, int); +void sr_map_root(void); struct cfattach softraid_ca = { sizeof(struct sr_softc), sr_match, sr_attach, sr_detach, @@ -122,7 +125,6 @@ void sr_uuid_get(struct sr_uuid *); void sr_uuid_print(struct sr_uuid *, int); void sr_checksum_print(u_int8_t *); int sr_boot_assembly(struct sr_softc *); -void sr_map_root(struct sr_softc *); int sr_already_assembled(struct sr_discipline *); int sr_hotspare(struct sr_softc *, dev_t); void sr_hotspare_rebuild(struct sr_discipline *); @@ -1479,13 +1481,17 @@ unwind: } void -sr_map_root(struct sr_softc *sc) +sr_map_root(void) { + struct sr_softc *sc = softraid0; struct sr_meta_opt_item *omi; struct sr_meta_boot *sbm; u_char duid[8]; int i, j; + if (sc == NULL) + return; + DNPRINTF(SR_D_MISC, "%s: sr_map_root\n", DEVNAME(sc)); bzero(duid, sizeof(duid)); if (bcmp(rootduid, duid, sizeof(duid)) == 0) { @@ -1758,6 +1764,9 @@ sr_attach(struct device *parent, struct device *self, void *aux) DNPRINTF(SR_D_MISC, "\n%s: sr_attach", DEVNAME(sc)); + if (softraid0 == NULL) + softraid0 = sc; + rw_init(&sc->sc_lock, "sr_lock"); rw_init(&sc->sc_hs_lock, "sr_hs_lock"); @@ -1796,8 +1805,6 @@ sr_attach(struct device *parent, struct device *self, void *aux) sc->sc_shutdownhook = shutdownhook_establish(sr_shutdownhook, sc); sr_boot_assembly(sc); - - sr_map_root(sc); } int diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 35664552ebc..af42b879752 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.135 2011/12/28 16:02:45 jsing Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.136 2012/01/11 15:17:48 jsing Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -67,6 +67,8 @@ #include <dev/rndvar.h> #include <dev/cons.h> +#include "softraid.h" + /* * A global list of all disks attached to the system. May grow or * shrink over time. @@ -83,6 +85,8 @@ u_char rootduid[8]; /* DUID of root disk. */ /* softraid callback, do not use! */ void (*softraid_disk_attach)(struct disk *, int); +void sr_map_root(void); + void disk_attach_callback(void *, void *); /* @@ -1166,6 +1170,10 @@ setroot(struct device *bootdv, int part, int exitflags) extern char *nfsbootdevname; #endif +#if NSOFTRAID > 0 + sr_map_root(); +#endif + /* * If `swap generic' and we couldn't determine boot device, * ask the user. |