FreeBSD/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
/*
 * Get and validate the contents of the given vdev specification.  This ensures
 * that the nvlist returned is well-formed, that all the devices exist, and that
 * they are not currently in use by any other known consumer.  The 'poolconfig'
 * parameter is the current configuration of the pool when adding devices
 * existing pool, and is used to perform additional checks, such as changing the
 * replication level of the pool.  It can be 'NULL' to indicate that this is a
 * new pool.  The 'force' flag controls whether devices should be forcefully
 * added, even if they appear in use.
 */
Get and validate the contents of the given vdev specification.  This ensures
that the nvlist returned is well-formed, that all the devices exist, and that
they are not currently in use by any other known consumer.  The 'poolconfig'
parameter is the current configuration of the pool when adding devices
existing pool, and is used to perform additional checks, such as changing the
replication level of the pool.  It can be 'NULL' to indicate that this is a
new pool.  The 'force' flag controls whether devices should be forcefully
added, even if they appear in use.
Get and validate the contents of the given vdev specification . This ensures that the nvlist returned is well - formed that all the devices exist and that they are not currently in use by any other known consumer . The ' poolconfig ' parameter is the current configuration of the pool when adding devices existing pool and is used to perform additional checks such as changing the replication level of the pool . It can be ' NULL ' to indicate that this is a new pool . The ' force ' flag controls whether devices should be forcefully added even if they appear in use .
nvlist_t *
make_root_vdev(zpool_handle_t *zhp, int force, int check_rep,
    boolean_t replacing, boolean_t dryrun, int argc, char **argv)
{
	nvlist_t *newroot;
	nvlist_t *poolconfig = NULL;
	is_force = force;
	if ((newroot = construct_spec(argc, argv)) == NULL)
		return (NULL);
	if (zhp && ((poolconfig = zpool_get_config(zhp, NULL)) == NULL))
		return (NULL);
	if (is_device_in_use(poolconfig, newroot, force, replacing, B_FALSE)) {
		nvlist_free(newroot);
		return (NULL);
	}
	if (check_rep && check_replication(poolconfig, newroot) != 0) {
		nvlist_free(newroot);
		return (NULL);
	}
#ifdef illumos
	if (!dryrun && make_disks(zhp, newroot) != 0) {
		nvlist_free(newroot);
		return (NULL);
	}
#endif
	return (newroot);
}
nvlist_t * make_root_vdev ( zpool_handle_t * zhp , int force , int check_rep , boolean_t replacing , boolean_t dryrun , int argc , char * * argv ) { nvlist_t * newroot ; nvlist_t * poolconfig = NULL ; is_force = force ; if ( ( newroot = construct_spec ( argc , argv ) ) == NULL ) return ( NULL ) ; if ( zhp && ( ( poolconfig = zpool_get_config ( zhp , NULL ) ) == NULL ) ) return ( NULL ) ; if ( is_device_in_use ( poolconfig , newroot , force , replacing , B_FALSE ) ) { nvlist_free ( newroot ) ; return ( NULL ) ; } if ( check_rep && check_replication ( poolconfig , newroot ) != 0 ) { nvlist_free ( newroot ) ; return ( NULL ) ; } #ifdef illumos if ( ! dryrun && make_disks ( zhp , newroot ) != 0 ) { nvlist_free ( newroot ) ; return ( NULL ) ; } #endif return ( newroot ) ; }
Get and validate the contents of the given vdev specification.
Get and validate the contents of the given vdev specification .
/*
	 * Construct the vdev specification.  If this is successful, we know
	 * that we have a valid specification, and that all devices can be
	 * opened.
	 */ /*
	 * Validate each device to make sure that its not shared with another
	 * subsystem.  We do this even if 'force' is set, because there are some
	 * uses (such as a dedicated dump device) that even '-f' cannot
	 * override.
	 */ /*
	 * Check the replication level of the given vdevs and report any errors
	 * found.  We include the existing pool spec, if any, as we need to
	 * catch changes against the existing replication level.
	 */ /*
	 * Run through the vdev specification and label any whole disks found.
	 */