librcm.h revision 5093e10312724e92dd76c008a15bdb59d414708a
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBRCM_H
#define _LIBRCM_H
#include <libnvpair.h>
#include <sys/processor.h>
#include <sys/time_impl.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Flags for rcm requests
*/
#define RCM_INCLUDE_SUBTREE 0x0001
#define RCM_INCLUDE_DEPENDENT 0x0002
#define RCM_QUERY 0x0004
#define RCM_FORCE 0x0008
#define RCM_NOPID 0x0020
#define RCM_DR_OPERATION 0x0040
#define RCM_CAPACITY_ADD 0x0100
#define RCM_CAPACITY_DELETE 0x0200
#define RCM_SCOPE 0x0800
#define RCM_RETIRE_REQUEST 0x10000
#define RCM_RETIRE_NOTIFY 0x20000
/*
* RCM return values
*/
#define RCM_SUCCESS 0
#define RCM_FAILURE -1
#define RCM_CONFLICT -2
#define RCM_NO_CONSTRAINT -3
/*
* RCM resource states
*/
#define RCM_STATE_UNKNOWN 0
#define RCM_STATE_ONLINE 1
#define RCM_STATE_ONLINING 2
#define RCM_STATE_OFFLINE_FAIL 3
#define RCM_STATE_OFFLINING 4
#define RCM_STATE_OFFLINE 5
#define RCM_STATE_REMOVING 6
#define RCM_STATE_RESUMING 10
#define RCM_STATE_SUSPEND_FAIL 11
#define RCM_STATE_SUSPENDING 12
#define RCM_STATE_SUSPEND 13
#define RCM_STATE_OFFLINE_QUERYING 15
#define RCM_STATE_OFFLINE_QUERY_FAIL 16
#define RCM_STATE_OFFLINE_QUERY 17
#define RCM_STATE_SUSPEND_QUERYING 18
#define RCM_STATE_SUSPEND_QUERY_FAIL 19
#define RCM_STATE_SUSPEND_QUERY 20
/*
* RCM event attr and properties
*/
#define RCM_RSRCNAME "rcm.rsrcname"
#define RCM_CLIENT_NAME "rcm.client_name"
#define RCM_CLIENT_EXPORTS "rcm.client_exports"
/* Resource name to register for new links reconfigured */
#define RCM_RESOURCE_LINK_NEW "SUNW_event/resource/new/link"
/* Resource name to register for new physical data-links */
#define RCM_RESOURCE_PHYSLINK_NEW "SUNW_event/resource/new/physlink"
/* name-value pair definitions for rcm_notify_event() */
#define RCM_NV_LINKID "linkid"
#define RCM_NV_RECONFIGURED "reconfigured"
/*
* rcm handles
*/
typedef struct rcm_handle rcm_handle_t;
typedef struct rcm_info rcm_info_t;
typedef rcm_info_t rcm_info_tuple_t;
/*
* Interface definitions
*/
int rcm_free_handle(rcm_handle_t *);
void rcm_free_info(rcm_info_t *);
const char *rcm_info_rsrc(rcm_info_tuple_t *);
const char *rcm_info_info(rcm_info_tuple_t *);
const char *rcm_info_error(rcm_info_tuple_t *);
const char *rcm_info_modname(rcm_info_tuple_t *);
int rcm_info_state(rcm_info_tuple_t *);
int rcm_info_seqnum(rcm_info_tuple_t *);
rcm_info_t **);
rcm_info_t **);
rcm_info_t **);
rcm_info_t **);
int rcm_get_rsrcstate(rcm_handle_t *, char *, int *);
int rcm_exec_cmd(char *);
const char *rcm_get_client_name(rcm_handle_t *);
#ifdef __cplusplus
}
#endif
#endif /* _LIBRCM_H */