1*5913Sperrin /* 2*5913Sperrin * CDDL HEADER START 3*5913Sperrin * 4*5913Sperrin * The contents of this file are subject to the terms of the 5*5913Sperrin * Common Development and Distribution License (the "License"). 6*5913Sperrin * You may not use this file except in compliance with the License. 7*5913Sperrin * 8*5913Sperrin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5913Sperrin * or http://www.opensolaris.org/os/licensing. 10*5913Sperrin * See the License for the specific language governing permissions 11*5913Sperrin * and limitations under the License. 12*5913Sperrin * 13*5913Sperrin * When distributing Covered Code, include this CDDL HEADER in each 14*5913Sperrin * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5913Sperrin * If applicable, add the following below this CDDL HEADER, with the 16*5913Sperrin * fields enclosed by brackets "[]" replaced with your own identifying 17*5913Sperrin * information: Portions Copyright [yyyy] [name of copyright owner] 18*5913Sperrin * 19*5913Sperrin * CDDL HEADER END 20*5913Sperrin */ 21*5913Sperrin /* 22*5913Sperrin * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*5913Sperrin * Use is subject to license terms. 24*5913Sperrin */ 25*5913Sperrin 26*5913Sperrin #pragma ident "%Z%%M% %I% %E% SMI" 27*5913Sperrin 28*5913Sperrin /* 29*5913Sperrin * This file is intended for functions that ought to be common between user 30*5913Sperrin * land (libzfs) and the kernel. When many common routines need to be shared 31*5913Sperrin * then a separate file should to be created. 32*5913Sperrin */ 33*5913Sperrin 34*5913Sperrin #if defined(_KERNEL) 35*5913Sperrin #include <sys/systm.h> 36*5913Sperrin #endif 37*5913Sperrin 38*5913Sperrin #include <sys/types.h> 39*5913Sperrin #include <sys/fs/zfs.h> 40*5913Sperrin #include <sys/nvpair.h> 41*5913Sperrin 42*5913Sperrin /* 43*5913Sperrin * Are there allocatable vdevs? 44*5913Sperrin */ 45*5913Sperrin boolean_t 46*5913Sperrin zfs_allocatable_devs(nvlist_t *nv) 47*5913Sperrin { 48*5913Sperrin uint64_t is_log; 49*5913Sperrin uint_t c; 50*5913Sperrin nvlist_t **child; 51*5913Sperrin uint_t children; 52*5913Sperrin 53*5913Sperrin if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, 54*5913Sperrin &child, &children) != 0) { 55*5913Sperrin return (B_FALSE); 56*5913Sperrin } 57*5913Sperrin for (c = 0; c < children; c++) { 58*5913Sperrin is_log = 0; 59*5913Sperrin (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, 60*5913Sperrin &is_log); 61*5913Sperrin if (!is_log) 62*5913Sperrin return (B_TRUE); 63*5913Sperrin } 64*5913Sperrin return (B_FALSE); 65*5913Sperrin } 66