metattach.c revision d7cd82522afdd890a66c7600b499590ad44e84bd
/*
* 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"
/*
* attach submirrors
*/
#include <meta.h>
#include <sdssc.h>
/*
* print usage message
*/
static void
int eval
)
{
usage: %s [-s setname] mirror [metadevice]\n\
%s [-s setname] RAID component...\n\
%s [-s setname] [-A alignment] softpart size|all\n"),
}
/*
* attach more space to a soft partition
*/
static int
mdsetname_t **spp,
int argc,
char *argv[],
)
{
int c;
sp_ext_offset_t alignment = 0;
/* reset and parse args */
optind = 1;
opterr = 1;
switch (c) {
case 'n':
case 's':
break;
case 'A':
/* NOTREACHED */
}
break;
default:
/* NOTREACHED */
break;
}
}
if (argc != 1)
return (-1);
}
/* update md.cf file */
return (-1);
return (0);
}
/*
* attach components to stripe
*/
static int
mdsetname_t **spp,
int argc,
char *argv[],
)
{
diskaddr_t interlace = 0;
int c;
mdnamelist_t *p;
/* reset and parse args */
optind = 1;
opterr = 1;
switch (c) {
case 'n':
case 's':
break;
case 'a':
break; /* obsolete */
case 'i':
return (-1);
}
return (-1);
break;
default:
/*NOTREACHED*/
break;
}
}
if (argc <= 0)
/* get list of components */
return (-1);
/* see if we are a soft partition */
/* nope, check component */
return (-1);
}
}
/* get root device */
/*
* Root is either a stripe or a slice
* If root device is the 1st component of the stripe
* Then fail as root cannot be expanded
*/
return (-1);
/* Component is a disk */
"%s: volume mounted as root cannot be "
}
}
}
/* attach components */
ep) != 0) {
return (-1);
}
/* update md.cf file */
return (-1);
/* return success */
return (0);
}
/*
* attach components to raid
*/
static int
mdsetname_t **spp,
int argc,
char *argv[],
)
{
int c;
mdnamelist_t *p;
/* reset and parse args */
optind = 1;
opterr = 1;
switch (c) {
case 'n':
case 's':
break;
case 'a':
break; /* obsolete */
default:
/*NOTREACHED*/
break;
}
}
if (argc <= 0)
/* get list of components */
return (-1);
/* check for soft partitions */
/* check disk */
return (-1);
}
}
/* attach components */
return (-1);
/* update md.cf file */
return (-1);
/* return success */
return (0);
}
/*
* attach submirror to mirror
*/
static int
mdsetname_t **spp,
int argc,
char *argv[],
)
{
int c;
/* reset and parse args */
optind = 1;
opterr = 1;
switch (c) {
case 'n':
case 's':
break;
default:
/*NOTREACHED*/
break;
}
}
/* get submirror */
if (argc == 1) {
return (-1);
}
} else if (argc == 0) {
} else {
}
/* attach submirror */
return (-1);
/* update md.cf file */
return (-1);
/* return success */
return (0);
}
/*
* attach devices
*/
int
main(
int argc,
char *argv[]
)
{
char *miscname;
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)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
/* initialize */
if (sdssc_bind_library() == SDSSC_OKAY)
&error) == SDSSC_PROXY_DONE)
} else {
}
meta_check_root(ep) != 0) {
}
/* find set and metadevice first */
optind = 1;
opterr = 1;
switch (c) {
case 'h':
break;
case 'n':
if (called_thru_rpc == TRUE) {
options &= ~MDCMD_DOIT;
} else {
}
break;
case 's':
break;
case '?':
if (optopt == '?')
break;
}
}
}
}
}
if ((called_thru_rpc == FALSE) &&
/*
* 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.
* Note that if sp is NULL, meta_is_mn_name() derives sp
* from argv[optind] which is the metadevice arg
*/
int i;
int newargc;
int result;
char **newargv;
}
newargv[0] = "metattach";
newargc = 2;
/* If we found a problem don't do it for real */
if (result != 0) {
}
/*
* Do it for real now. Remove "-n" from the arguments and
* MD_DRYRUN from the flags. If we fail now, the master must
* panic as the mddbs may be inconsistent.
*/
/*
* If the metattach command succeeds, for a mirror, send a
* resync starting message for the metadevice
*/
!= 0)
}
}
}
}
/* dispatch based on device type */
}
}
}
}
} else {
"%s: invalid metadevice type %s\n"),
}
/* return success */
/*NOTREACHED*/
return (0);
}