/*
* 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
*/
/*
*/
/*
* Service Management Facility (SMF) interfaces.
*/
#include <stdio.h>
#include <libscf.h>
#include <meta.h>
static void wait_online(char *svc_names[]);
static char
*svm_core_svcs[] = {
};
static char
*svm_diskset_svcs[] = {
};
static char
*svm_mn_diskset_svcs[] = {
};
/*
* Enable the specified SVM services through the SMF.
*/
int
{
if (flags & META_SMF_CORE) {
}
if (flags & META_SMF_DISKSET) {
}
if (flags & META_SMF_MN_DISKSET) {
}
else
return (0);
}
/*
* Disable the specified SVM services through the SMF.
*/
int
{
if (flags & META_SMF_CORE) {
}
if (flags & META_SMF_DISKSET) {
}
if (flags & META_SMF_MN_DISKSET) {
}
else
return (0);
}
/*
* Determine if desired services are online. If all services in the
* classes specified by flags are online, 1 is returned. Otherwise
* 0 is returned.
*/
int
{
if (flags & META_SMF_CORE) {
ret = 0;
}
if (flags & META_SMF_DISKSET) {
ret = 0;
}
if (flags & META_SMF_MN_DISKSET) {
ret = 0;
}
if (ret == 0) {
}
return (ret);
}
/*
* Return a bitmask of the META_SMF_* flags indicating which services should be
* online given the current SVM configuration.
*/
int
{
int mask = 0;
int max_sets;
/*
* If there are any local metadbs configured then the core services
* are needed.
*/
(void) memset(&c, 0, sizeof (c));
c.c_setno = MD_LOCAL_SET;
return (mask);
mask |= META_SMF_CORE;
/*
* If any disksets configured then the diskset services are needed.
* Also check for multi-node sets.
*/
int i;
mdclrerror(ep);
for (i = 1; i < max_sets; i++) {
/*
* metad rpc program not registered
* can't get diskset info
*/
break;
}
} else {
mask |= META_SMF_DISKSET;
if (MD_MNSET_DESC(sd)) {
/*
* we don't have to check the
* rest of the disksets at this
* point
*/
break;
}
}
}
mdclrerror(ep);
}
}
return (mask);
}
static void
{
int i;
for (i = 0; svc_names[i]; i++) {
if (smf_enable_instance(svc_names[i], 0) != 0) {
svc_names[i]);
}
}
}
}
static void
{
int i;
for (i = 0; svc_names[i]; i++) {
if (smf_disable_instance(svc_names[i], 0) != 0) {
svc_names[i]);
}
}
}
}
static int
{
int rval = 0;
if (*scf_simple_prop_next_boolean(prop) != 0)
rval = 1;
}
return (rval);
}
/*
* There can be a delay while the RPC services get going. Try to
* make sure the RPC daemons are ready to run before we return.
* Check 15 times (15 seconds total wait time) and then just
* return.
*/
static void
{
int i;
for (i = 0; i < 15; i++) {
break;
(void) sleep(1);
}
}
/*
* Check to see if all services in the svc_names are online. If they are
* all online 1 is returned, otherwise 0 is returned.
*/
static int
{
int i;
for (i = 0; svc_names[i]; i++) {
int sz;
char *p;
/*
* Need space for the name, the new line, the
* tab and the null terminator.
*/
} else {
/* Add space for existing names */
svc_names[i]);
}
*names = p;
rv = 0;
}
}
return (rv);
}
/*
* Return 1 if the specified service is online. Otherwise, return 0.
*/
static int
{
int rval = 0;
char *s;
if (strcmp(s, "online") == 0)
rval = 1;
free(s);
}
return (rval);
}
/*
* Determine if desired service is disabled. If so, 1 is returned.
* Otherwise 0 is returned.
*/
int
{
int rval = 0;
char *s;
if (strcmp(s, "disabled") == 0)
rval = 1;
free(s);
}
return (rval);
}