xref: /titanic_51/usr/src/lib/fm/libfmevent/common/fmev_impl.h (revision f6e214c7418f43af38bd8c3a557e3d0a1d311cfa)
149b225e1SGavin Maltby /*
249b225e1SGavin Maltby  * CDDL HEADER START
349b225e1SGavin Maltby  *
449b225e1SGavin Maltby  * The contents of this file are subject to the terms of the
549b225e1SGavin Maltby  * Common Development and Distribution License (the "License").
649b225e1SGavin Maltby  * You may not use this file except in compliance with the License.
749b225e1SGavin Maltby  *
849b225e1SGavin Maltby  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
949b225e1SGavin Maltby  * or http://www.opensolaris.org/os/licensing.
1049b225e1SGavin Maltby  * See the License for the specific language governing permissions
1149b225e1SGavin Maltby  * and limitations under the License.
1249b225e1SGavin Maltby  *
1349b225e1SGavin Maltby  * When distributing Covered Code, include this CDDL HEADER in each
1449b225e1SGavin Maltby  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1549b225e1SGavin Maltby  * If applicable, add the following below this CDDL HEADER, with the
1649b225e1SGavin Maltby  * fields enclosed by brackets "[]" replaced with your own identifying
1749b225e1SGavin Maltby  * information: Portions Copyright [yyyy] [name of copyright owner]
1849b225e1SGavin Maltby  *
1949b225e1SGavin Maltby  * CDDL HEADER END
2049b225e1SGavin Maltby  */
2149b225e1SGavin Maltby 
2249b225e1SGavin Maltby /*
23*f6e214c7SGavin Maltby  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
2449b225e1SGavin Maltby  */
2549b225e1SGavin Maltby 
2649b225e1SGavin Maltby #ifndef _FMEV_IMPL_H
2749b225e1SGavin Maltby #define	_FMEV_IMPL_H
2849b225e1SGavin Maltby 
2949b225e1SGavin Maltby /*
3049b225e1SGavin Maltby  * libfmevent - private implementation
3149b225e1SGavin Maltby  *
3249b225e1SGavin Maltby  * Note: The contents of this file are private to the implementation of
3349b225e1SGavin Maltby  * libfmevent and are subject to change at any time without notice.
3449b225e1SGavin Maltby  * This file is not delivered into /usr/include.
3549b225e1SGavin Maltby  */
3649b225e1SGavin Maltby 
3749b225e1SGavin Maltby #ifdef __cplusplus
3849b225e1SGavin Maltby extern "C" {
3949b225e1SGavin Maltby #endif
4049b225e1SGavin Maltby 
4149b225e1SGavin Maltby #include <assert.h>
4249b225e1SGavin Maltby #include <errno.h>
4349b225e1SGavin Maltby #include <libuutil.h>
4449b225e1SGavin Maltby #include <libsysevent.h>
4549b225e1SGavin Maltby #include <fm/libfmevent.h>
46*f6e214c7SGavin Maltby #include <fm/libtopo.h>
47*f6e214c7SGavin Maltby 
48*f6e214c7SGavin Maltby #include "fmev_channels.h"
4949b225e1SGavin Maltby 
5049b225e1SGavin Maltby #ifdef DEBUG
5149b225e1SGavin Maltby #define	ASSERT(x) (assert(x))
5249b225e1SGavin Maltby #else
5349b225e1SGavin Maltby #define	ASSERT(x)
5449b225e1SGavin Maltby #endif
5549b225e1SGavin Maltby 
5649b225e1SGavin Maltby struct fmev_hdl_cmn {
5749b225e1SGavin Maltby 	uint32_t hc_magic;
5849b225e1SGavin Maltby 	uint32_t hc_api_vers;
5949b225e1SGavin Maltby 	void *(*hc_alloc)(size_t);
6049b225e1SGavin Maltby 	void *(*hc_zalloc)(size_t);
6149b225e1SGavin Maltby 	void (*hc_free)(void *, size_t);
6249b225e1SGavin Maltby };
6349b225e1SGavin Maltby 
64*f6e214c7SGavin Maltby #define	_FMEV_SHMAGIC	0x5368446c	/* ShDl */
65*f6e214c7SGavin Maltby 
6649b225e1SGavin Maltby struct fmev_hdl_cmn *fmev_shdl_cmn(fmev_shdl_t);
6749b225e1SGavin Maltby 
68*f6e214c7SGavin Maltby extern void *dflt_alloc(size_t);
69*f6e214c7SGavin Maltby extern void *dflt_zalloc(size_t);
70*f6e214c7SGavin Maltby extern void dflt_free(void *, size_t);
71*f6e214c7SGavin Maltby 
7249b225e1SGavin Maltby extern int fmev_api_init(struct fmev_hdl_cmn *);
7349b225e1SGavin Maltby extern int fmev_api_enter(struct fmev_hdl_cmn *, uint32_t);
7449b225e1SGavin Maltby extern void fmev_api_freetsd(void);
7549b225e1SGavin Maltby extern fmev_err_t fmev_seterr(fmev_err_t);
7649b225e1SGavin Maltby extern int fmev_shdl_valid(fmev_shdl_t);
7749b225e1SGavin Maltby extern fmev_t fmev_sysev2fmev(fmev_shdl_t, sysevent_t *sep, char **,
7849b225e1SGavin Maltby     nvlist_t **);
79*f6e214c7SGavin Maltby extern topo_hdl_t *fmev_topohdl(fmev_shdl_t);
8049b225e1SGavin Maltby 
8149b225e1SGavin Maltby #ifdef __cplusplus
8249b225e1SGavin Maltby }
8349b225e1SGavin Maltby #endif
8449b225e1SGavin Maltby 
8549b225e1SGavin Maltby #endif /* _FMEV_IMPL_H */
86