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

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

Revision 1.1, Thu Aug 31 19:16:32 2000 UTC (17 years, 1 month ago) by vasa
Branch: MAIN
CVS Tags: HEAD

Initial checkin

/*
 * Copyright (c) 2000 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
 */
/* 
 * ci_err.h
 *
 * what's in this file?
 */
#ifndef CI_ERR_H
#define CI_ERR_H

#ident "$Id: ci_err.h,v 1.1 2000/08/31 19:16:32 vasa Exp $"

#include <stdint.h>
#include <misc/inc/types.h>
#include <misc/inc/macros.h>
#include <misc/inc/funcs.h>

#define	CI_ERR_MSG_SIZE	1024

#define	CI_ERR_CODE_MASK	0xfff	/* lower 12 bits */
#define	CI_ERR_CLASS_MASK	0xff	/* middle 8 bits */
#define	CI_ERR_ERRNO_MASK	0xfff	/* upper 12 bits are unix errno */
#define	CI_ERR_CLASS_SHIFT	12
#define	CI_ERR_ERRNO_SHIFT	20
#define	CI_ERR_CODE(err)	(((uint32_t)(err)) & CI_ERR_CODE_MASK)
#define	CI_ERR_CLASS_MAKE(err)	(((uint32_t)(err)) << CI_ERR_CLASS_SHIFT)
#define	CI_ERR_CLASS(err)	((((uint32_t)(err)) >> CI_ERR_CLASS_SHIFT) & \
				 CI_ERR_CLASS_MASK)
#define	CI_ERRNO_MAKE(err, eno) \
				((ci_err_t)((((uint32_t)(eno)) << \
				  CI_ERR_ERRNO_SHIFT) | (err)))

#define	CI_ERRNO_GET(err)	(((uint32_t)(err)) >> CI_ERR_ERRNO_SHIFT)
#define	CI_ERR_GET(err)		((ci_err_t)(((uint32_t)(err)) & \
				 ~(CI_ERR_ERRNO_MASK << CI_ERR_ERRNO_SHIFT)))

#define	CI_ERR_CLASS_BASE	 0
#define	CI_ERR_CLASS_IPC	 1
#define	CI_ERR_CLASS_CMS	 2
#define	CI_ERR_CLASS_GCSLIB	 3
#define	CI_ERR_CLASS_CONFIG	 4
#define	CI_ERR_CLASS_GCD	 5
#define	CI_ERR_CLASS_SRM	 6
#define	CI_ERR_CLASS_IFD	 7
#define CI_ERR_CLASS_FAILSAFE	 8
#define CI_ERR_CLASS_CRS	 9
#define	CI_ERR_CLASS_NUM	10

/* IMPORTANT NOTE:
 * Please do not change the value of CI_ERR_RETRY. The value is hard coded
 * as 12 in the scriptlib script.
 */

