/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
#include <string.h>
#include <libscf.h>
#include <pthread.h>
#include "isns_server.h"
#include "isns_log.h"
#include "isns_cfg.h"
/*
* external variables
*/
extern uint64_t esi_threshold;
extern ctrl_node_t *control_nodes;
extern pthread_mutex_t ctrl_node_mtx;
extern char data_store[MAXPATHLEN];
/*
* load_config loads config data through SMF.
* arg DATA_STORE_UPDATE indicates whether the data store location
* can be updated or not.
*/
int
{
char *name;
/* connect to the current SMF global repository */
/* allocate scf resources */
/* if failed to allocate resources, exit */
"scf handles allocation failed.");
goto out;
}
/* bind scf handle to the running svc.configd daemon */
goto out;
}
/* get the scope of the localhost in the current repository */
goto out;
}
/* get the service "network/isns_server" within the scope */
goto out;
}
/* get the property group "config" within the given service */
"Getting property group %s failed.",
goto out;
}
/*
* Now get the properties.
*/
goto out;
}
"Getting property value for %s failed.",
goto out;
}
"Getting property integer value for %s failed.",
goto out;
}
/* the range of ESI Threshold is [1, 10] */
if (esi_threshold < 1) {
} else if (esi_threshold > MAX_ESI_THRESHOLD) {
}
"Getting scf property %s failed.", CONFIG_MGMT_SCN);
goto out;
}
"Getting property value for %s failed.",
goto out;
}
"Getting boolean value for property %s failed",
goto out;
}
"%s set to %s", CONFIG_MGMT_SCN,
if (DATA_STORE_UPDATE) {
goto out;
}
"Getting property value for %s failed",
goto out;
}
data_store[0] = 0;
"Getting property string value for %s failed",
goto out;
}
}
goto out;
}
"Getting iteration property %s failed",
goto out;
}
/* remove any old control node first. */
(void) pthread_mutex_lock(&ctrl_node_mtx);
while (control_nodes != NULL) {
}
"Getting property string value for %s failed",
(void) pthread_mutex_unlock(&ctrl_node_mtx);
goto out;
}
if (ctrl_node_p == NULL) {
(void) pthread_mutex_unlock(&ctrl_node_mtx);
goto out;
}
(void) pthread_mutex_unlock(&ctrl_node_mtx);
goto out;
} else {
}
} else {
}
}
(void) pthread_mutex_unlock(&ctrl_node_mtx);
retval = 0; /* ok */
out:
/* destroy scf pointers */
}
if (value_iter != NULL) {
}
}
}
}
}
}
return (retval);
}
/*
* is_control_node checks the given name to see if it is a control node.
*/
int
)
{
ctrl_node_t *p;
(void) pthread_mutex_lock(&ctrl_node_mtx);
p = control_nodes;
while (p != NULL) {
(void) pthread_mutex_unlock(&ctrl_node_mtx);
return (1);
}
p = p->next;
}
(void) pthread_mutex_unlock(&ctrl_node_mtx);
return (0);
}