2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _CFG_CLUSTER_H
2N/A#define _CFG_CLUSTER_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * This file is a combination of interfaces culled from scstat.h,
2N/A * scconf.h and the header files that they include.
2N/A *
2N/A * It exposes a subset of the interfaces defined in PSARC/2001/261
2N/A * for use in NWS software.
2N/A */
2N/A
2N/A#include <sys/errno.h>
2N/A#include <sys/types.h>
2N/A
2N/A/*
2N/A * From sc_syslog_msg.h
2N/A */
2N/A
2N/Atypedef enum sc_state_code_enum {
2N/A ONLINE = 1, /* resource is running */
2N/A OFFLINE, /* resource is stopped due to user action */
2N/A FAULTED, /* resource is stopped due to a failure */
2N/A DEGRADED, /* resource is running but has a minor problem */
2N/A WAIT, /* resource is in transition from a state to another */
2N/A
2N/A /*
2N/A * resource is monitored but state of the resource is
2N/A * not known because either the monitor went down or
2N/A * the monitor cannot report resource state temporarily.
2N/A */
2N/A UNKNOWN,
2N/A
2N/A NOT_MONITORED /* There is no monitor to check state of the resource */
2N/A} sc_state_code_t;
2N/A
2N/A/*
2N/A * End sc_syslog_msg.h
2N/A */
2N/A
2N/A
2N/A/*
2N/A * From scstat.h
2N/A */
2N/A
2N/A#define SCSTAT_MAX_STRING_LEN 1024
2N/A
2N/A/* Error codes returned by scstat functions. */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef enum scstat_errno {
2N/A SCSTAT_ENOERR, /* normal return - no error */
2N/A SCSTAT_EUSAGE, /* syntax error */
2N/A SCSTAT_ENOMEM, /* not enough memory */
2N/A SCSTAT_ENOTCLUSTER, /* not a cluster node */
2N/A SCSTAT_ENOTCONFIGURED, /* not found in CCR */
2N/A SCSTAT_ESERVICENAME, /* dcs: invalid service name */
2N/A SCSTAT_EINVAL, /* scconf: invalid argument */
2N/A SCSTAT_EPERM, /* not root */
2N/A SCSTAT_ECLUSTERRECONFIG, /* cluster is reconfiguring */
2N/A SCSTAT_ERGRECONFIG, /* RG is reconfiguring */
2N/A SCSTAT_EOBSOLETE, /* Resource/RG has been updated */
2N/A SCSTAT_EUNEXPECTED /* internal or unexpected error */
2N/A} scstat_errno_t;
2N/A
2N/A/* States a resource can be in */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef enum scstat_state_code {
2N/A SCSTAT_ONLINE = ONLINE, /* resource is running */
2N/A SCSTAT_OFFLINE = OFFLINE, /* resource stopped due to user action */
2N/A SCSTAT_FAULTED = FAULTED, /* resource stopped due to a failure */
2N/A SCSTAT_DEGRADED = DEGRADED, /* resource running with a minor problem */
2N/A SCSTAT_WAIT = WAIT, /* resource is in transition */
2N/A SCSTAT_UNKNOWN = UNKNOWN, /* resource state is unknown */
2N/A SCSTAT_NOTMONITORED = NOT_MONITORED /* resource is not monitored */
2N/A} scstat_state_code_t;
2N/A
2N/A/* States a replica of a resource can be in */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef enum scstat_node_pref {
2N/A SCSTAT_PRIMARY, /* replica is a primary */
2N/A SCSTAT_SECONDARY, /* replica is a secondary */
2N/A SCSTAT_SPARE, /* replica is a spare */
2N/A SCSTAT_INACTIVE, /* replica is inactive */
2N/A SCSTAT_TRANSITION, /* replica is changing state */
2N/A SCSTAT_INVALID /* replica is in an invalid state */
2N/A} scstat_node_pref_t;
2N/A
2N/A/* component name */
2N/Atypedef char *scstat_name_t;
2N/Atypedef scstat_name_t scstat_cluster_name_t; /* cluster name */
2N/Atypedef scstat_name_t scstat_node_name_t; /* node name */
2N/Atypedef scstat_name_t scstat_adapter_name_t; /* adapter name */
2N/Atypedef scstat_name_t scstat_path_name_t; /* path name */
2N/Atypedef scstat_name_t scstat_ds_name_t; /* device service name */
2N/Atypedef scstat_name_t scstat_quorumdev_name_t; /* quorum device name */
2N/Atypedef scstat_name_t scstat_rs_name_t; /* resource name */
2N/Atypedef scstat_name_t scstat_rg_name_t; /* rg name */
2N/A
2N/A/* status string */
2N/Atypedef char *scstat_statstr_t;
2N/Atypedef scstat_statstr_t scstat_node_statstr_t; /* node status */
2N/Atypedef scstat_statstr_t scstat_path_statstr_t; /* path status */
2N/Atypedef scstat_statstr_t scstat_ds_statstr_t; /* DS status */
2N/Atypedef scstat_statstr_t scstat_node_quorum_statstr_t; /* node quorum status */
2N/Atypedef scstat_statstr_t scstat_quorumdev_statstr_t; /* quorum device stat */
2N/A
2N/A/* ha device node status list */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef struct scstat_ds_node_state_struct {
2N/A /* node name */
2N/A scstat_node_name_t scstat_node_name;
2N/A /* node status */
2N/A scstat_node_pref_t scstat_node_state;
2N/A /* next */
2N/A struct scstat_ds_node_state_struct *scstat_node_next;
2N/A} scstat_ds_node_state_t;
2N/A
2N/A/* Cluster node status */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef struct scstat_node_struct {
2N/A scstat_node_name_t scstat_node_name; /* node name */
2N/A scstat_state_code_t scstat_node_status; /* cluster membership */
2N/A scstat_node_statstr_t scstat_node_statstr; /* node status string */
2N/A void *pad; /* Padding for */
2N/A /* PSARC/2001/261. */
2N/A struct scstat_node_struct *scstat_node_next; /* next */
2N/A} scstat_node_t;
2N/A
2N/A/* Cluster ha device status */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef struct scstat_ds_struct {
2N/A /* ha device name */
2N/A scstat_ds_name_t scstat_ds_name;
2N/A /* ha device status */
2N/A scstat_state_code_t scstat_ds_status;
2N/A /* ha device statstr */
2N/A scstat_ds_statstr_t scstat_ds_statstr;
2N/A /* node preference list */
2N/A scstat_ds_node_state_t *scstat_node_state_list;
2N/A /* next */
2N/A struct scstat_ds_struct *scstat_ds_next;
2N/A} scstat_ds_t;
2N/A
2N/A/*
2N/A * scstat_strerr
2N/A *
2N/A * Map scstat_errno_t to a string.
2N/A *
2N/A * The supplied "errbuffer" should be of at least SCSTAT_MAX_STRING_LEN
2N/A * in length.
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Avoid scstat_strerr(scstat_errno_t, char *);
2N/A
2N/A/*
2N/A * Upon success, a list of objects of scstat_node_t are returned.
2N/A * The caller is responsible for freeing the space.
2N/A *
2N/A * Possible return values:
2N/A *
2N/A * SCSTAT_NOERR - success
2N/A * SCSTAT_ENOMEM - not enough memory
2N/A * SCSTAT_EPERM - not root
2N/A * SCSTAT_ENOTCLUSTER - there is no cluster
2N/A * SCCONF_EINVAL - invalid argument
2N/A * SCSTAT_EUNEXPECTED - internal or unexpected error
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Ascstat_errno_t scstat_get_nodes(scstat_node_t **pplnodes);
2N/A
2N/A/*
2N/A * Free all memory associated with a scstat_node_t structure.
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Avoid scstat_free_nodes(scstat_node_t *plnodes);
2N/A
2N/A/*
2N/A * If the device service name passed in is NULL, then this function returns
2N/A * the status of all device services, otherwise it returns the status of the
2N/A * device service specified.
2N/A * The caller is responsible for freeing the space.
2N/A *
2N/A * Possible return values:
2N/A *
2N/A * SCSTAT_ENOERR - success
2N/A * SCSTAT_ENOMEM - not enough memory
2N/A * SCSTAT_EPERM - not root
2N/A * SCSTAT_ENOTCLUSTER - there is no cluster
2N/A * SCCONF_EINVAL - invalid argument
2N/A * SCSTAT_ESERVICENAME - invalid device group name
2N/A * SCSTAT_EUNEXPECTED - internal or unexpected error
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Ascstat_errno_t scstat_get_ds_status(scstat_ds_name_t *dsname,
2N/A scstat_ds_t **dsstatus);
2N/A
2N/A/*
2N/A * Free memory associated with a scstat_ds_t structure.
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Avoid scstat_free_ds_status(scstat_ds_t *dsstatus);
2N/A
2N/A/*
2N/A * End scstat.h
2N/A */
2N/A
2N/A/*
2N/A * From scconf.h
2N/A */
2N/A
2N/A/* Maximum message string length */
2N/A#define SCCONF_MAXSTRINGLEN 1024
2N/A
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef enum scconf_errno {
2N/A SCCONF_NOERR = 0, /* normal return - no error */
2N/A SCCONF_EPERM = 1, /* permission denied */
2N/A SCCONF_EEXIST = 2, /* object already exists */
2N/A SCCONF_ENOEXIST = 3, /* object does not exist */
2N/A SCCONF_ESTALE = 4, /* object or handle is stale */
2N/A SCCONF_EUNKNOWN = 5, /* unkown type */
2N/A SCCONF_ENOCLUSTER = 6, /* cluster does not exist */
2N/A SCCONF_ENODEID = 7, /* ID used in place of node name */
2N/A SCCONF_EINVAL = 8, /* invalid argument */
2N/A SCCONF_EUSAGE = 9, /* command usage error */
2N/A SCCONF_ETIMEDOUT = 10, /* call timed out */
2N/A SCCONF_EINUSE = 11, /* already in use */
2N/A SCCONF_EBUSY = 12, /* busy, try again later */
2N/A SCCONF_EINSTALLMODE = 13, /* install mode */
2N/A SCCONF_ENOMEM = 14, /* not enough memory */
2N/A SCCONF_ESETUP = 15, /* setup attempt failed */
2N/A SCCONF_EUNEXPECTED = 16, /* internal or unexpected error */
2N/A SCCONF_EBADVALUE = 17, /* bad ccr table value */
2N/A SCCONF_EOVERFLOW = 18, /* message buffer overflow */
2N/A SCCONF_EQUORUM = 19, /* operation would compromise quorum */
2N/A SCCONF_TM_EBADOPTS = 20, /* bad transport TM "options" */
2N/A SCCONF_TM_EINVAL = 21, /* other transport TM error */
2N/A SCCONF_DS_ESUSPENDED = 22, /* Device service in suspended state */
2N/A SCCONF_DS_ENODEINVAL = 23, /* Node specified is not in cluster */
2N/A SCCONF_EAUTH = 24, /* authentication error */
2N/A SCCONF_DS_EINVAL = 25, /* Device service in an invalid state */
2N/A SCCONF_EIO = 26 /* IO error */
2N/A} scconf_errno_t;
2N/A
2N/A/* IDs */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef uint_t scconf_id_t;
2N/A
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef scconf_id_t scconf_nodeid_t; /* node ID */
2N/A
2N/A/* Cluster transport handle */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Atypedef void * scconf_cltr_handle_t;
2N/A
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Aextern scconf_errno_t scconf_get_nodeid(char *nodename,
2N/A scconf_nodeid_t *nodeidp);
2N/A
2N/A/*
2N/A * Get the name of a node from its "nodeid". Upon success,
2N/A * a pointer to the nodename is left in "nodenamep".
2N/A *
2N/A * It is the caller's responsibility to free memory allocated
2N/A * for "nodename" using free(3C).
2N/A *
2N/A * Possible return values:
2N/A *
2N/A * SCCONF_NOERR - success
2N/A * SCCONF_EPERM - not root
2N/A * SCCONF_ENOCLUSTER - there is no cluster
2N/A * SCCONF_ENOMEM - not enough memory
2N/A * SCCONF_EINVAL - invalid argument
2N/A * SCCONF_EUNEXPECTED - internal or unexpected error
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Aextern scconf_errno_t scconf_get_nodename(scconf_nodeid_t nodeid,
2N/A char **nodenamep);
2N/A
2N/A/*
2N/A * Map scconf_errno_t to a string.
2N/A *
2N/A * The supplied "errbuffer" should be of at least SCCONF_MAXSTRINGLEN
2N/A * in length.
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Aextern void scconf_strerr(char *errbuffer, scconf_errno_t err);
2N/A
2N/A/*
2N/A * Given a dev_t value, return the name of device service that contains this
2N/A * device.
2N/A *
2N/A * The caller is responsible for freeing the memory returned in "name".
2N/A *
2N/A * Possible return values:
2N/A *
2N/A * SCCONF_NOERR - success
2N/A * SCCONF_EPERM - not root
2N/A * SCCONF_ENOEXIST - the given device is not configured
2N/A * SCCONF_ENOMEM - not enough memory
2N/A * SCCONF_ENOCLUSTER - cluster config does not exist
2N/A * SCCONF_EUNEXPECTED - internal or unexpected error
2N/A */
2N/A/* This definition is covered by PSARC/2001/261. DO NOT change it. */
2N/Aextern scconf_errno_t scconf_get_ds_by_devt(major_t maj, minor_t min,
2N/A char **dsname);
2N/A
2N/A/*
2N/A * End scconf.h
2N/A */
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _CFG_CLUSTER_H */