fmd_module.h revision 80ab886d233f514d54c2a6bdeb9fdfd951bd6881
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FMD_MODULE_H
#define _FMD_MODULE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fm/diagcode.h>
#include <pthread.h>
#include <setjmp.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <fmd_conf.h>
#include <fmd_list.h>
#include <fmd_serd.h>
#include <fmd_buf.h>
#include <fmd_api.h>
#include <fmd_eventq.h>
struct fmd_module; /* see below */
struct fmd_thread; /* see <fmd_thread.h> */
struct fmd_idspace; /* see <fmd_idspace.h> */
struct fmd_ustat; /* see <fmd_ustat.h> */
struct fmd_ustat_snap; /* see <fmd_ustat.h> */
typedef struct fmd_modops {
int (*mop_init)(struct fmd_module *);
int (*mop_fini)(struct fmd_module *);
int (*mop_transport)(struct fmd_module *,
fmd_xprt_t *, struct fmd_event *);
} fmd_modops_t;
typedef struct fmd_modhash {
/*
* Statistics maintained by fmd itself on behalf of all modules for fmstat(1M).
* NOTE: FMD_TYPE_STRING statistics should not be used here. If they are
* required in the future, the FMD_ADM_MODDSTAT service routine must change.
*/
typedef struct fmd_modstat {
typedef struct fmd_module {
int mod_error; /* error return from module thread */
char *mod_name; /* basename of module (ro) */
char *mod_path; /* full pathname of module file (ro) */
char *mod_ckpt; /* pathname of checkpoint dir (ro) */
void *mod_data; /* data private to module ops vector */
void *mod_spec; /* fmd_hdl_get/setspecific data value */
int mod_argc; /* size of mod_argv formals array */
int mod_dictc; /* size of mod_dictv array */
} fmd_module_t;
typedef struct fmd_modtimer {
void *mt_arg; /* module private timer argument */
extern void fmd_module_unload(fmd_module_t *);
extern void fmd_module_destroy(fmd_module_t *);
extern void fmd_module_gc(fmd_module_t *);
extern void fmd_module_trygc(fmd_module_t *);
extern void fmd_module_setdirty(fmd_module_t *);
extern void fmd_module_setcdirty(fmd_module_t *);
extern void fmd_module_clrdirty(fmd_module_t *);
extern void fmd_module_commit(fmd_module_t *);
extern void fmd_module_lock(fmd_module_t *);
extern void fmd_module_unlock(fmd_module_t *);
extern int fmd_module_trylock(fmd_module_t *);
extern int fmd_module_locked(fmd_module_t *);
extern void fmd_module_unregister(fmd_module_t *);
extern void fmd_module_exit(fmd_module_t *);
extern void fmd_module_hold(fmd_module_t *);
extern void fmd_module_rele(fmd_module_t *);
extern int fmd_module_dc_opendict(fmd_module_t *, const char *);
extern int fmd_module_dc_key2code(fmd_module_t *,
char *const [], char *, size_t);
extern fmd_modhash_t *fmd_modhash_create(void);
extern void fmd_modhash_destroy(fmd_modhash_t *);
const char *, const fmd_modops_t *);
extern void fmd_modhash_loadall(fmd_modhash_t *,
const fmd_conf_path_t *, const fmd_modops_t *, const char *);
extern int fmd_modhash_unload(fmd_modhash_t *, const char *);
extern void fmd_modstat_publish(fmd_module_t *);
#ifdef __cplusplus
}
#endif
#endif /* _FMD_MODULE_H */