2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * initialize metadevices 2N/A char *
uname,
/* Meta Device name (eg d0) */ 2N/A char *
str,
/* String to Parse */ 2N/A /* parse interlace */ 2N/A /* return success */ 2N/A * cook up syntax error 2N/A /* if we have a token, concat it to uname */ 2N/A * setup metadevice geometry 2N/A * adjust metadevice geometry 2N/A * Function: meta_init_make_device 2N/A * Create the device node <uname> by constructing the necessary 2N/A * md_mkdev_params_t structure. We have to handle relative names 2N/A * The field that we need is the unit number of the metadevice (80 in 2N/A * the above examples). 2N/A * Input: spp set structure 2N/A * uname unit-name (fully qualified or relative) 2N/A * Output: ep error return structure 2N/A * Returns: > 0 success and return 'key' 2N/A * -1 Error. <ep> contains error reason 2N/A * This ioctl call causes kernel to allocate a unit number 2N/A * and populate /devices for the named metadevice 2N/A * Now we have minor number so add it to the namespace 2N/A * and return the key 2N/A /* Make sure the /dev link is created */ 2N/A * Delete name entry we just created 2N/A * FUNCTION: is_metadb_cmd() 2N/A * INPUT: argc - number of command line arguments 2N/A * argv - pointer to array of command line arguments 2N/A * RETURNS: TRUE if a metadb is to be created, FALSE otherwise 2N/A * PURPOSE: parses enough of the command line to determine if a metadb 2N/A * create is being attempted 2N/A /* look for match */ 2N/A * FUNCTION: is_stripe_cmd() 2N/A * INPUT: argc - number of command line arguments 2N/A * argv - pointer to array of command line arguments 2N/A * RETURNS: TRUE if a stripe is to be created, FALSE otherwise 2N/A * PURPOSE: parses enough of the command line to determine if a stripe 2N/A * create is being attempted 2N/A * FUNCTION: meta_get_init_type() 2N/A * INPUT: argc - number of command line arguments 2N/A * argv - pointer to array of command line arguments 2N/A * RETURNS: type of metadevice or hot spare pools being initialized 2N/A * PURPOSE: parses enough of the command line to determine what type 2N/A * of metainit is being attempted 2N/A if (
argc ==
1)
/* must be a hot spare pool w/o devices */ 2N/A }
else {
/* assume that it is a hsp */ 2N/A * initialize named device or hotspare pool 2N/A /* determine type of metadevice or hot spare pool being created */ 2N/A * We are creating metadevice so make sure the name 2N/A * The name has been used by hsp 2N/A * If path exists but unit is not created 2N/A * then meta_init_make_device will correct 2N/A * that. If unit also exists then it 2N/A * will return a conflict error 2N/A /* Create device node */ 2N/A * We need to create the device node if the specified metadevice 2N/A * does not already exist in the database. The actual creation 2N/A * is undertaken by the md driver and the links propagated by 2N/A * Remove the device node created before 2N/A * Del what we added before