[BACK]Return to crs.h CVS log [TXT][DIR] Up to [Development] / failsafe / FailSafe / cluster_services / include

File: [Development] / failsafe / FailSafe / cluster_services / include / crs.h (download)

Revision 1.2, Wed Mar 28 01:52:33 2001 UTC (16 years, 7 months ago) by scotth
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +3 -3 lines

Fix *_LOG macro definitions to be correct ANSI C preprocessor usage:
remove incorrect ## usage and replace with correct: space-char.
bugzilla #61.

/*
 * Copyright (c) 2000,2001 Silicon Graphics, Inc.  All Rights Reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * Further, this software is distributed without any warranty that it is
 * free of the rightful claim of any third person regarding infringement
 * or the like.  Any license provided herein, whether implied or
 * otherwise, applies only to this software file.  Patent licenses, if
 * any, provided herein do not apply to combinations of this program with
 * other software, or any other product whatsoever.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
 * USA.
 * 
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Mountain View, CA 94043, or:
 * 
 * http://www.sgi.com 
 * 
 * For further information regarding this notice, see: 
 * 
 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
 */
/*
 * crs.h
 *
 * What's in this file?
 */

#ifndef CRS_H
#define CRS_H
#ident "$Id: crs.h,v 1.2 2001/03/28 01:52:33 scotth Exp $"

typedef uint32_t	crs_count_t;

typedef void *		crs_hdl_t;

typedef crs_hdl_t	crs_chan_hdl_t;

typedef crs_hdl_t	crs_req_hdl_t;

typedef crs_hdl_t	crs_mon_hdl_t;

#define	CRS_HDL_INVAL	NULL

typedef int		crs_mutex_hdl_t;

typedef uint32_t	crs_nodeinc_t;

#define CRS_DAEMON "crsd"

#define CRS_NRT_NONE	(0)

#define CRS_MAX_GROUP_NAME_SIZE		7

typedef struct crs_node_desc_s {
    ci_nodeid_t		nodeid;
    crs_nodeinc_t	inc;
} crs_node_desc_t;

/* Any modifications to crs_reset_status_t must be reflected in
 * crs_rstatus_name() in crs_strings.c too. */
typedef enum crs_reset_status_s {
    CRSRS_NOREQ		=  0,	/* No reset request is pending. */
    CRSRS_ENQUEUED	=  1,	/* Reset request has been enqueued 
				 * in the client address space. */
    CRSRS_SENT		=  2,	/* Reset request has been sent to the
				 * daemon. */
    CRSRS_ARRIVED	=  3,	/* Reset request has arrived at the
				 * daemon and is enqueued/being served. */
    CRSRS_RESET		=  4,	/* Node was reset successfully. */
    CRSRS_MAYBEPWRDN	=  5,	/* Node may be powered down, refer to
				 * the powerdown heuristic for details. */
    CRSRS_NORESPONSE	=  6,	/* No response received from the sysctlr */
    CRSRS_NOSYSCTLR   	=  7,	/* CRSD does not have sysctlr information. */
    CRSRS_NOSUCHNODE	=  8,	/* No node corresponding to the nodeid. */
    CRSRS_NMINOTSUPPORTED = 9,	/* Request for the unsupported NMI
				 * operation. */
    CRSRS_REMOTE	= 10,	/* request being handled by a remote CRSD. */
    CRSRS_FAILURE	= 11,	/* request can not be satisfied, ex. in
			           the case of a remote request, if the remote
				   crsd cannot create the corres. clnt str. */
    CRSRS_NOOWNER       = 12,   /* The node to be reset has no owner 
                                   (sysctlr_nodep) listed in CRSD's config. */
    CRSRS_DISABLED	= 13,	/* The dest port is disabled. */
    CRSRS_COUNT			/* Count of the enumerated states. */
} crs_reset_status_t;

typedef struct crs_reset_data_s {
    crs_node_desc_t	nd;
    ci_clock_t		nrt;		/* Time point (ms) since the requesting 
					 * node has not heard from the node being 
					 * asked to reset. */
    ci_clock_t		req_time; 	/* Time at which the decision to shoot
					 * this node was made. Assumption being 
					 * that we must not have heard from the
					 * reset candidate node until this time. */
    crs_reset_status_t	status;
} crs_reset_data_t;

/* Any modifications to crs_mon_status_t must be reflected in
 * crs_mstatus_name() in crs_strings.c too. */
typedef enum crs_mon_status_e {
    CRSMS_NOSUCHNODE	= 0,	/* dest node is unknown to us. */
    CRSMS_MONSTARTED	= 1,	/* monitoring has started. */
    CRSMS_NOTMONITORED	= 2,	/* montoring is not being done. */
    CRSMS_LIVE		= 3,	/* monitoring is ongoing/port is alive. */
    CRSMS_DEAD		= 4,	/* monitoring is ongoing/port is dead. */
    CRSMS_NOTOWNER	= 5,	/* port cannot be monitored by us. */
    CRSMS_DISABLED	= 6,	/* dest port is disabled. */
    CRSMS_NOSYSCTLR	= 7,	/* port does not exist on the dest node. */
    CRSMS_UNKNOWN	= 8,	/* misc status not covered by above. */
    CRSMS_COUNT			/* Count of the enumerated states. */
} crs_mon_status_t;

typedef struct crs_mon_data_s {
    crs_node_desc_t	nd;
    crs_mon_status_t	status;
} crs_mon_data_t;

#define		CRS_MONALL	0x00000001	/* Start monitoring all local
						 * ports */
#define		CRS_NMI		0x00000002	/* Send an NMI request instead
						 * of a regular reset req */
#define		CRS_PWRCCL	0x00000004	/* Send a power cycle request 
						 * instead of a regular reset 
						 * req */
#define		CRS_RESET	0x00000008	/* Ask for a normal request 
						 * irrespective of what is
						 * there in the CDB. */

crs_req_hdl_t	crs_register(crs_chan_hdl_t *, char *, int, int, ci_err_t *);
crs_req_hdl_t	crs_unregister(crs_chan_hdl_t, int);
crs_req_hdl_t	crs_startmon(crs_chan_hdl_t, crs_count_t *, crs_mon_data_t **,
			     int, crs_mon_hdl_t *);
crs_req_hdl_t	crs_stopmon(crs_chan_hdl_t, crs_mon_hdl_t, int);
crs_req_hdl_t	crs_getstatus(crs_chan_hdl_t, crs_mon_hdl_t, int);
void		crs_mondata_free(crs_mon_data_t *);
crs_req_hdl_t	crs_reset(crs_chan_hdl_t, crs_count_t, crs_reset_data_t *,
			  int);
ci_err_t	crs_request_status(crs_chan_hdl_t, crs_req_hdl_t);
ci_err_t	crs_error(crs_chan_hdl_t hdl);
ci_err_t	crs_log(__uint32_t, ci_err_t, const char *format, ...);

char *		crs_rstatus_name(crs_reset_status_t);
char *		crs_mstatus_name(crs_mon_status_t);
crs_mutex_hdl_t	crs_mutex_create(void *, char *);
int		crs_mutex_delete(crs_mutex_hdl_t);
int		crs_lock(crs_mutex_hdl_t, sigset_t *);
int		crs_unlock(crs_mutex_hdl_t, sigset_t *);
int		crs_trylock(crs_mutex_hdl_t, sigset_t *);

#define CRS_LOG(args) (CI_LOG_START, crs_log args, CI_LOG_END)

#endif /* CRS_H */