/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* clear metadevices
*/
#include <meta.h>
#include <sdssc.h>
/*
* clear metadevice or hotspare pool
*/
static int
mdsetname_t **spp,
char *uname,
)
{
/* clear hotspare pool */
/* get hotspare pool name */
return (-1);
/* grab set lock */
return (-1);
/* check for ownership */
return (-1);
/* clear hotspare pool */
}
/* clear metadevice */
else {
/* check for ownership */
return (-1);
/* get metadevice name */
return (-1);
}
/* grab set lock */
return (-1);
/* clear metadevice */
}
}
/*
* print usage message
*/
static void
int eval
)
{
usage: %s [-s setname] -a\n\
%s [-s setname] [options] metadevice...\n\
options:\n\
-f force clear\n\
-r recursive clear\n\
}
/*
* mainline. crack command line arguments.
*/
int
main(
int argc,
char *argv[]
)
{
int aflag = 0;
int pflag = 0;
int set_flag = 0;
int c;
int error;
char *cp;
/*
* Get the locale set up before calling any other routines
* with messages to ouput. Just in case we're not in a build
* environment, make sure that TEXT_DOMAIN gets set to
* something.
*/
#if !defined(TEXT_DOMAIN)
#endif
(void) textdomain(TEXT_DOMAIN);
if (sdssc_bind_library() == SDSSC_OKAY)
&error) == SDSSC_PROXY_DONE)
} else {
}
/* initialize */
meta_check_root(ep) != 0)
goto errout;
/* parse args */
optind = 1;
opterr = 1;
switch (c) {
case 'h':
break;
case 's':
set_flag++;
break;
case 'a':
++aflag;
options |= MDCMD_FORCE;
break;
case 'f':
options |= MDCMD_FORCE;
break;
case 'r':
break;
case 'p':
++pflag;
break;
case '?':
if (optopt == '?')
/*FALLTHROUGH*/
default:
break;
}
}
/* with mn sets if -a, set name must have been specified by -s */
"-a parameter requires the use of -s in multi-node sets"));
}
/* get set context */
}
if (called_thru_rpc) {
/* Check if the device is open on all nodes */
}
if (aflag) { /* clear all devices */
if (argc != 0)
/*
* If a MN set, we will generate a series of individual
* metaclear commands which will each grab the set lock.
* Therefore do not grab the set lock now.
*/
/* grab set lock */
goto errout;
/* check for ownership */
goto errout;
} else {
}
/* reset all devices in set */
if (!mnset)
} else
eval = 0;
} else {
/*
* We are dealing with either a single or multiple names.
* The set for the command is either denoted by the -s option
* or the set of the first name.
*/
if (argc <= 0)
eval = 0;
char *cname;
/*
* If we are dealing with a MN set and we were not
* called thru an rpc call, we are just to send this
* command string to the master of the set and let it
* deal with it.
*/
if (!called_thru_rpc && mnset) {
/* get the canonical name */
if (pflag) {
/*
* If -p, set cname to the device
* argument.
*/
} else {
/*
* For hotspares and metadevices, set
* cname to the full name,
*/
eval = 1;
continue;
}
}
eval = 1;
}
} else {
if (pflag) {
/*
* clear all soft partitions on named
* devices
*/
eval = 1;
continue;
}
} else {
/*
* get the canonical name and
* setup sp if it has been
* specified as part of the
* metadevice/hsp name param
*/
eval = 1;
continue;
}
/* clear named devices */
eval = 1;
continue;
}
}
}
}
}
/* update md.cf */
eval = 1;
}
/*NOTREACHED*/
return (eval);
}