/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include <devid.h>
#include <ftw.h>
#include <string.h>
#include <mdiox.h>
#include <meta.h>
#include <syslog.h>
#include <sdssc.h>
/*
* print usage message
*/
static void
{
"usage: %s -h\n"
" %s [-s setname] -r [-lnv]\n"
" %s [-s setname] -u cxtxdx [-lnv]\n"),
}
int
{
char c;
char *argname;
int todo = 0;
int ret = 0;
int md_upgd_stat = 0;
int error;
/*
* 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))
/* initialize */
meta_check_root(ep) != 0) {
closelog();
}
/* parse args */
optind = 1;
opterr = 1;
switch (c) {
case 'v':
options |= DEV_VERBOSE;
break;
case 'n':
options |= DEV_NOACTION;
break;
case 'r':
options |= DEV_RELOAD;
todo = 1;
break;
case 's':
break;
case 'u':
todo = 1;
options |= DEV_UPDATE;
usage("metadevadm");
closelog();
}
break;
case 'l':
break;
case 'h':
default:
usage("metadevadm");
closelog();
}
}
closelog();
}
if (!metaislocalset(sp)) {
closelog();
}
if (MD_MNSET_DESC(sd)) {
"run on multi-owner disksets\n"));
closelog();
}
}
usage("metadevadm");
closelog();
}
usage("metadevadm");
closelog();
}
if (todo == 0) {
usage("metadevadm");
closelog();
}
closelog();
}
/* lock the local set */
closelog();
}
/* grab set lock */
closelog();
}
/* check for ownership */
/*
* If the set is not owned by this node then only update the
* local set's replica.
*/
options |= DEV_LOCAL_SET;
}
/*
* check for upgrade. If upgrade in progress then just exit.
*/
closelog();
}
if (md_upgd_stat == 0) {
if (ret == METADEVADM_ERR) {
/*
* If the call failed, for a DEV_RELOAD still need to
* update the .conf file to provide the latest devid
* information so exit later.
*/
if (options & DEV_UPDATE) {
closelog();
}
}
}
/*
* Sync replica list in kernel to replica list in conf files.
* This will update driver name and minor number in conf file
* if reload was run. Will update device id in conf file if
* update was run.
*/
closelog();
return (0);
}