xref: /onnv-gate/usr/src/uts/sparc/zfs/spa_boot.c (revision 10922:e2081f502306)
16423Sgw25295 /*
26423Sgw25295  * CDDL HEADER START
36423Sgw25295  *
46423Sgw25295  * The contents of this file are subject to the terms of the
56423Sgw25295  * Common Development and Distribution License (the "License").
66423Sgw25295  * You may not use this file except in compliance with the License.
76423Sgw25295  *
86423Sgw25295  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96423Sgw25295  * or http://www.opensolaris.org/os/licensing.
106423Sgw25295  * See the License for the specific language governing permissions
116423Sgw25295  * and limitations under the License.
126423Sgw25295  *
136423Sgw25295  * When distributing Covered Code, include this CDDL HEADER in each
146423Sgw25295  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156423Sgw25295  * If applicable, add the following below this CDDL HEADER, with the
166423Sgw25295  * fields enclosed by brackets "[]" replaced with your own identifying
176423Sgw25295  * information: Portions Copyright [yyyy] [name of copyright owner]
186423Sgw25295  *
196423Sgw25295  * CDDL HEADER END
206423Sgw25295  */
216423Sgw25295 
226423Sgw25295 /*
23*10922SJeff.Bonwick@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
246423Sgw25295  * Use is subject to license terms.
256423Sgw25295  */
266423Sgw25295 
27*10922SJeff.Bonwick@Sun.COM #include <sys/zio.h>
286423Sgw25295 #include <sys/spa.h>
296423Sgw25295 #include <sys/bootconf.h>
306423Sgw25295 
316423Sgw25295 char *
spa_get_bootprop(char * propname)327147Staylor spa_get_bootprop(char *propname)
336423Sgw25295 {
346423Sgw25295 	int proplen;
357147Staylor 	char *value;
366423Sgw25295 
377147Staylor 	proplen = BOP_GETPROPLEN(bootops, propname);
387147Staylor 	if (proplen <= 0)
396423Sgw25295 		return (NULL);
406423Sgw25295 
417147Staylor 	value = kmem_zalloc(proplen, KM_SLEEP);
427147Staylor 	if (BOP_GETPROP(bootops, propname, value) == -1) {
437147Staylor 		kmem_free(value, proplen);
446423Sgw25295 		return (NULL);
456423Sgw25295 	}
466423Sgw25295 
477147Staylor 	return (value);
486423Sgw25295 }
496423Sgw25295 
506423Sgw25295 void
spa_free_bootprop(char * propname)517147Staylor spa_free_bootprop(char *propname)
526423Sgw25295 {
537147Staylor 	kmem_free(propname, strlen(propname) + 1);
546423Sgw25295 }
55