/*
* 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.
*/
#ifndef _CFG_CLUSTER_H
#define _CFG_CLUSTER_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file is a combination of interfaces culled from scstat.h,
* scconf.h and the header files that they include.
*
* It exposes a subset of the interfaces defined in PSARC/2001/261
* for use in NWS software.
*/
/*
* From sc_syslog_msg.h
*/
typedef enum sc_state_code_enum {
/*
* resource is monitored but state of the resource is
* not known because either the monitor went down or
* the monitor cannot report resource state temporarily.
*/
/*
* End sc_syslog_msg.h
*/
/*
* From scstat.h
*/
/* Error codes returned by scstat functions. */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scstat_errno {
/* States a resource can be in */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scstat_state_code {
/* States a replica of a resource can be in */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scstat_node_pref {
/* component name */
typedef char *scstat_name_t;
/* status string */
typedef char *scstat_statstr_t;
/* ha device node status list */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef struct scstat_ds_node_state_struct {
/* node name */
/* node status */
/* next */
/* Cluster node status */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef struct scstat_node_struct {
/* PSARC/2001/261. */
/* Cluster ha device status */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef struct scstat_ds_struct {
/* ha device name */
/* ha device status */
/* ha device statstr */
/* node preference list */
/* next */
} scstat_ds_t;
/*
* scstat_strerr
*
* Map scstat_errno_t to a string.
*
* The supplied "errbuffer" should be of at least SCSTAT_MAX_STRING_LEN
* in length.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
void scstat_strerr(scstat_errno_t, char *);
/*
* Upon success, a list of objects of scstat_node_t are returned.
* The caller is responsible for freeing the space.
*
* Possible return values:
*
* SCSTAT_NOERR - success
* SCSTAT_ENOMEM - not enough memory
* SCSTAT_EPERM - not root
* SCSTAT_ENOTCLUSTER - there is no cluster
* SCCONF_EINVAL - invalid argument
* SCSTAT_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/*
* Free all memory associated with a scstat_node_t structure.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/*
* If the device service name passed in is NULL, then this function returns
* the status of all device services, otherwise it returns the status of the
* device service specified.
* The caller is responsible for freeing the space.
*
* Possible return values:
*
* SCSTAT_ENOERR - success
* SCSTAT_ENOMEM - not enough memory
* SCSTAT_EPERM - not root
* SCSTAT_ENOTCLUSTER - there is no cluster
* SCCONF_EINVAL - invalid argument
* SCSTAT_ESERVICENAME - invalid device group name
* SCSTAT_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
scstat_ds_t **dsstatus);
/*
* Free memory associated with a scstat_ds_t structure.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/*
* End scstat.h
*/
/*
* From scconf.h
*/
/* Maximum message string length */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scconf_errno {
/* IDs */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/* Cluster transport handle */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef void * scconf_cltr_handle_t;
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/*
* Get the name of a node from its "nodeid". Upon success,
* a pointer to the nodename is left in "nodenamep".
*
* It is the caller's responsibility to free memory allocated
* for "nodename" using free(3C).
*
* Possible return values:
*
* SCCONF_NOERR - success
* SCCONF_EPERM - not root
* SCCONF_ENOCLUSTER - there is no cluster
* SCCONF_ENOMEM - not enough memory
* SCCONF_EINVAL - invalid argument
* SCCONF_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
char **nodenamep);
/*
* Map scconf_errno_t to a string.
*
* The supplied "errbuffer" should be of at least SCCONF_MAXSTRINGLEN
* in length.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
/*
* Given a dev_t value, return the name of device service that contains this
* device.
*
* The caller is responsible for freeing the memory returned in "name".
*
* Possible return values:
*
* SCCONF_NOERR - success
* SCCONF_EPERM - not root
* SCCONF_ENOEXIST - the given device is not configured
* SCCONF_ENOMEM - not enough memory
* SCCONF_ENOCLUSTER - cluster config does not exist
* SCCONF_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
char **dsname);
/*
* End scconf.h
*/
#ifdef __cplusplus
}
#endif
#endif /* _CFG_CLUSTER_H */