diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2009-12-15 15:51:44 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2009-12-15 15:51:44 +0000 |
commit | c04b7098d33d73ec5977ad46f5a3cf1ee64a1ace (patch) | |
tree | 04c296c37f19daef568cda9b7b3ecbdf088a6b7b | |
parent | c318b6be83d369f75f47820624680a7825dfc4de (diff) |
Allow auto assemble flag to be toggled for disciplines that support it.
"Love it!" marco@
-rw-r--r-- | sys/dev/softraid.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index cd1908e56d8..0bb97ccf9ec 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.186 2009/12/15 13:19:37 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.187 2009/12/15 15:51:43 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -530,6 +530,7 @@ sr_meta_init(struct sr_discipline *sd, struct sr_chunk_head *cl) sm->ssdi.ssd_version = SR_META_VERSION; sm->ssd_ondisk = 0; sm->ssdi.ssd_flags = sd->sd_meta_flags; + /* get uuid from chunk 0 */ bcopy(&sd->sd_vol.sv_chunks[0]->src_meta.scmi.scm_uuid, &sm->ssdi.ssd_uuid, @@ -2849,6 +2850,15 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user) if ((rv = sd->sd_alloc_resources(sd))) goto unwind; + /* Adjust flags if necessary. */ + if ((sd->sd_capabilities & SR_CAP_AUTO_ASSEMBLE) && + (bc->bc_flags & BIOC_SCNOAUTOASSEMBLE) != + (sd->sd_meta->ssdi.ssd_flags & BIOC_SCNOAUTOASSEMBLE)) { + sd->sd_meta->ssdi.ssd_flags &= ~BIOC_SCNOAUTOASSEMBLE; + sd->sd_meta->ssdi.ssd_flags |= + bc->bc_flags & BIOC_SCNOAUTOASSEMBLE; + } + if (sd->sd_capabilities & SR_CAP_SYSTEM_DISK) { /* set volume status */ sd->sd_set_vol_state(sd); |