typedef enum {
	CI_SUCCESS		=  0,
	CI_FAILURE,
	CI_ERR_HALFDONE,
	CI_ERR_SYS,
	CI_ERR_BUSY,
	CI_ERR_NOTFOUND,
	CI_ERR_NOTREADY,
	CI_ERR_NOMEM,
	CI_ERR_REMOTE,
	CI_ERR_EXISTS,
	CI_ERR_ILLEGAL,
	CI_ERR_INVAL,
	CI_ERR_RETRY,	
	CI_ERR_VERSION,
	CI_ERR_HDL_STALE,
	CI_IPCERR_INVAL	= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_IPC),
	CI_IPCERR_NOMEM,
	CI_IPCERR_NOSERVER,
	CI_IPCERR_AGAIN,
	CI_IPCERR_COMMERR,
	CI_IPCERR_NOMSG,
	CI_IPCERR_NOSPACE,
	CI_IPCERR_NOPULSE,
	CI_IPCERR_NONEWCLNT,
	CI_IPCERR_NOCONN,
	CI_IPCERR_NOSRVRCONN,
	CI_IPCERR_DUPCONN,
	CI_IPCERR_SYS,
	CI_GCSLIBERR_SYS	= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_GCSLIB),
	CI_GCSLIBERR_NOPERM,
	CI_GCSLIBERR_BADID,
	CI_GCSLIBERR_DUPREQ,
	CI_GCSLIBERR_SHUTDOWN,
	CI_GCSLIBERR_NOMEM,
	CI_GCSLIBERR_FREEZE,
	CI_GCSLIBERR_NOGCS,
	CI_GCSLIBERR_COMMERR,
	CI_GCSLIBERR_NOMSG,
	CI_GCSLIBERR_NOSPACE,
	CI_GCSLIBERR_INVAL,
	CI_GCSLIBERR_BADHANDL,
	CI_GCSLIBERR_MSGTOOBIG,
	CI_GCSLIBERR_NOTREADY,
	CI_CMSERR_INIT		= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_CMS),
	CI_CMSERR_INVAL,
	CI_CMSERR_ACCESS,
	CI_CMSERR_NOTFOUND,
	CI_CMSERR_EXIST,
	CI_CMSERR_NOTREADY,
	CI_CMSERR_NOTREG,
	CI_CMSERR_OVERFLOW,
	CI_CMSERR_UNEXPECTMSG,
	CI_CMSERR_NOCLIENT,
	CI_CMSERR_NOMEM,
	CI_CMSERR_UNCHANGED,
	CI_CMSERR_NOMEMB,	
	CI_CMSERR_LONELY,
	CI_CMSERR_ADDDEL,
	CI_CONFERR_NOFILE	= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_CONFIG),
	CI_CONFERR_REVISION,
	CI_CONFERR_NUMNODES,	
	CI_CONFERR_NODEINVAL,	
	CI_CONFERR_EMPTYLINE,	
	CI_CONFERR_OVERFLOW,
	CI_CONFERR_SYNC,
	CI_CONFERR_TIMEOUT,
	CI_CONFERR_INVAL,
	CI_CONFERR_NOTFOUND,
	CI_CONFERR_NOTREADY,
	CI_CONFERR_NOLOCK,
	CI_GCDERR_INVALID_GROUP	= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_GCD),
	CI_GCDERR_TOOMANY_GROUPS,
	CI_GCDERR_TOOMANY_INSTANCES,
	CI_GCDERR_TOOMANY_MSGS,
	CI_GCDERR_SEND_FAILED,
	CI_GCDERR_INVAL,
	CI_GCDERR_UNREG,
	CI_GCDERR_DUPMSG,
	CI_GCDERR_CMSDOWN,
	CI_GCDERR_OLDMSG,
	CI_GCDERR_BADRING,
        CI_GCDERR_INVALID_NODE,
        CI_GCDERR_BADCAUSE,
	CI_SRMERR_NOMEM	= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_SRM),
	CI_SRMERR_NOTDONE,
	CI_SRMERR_NOCHAN,
	CI_SRMERR_VERS,
	CI_SRMERR_SYS,
	CI_SRMERR_CFG,
	CI_SRMERR_PARSING,
	CI_SRMERR_INVAL,
	CI_SRMERR_BADRESLIST,
	CI_SRMERR_RETRY,
	CI_IFDERR_NOMEM = CI_ERR_CLASS_MAKE(CI_ERR_CLASS_IFD),
	CI_IFDERR_CFG,
	CI_IFDERR_PARSING,
	CI_IFDERR_SYS,
	CI_FSERR_NOMEM =  CI_ERR_CLASS_MAKE(CI_ERR_CLASS_FAILSAFE),
	CI_FSERR_BADID,
	CI_FSERR_SENDERR,
	CI_FSERR_INVALHDL,
	CI_FSERR_SYS,
	CI_FSERR_INVALVERS,
	CI_FSERR_SRMNOTDONE,
	CI_CRSERR_NOTDONE = CI_ERR_CLASS_MAKE(CI_ERR_CLASS_CRS),
	CI_CRSERR_INVAL,
	CI_CRSERR_NOMEM,
	CI_CRSERR_NOCHAN,
	CI_CRSERR_EXISTS,
	CI_CRSERR_NOTFOUND,
        CI_CRSERR_SENDFAILED,
	CI_ERR_END		= CI_ERR_CLASS_MAKE(CI_ERR_CLASS_NUM)
} ci_err_t;

void		ci_err_msg(char *, uint32_t);
void		ci_perror(char *, uint32_t);
char		*ci_err_to_name(ci_err_t);
ci_err_t	ci_name_to_err(char *, ci_err_t *);

#endif  /* CI_ERR_H */