From c04b7098d33d73ec5977ad46f5a3cf1ee64a1ace Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 15 Dec 2009 15:51:44 +0000 Subject: Allow auto assemble flag to be toggled for disciplines that support it. "Love it!" marco@ --- sys/dev/softraid.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sys/dev/softraid.c') 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 * Copyright (c) 2008 Chris Kuethe @@ -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); -- cgit v1.2.3