mdmn_subr.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MDMN_SUBR_H
#define _MDMN_SUBR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <syslog.h>
#include <synch.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* This is the structure for the wakeup table for the initiator's side.
* We need a transportation handle in order to wake up the process waiting
* for the rpc call to complete
*/
typedef struct mdmn_wti {
char *wti_args;
} mdmn_wti_t;
/*
* This is the structure for the wakeup table for the master.
* We need the ID for checking purpose, synchronizing cv's and a place to store
* a pointer to the results so the master can take over from here.
*/
typedef struct mdmn_wtm {
} mdmn_wtm_t;
/*
* This structure is only needed because we start a thread and we want to
* pass more than one argument to that thread.
* So we pack all the args into one structure and pass a pointer to it.
*/
typedef struct md_mn_msg_and_transp {
#define MAX_SUBMESSAGES 8
#define MAX_OUTERR 1024
/*
* This is the message completion entry structure that stores the result
* for one message incore in an array and on disk
* Each entry is identified by the msgid being part of the result structure.
* The actual data needs to be stored in a separate pre-allocated field
* because the result structure only contains a pointer to stdout / stderr.
* mce_flags is set to:
* MDMN_MCT_IN_PROGRESS - if a message is currently being handled and
* no new message handler should be issued.
* MDMN_MCT_DONE - if the message is completely processed and
* the result is available
*/
typedef struct md_mn_mce {
char mce_data[MAX_OUTERR];
} md_mn_mce_t;
/*
* We need to be able to store one result per each class and for each
* possible submessage.
* This makes our Message Completion Table mct for one diskset.
*/
typedef struct md_mn_mct {
} md_mn_mct_t;
extern md_mn_mct_t *mct[];
/* here we find the MCT files on disk */
#define MD_MN_MSG_COMP_TABLE "/var/run/mct"
/* the return values for mdmn_mark_completion and mdmn_check_completion */
#define MDMN_MCT_NOT_DONE 0x0001
#define MDMN_MCT_DONE 0x0002
#define MDMN_MCT_ERROR 0x0004
#define MDMN_MCT_IN_PROGRESS 0x0008
/* the different states for md_mn_set_inited[] */
#define MDMN_SET_MUTEXES 0x0001
#define MDMN_SET_NODES 0x0002
#define MDMN_SET_MCT 0x0004
/* the different states of mdmn_busy[set][class] */
#define MDMN_BUSY 0x0001
#define MDMN_LOCKED 0x0002
#define MDMN_SUSPEND_1 0x0004
#define MDMN_SUSPEND_ALL 0x0008
extern mutex_t mdmn_busy_mutex[];
extern cond_t mdmn_busy_cv[];
extern struct md_set_desc *set_descriptor[];
/* Stuff for licensing / checking ip adresses */
typedef struct licensed_ip {
union {
} lip_u;
int lip_cnt; /* it's reference count */
extern licensed_ip_t licensed_nodes[];
/* needful things */
/* routines for handling the wakeup table for the master (master_table) */
md_mn_msgid_t *id);
md_mn_msgid_t *id);
/* routines for handling the wakeup table for the initiator (initiator_table) */
md_mn_msgid_t *id);
/* the change log interface */
extern int mdmn_log_msg(md_mn_msg_t *);
extern int mdmn_unlog_msg(md_mn_msg_t *);
#ifdef __cplusplus
}
#endif
#endif /* _MDMN_SUBR_H */