libwrsmconf.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <stropts.h>
#include <errno.h>
#include <sys/systeminfo.h>
#include "wrsmconf.h"
#include "wrsmconf_impl.h"
#define DIRNAMEFMT "/etc/wrsm/c%d"
#define FILENAMEFMT "/etc/wrsm/c%d/config"
#define HOSTNAMEFMT "/etc/wrsm/c%d/hostname"
/*
* Macros to produce a quoted string containing the value of a
* preprocessor macro. For example, if SIZE is defined to be 256,
* VAL2STR(SIZE) is "256". This is used to construct format
* strings for scanf-family functions below.
*/
#define QUOTE(x) #x
/* Private function in libwrsmconf */
extern int ErrorCount;
/* Saves cont config in a file to be read at next reboot */
static void
{
char filename[MAXPATHLEN];
}
/* Save to file for rc2 script to read at boot */
}
int
{
int i;
}
/* Check for NULL pointers */
DPRINTF(("ERROR: Controller is null\n"));
return (EINVAL);
}
DPRINTF(("ERROR: routing is null\n"));
return (EINVAL);
}
DPRINTF(("ERROR: members is null\n"));
return (EINVAL);
}
DPRINTF(("ERROR: config protocol version mismatch: got %d "
return (ENOTSUP);
}
/* For each member in the cluster... */
int j;
DPRINTF(("ERROR: members[%d] is null\n", i));
return (EINVAL);
}
DPRINTF(("ERROR: cnode id %d exceeds max of %d\n",
return (EINVAL);
}
DPRINTF(("ERROR: cnode id %d appears twice\n",
return (EINVAL);
}
DPRINTF(("ERROR: cnode id %d exports no small-page "
return (EINVAL);
}
DPRINTF(("ERROR: cnode id %d imports no small-page "
return (EINVAL);
}
for (j = 1; j < WRSM_NODE_NCSLICES; j++) {
DPRINTF(("ERROR: cnode id %d exported ncslice "
"0x%x in wrong index %d\n",
return (EINVAL);
}
DPRINTF(("ERROR: cnode id %d imported ncslice "
"0x%x in wrong index %d\n",
return (EINVAL);
}
}
}
/* For each wci in the routing table... */
/* Verify wcis are listed in increasing order based on port */
DPRINTF(("ERROR: wci %d is not in port order",
return (EINVAL);
}
/* Verify reachable and gnid_to_wnode tables are consistent */
int count = 0;
/*
* Count the number of times this wnode appears in
* gnid_to_wnode table -- Should be one for reachable
* nodes, zero of unreachable nodes.
*/
count++;
}
}
DPRINTF(("ERROR: reachable wnode %d has %d "
"gnid_to_wnode entries for wci %d\n",
return (EINVAL);
count != 0) {
DPRINTF(("ERROR: unreachable wnode %d has %d "
"gnid_to_wnode entries for wci %d\n",
return (EINVAL);
}
}
}
/* Verify that stripe groups are listed in order based on group_id */
DPRINTF(("ERROR: stripe group %d not in group_id "
"order\n", routing->
return (EINVAL);
}
}
return (0);
}
int
{
int fd;
int rc;
int block_size;
int tmp_errno;
void *packed;
wrsm_admin_arg_config_t initial = {0};
if (!cont) {
return (-1);
}
return (-1);
}
return (-1);
}
if (fd == -1) {
return (-1);
}
if (rc == 0) {
}
return (rc);
}
/*
*/
int
{
int fd;
int rc;
int block_size;
int tmp_errno;
void *packed;
wrsm_admin_arg_config_t start = {0};
char filename[MAXPATHLEN];
return (1);
}
hostname) == 0) {
return (1);
}
if (rc != 0) {
return (rc);
}
(void) wrsm_free_config(cont);
return (rc);
}
return (-1);
}
(void) wrsm_free_config(cont);
return (-1);
}
if (fd == -1) {
(void) wrsm_free_config(cont);
return (-1);
}
/*
* if controller config is already installed,
* make sure sessions are enabled.
*/
}
(void) wrsm_free_config(cont);
return (rc);
}
int
wrsm_start_all_configs(void)
{
int rc;
int retval = 0;
int fd;
int i;
int maxcont;
if (fd == -1) {
return (-1);
}
return (-1);
}
for (i = 0; i < maxcont; i++) {
rc = wrsm_start_config(i);
if (rc == -1) {
}
}
return (retval);
}
int
{
int fd;
int rc;
int tmp_errno;
int block_size;
void *packed;
wrsm_admin_arg_config_t replace = {0};
if (!cont) {
return (-1);
}
return (-1);
}
return (-1);
}
if (fd == -1) {
return (-1);
}
if (rc == 0) {
}
return (rc);
}
int
{
int fd;
int rc;
int tmp_errno;
wrsm_admin_arg_wci_t enable = {0};
if (!wci_ids_in) {
return (-1);
}
if (fd == -1) {
return (-1);
}
return (rc);
}
int
{
int fd;
int rc;
int tmp_errno;
wrsm_admin_arg_wci_t install = {0};
if (!wci_ids_in) {
return (-1);
}
if (fd == -1) {
return (-1);
}
return (rc);
}
int
{
int rc;
int fd;
int tmp_errno;
if (fd == -1) {
return (-1);
}
if (rc == 0) {
char filename[MAXPATHLEN];
/* Delete file read by rc2 script at boot */
}
return (rc);
}
int
wrsm_remove_all_configs(void)
{
int rc;
int retval = 0;
int fd;
int i;
int maxcont;
if (fd == -1) {
return (-1);
}
return (-1);
}
for (i = 0; i < maxcont; i++) {
rc = wrsm_remove_config(i);
if (rc == -1) {
}
}
return (retval);
}
/*
*/
int
{
int rc;
int fd;
int tmp_errno;
if (fd == -1) {
return (-1);
}
/*
* controller config can't be removed;
* make sure sessions are disabled.
*/
}
return (rc);
}
int
wrsm_stop_all_configs(void)
{
int rc;
int retval = 0;
int fd;
int i;
int maxcont;
if (fd == -1) {
return (-1);
}
return (-1);
}
for (i = 0; i < maxcont; i++) {
rc = wrsm_stop_config(i);
if (rc == -1) {
}
}
return (retval);
}
int
{
int fd;
int tmp_errno;
wrsm_admin_arg_config_t getarg = {0};
if (!cont) {
return (-1);
}
if (fd == -1) {
return (-1);
}
return (-1);
}
return (-1);
}
return (-1);
}
return (0);
}
int
wrsm_get_num_controllers(void)
{
int num_conts;
int fd;
int tmp_errno;
if (fd == -1) {
return (-1);
}
return (num_conts);
}
int
{
if (!config) {
return (-1);
}
return (-1);
}
return (0);
}
int
{
}
int
char *hostname)
{
return (-1);
}
return (-1);
}
yyparse();
if (ErrorCount > 0) {
return (-1);
}
if (hostname)
else {
}
return (-1);
}
/* Allocate memory for the caller's data structure */
/* Copy controller from static structure to caller's structure */
/* Zero the static structure, so we don't free any of the pointers */
/* Free the other unused controllers read from the file */
return (0);
}
int
{
return (0);
}
int
{
int rc;
int fd;
int tmp_errno;
char devname[MAXPATHLEN];
if (fd == -1) {
return (-1);
}
return (rc);
}
int
{
int rc;
int fd;
int tmp_errno;
char devname[MAXPATHLEN];
if (fd == -1) {
return (-1);
}
return (rc);
}
int
{
char devname[MAXPATHLEN];
int fd;
int rc;
int tmp_errno;
if (fd == -1) {
return (-1);
}
return (rc);
}
int
{
int fd;
int rc;
int tmp_errno;
char devname[MAXPATHLEN];
return (-1);
}
return (rc);
}
int
{
int fd;
int rc;
int tmp_errno;
char devname[MAXPATHLEN];
return (-1);
}
return (rc);
}
int
{
int fd;
int rc;
int tmp_errno;
char devname[MAXPATHLEN];
return (-1);
}
return (rc);
}