xref: /titanic_50/usr/src/lib/fm/libfmevent/common/fmev_impl.h (revision 31c6d826a7f7a4ee7d83c8e99f25d82a4a248076)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef _FMEV_IMPL_H
27 #define	_FMEV_IMPL_H
28 
29 /*
30  * libfmevent - private implementation
31  *
32  * Note: The contents of this file are private to the implementation of
33  * libfmevent and are subject to change at any time without notice.
34  * This file is not delivered into /usr/include.
35  */
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #include <assert.h>
42 #include <errno.h>
43 #include <libuutil.h>
44 #include <libsysevent.h>
45 #include <fm/libfmevent.h>
46 #include <fm/libtopo.h>
47 
48 #include "fmev_channels.h"
49 
50 #ifdef DEBUG
51 #define	ASSERT(x) (assert(x))
52 #else
53 #define	ASSERT(x)
54 #endif
55 
56 struct fmev_hdl_cmn {
57 	uint32_t hc_magic;
58 	uint32_t hc_api_vers;
59 	void *(*hc_alloc)(size_t);
60 	void *(*hc_zalloc)(size_t);
61 	void (*hc_free)(void *, size_t);
62 };
63 
64 #define	_FMEV_SHMAGIC	0x5368446c	/* ShDl */
65 
66 struct fmev_hdl_cmn *fmev_shdl_cmn(fmev_shdl_t);
67 
68 extern void *dflt_alloc(size_t);
69 extern void *dflt_zalloc(size_t);
70 extern void dflt_free(void *, size_t);
71 
72 extern int fmev_api_init(struct fmev_hdl_cmn *);
73 extern int fmev_api_enter(struct fmev_hdl_cmn *, uint32_t);
74 extern void fmev_api_freetsd(void);
75 extern fmev_err_t fmev_seterr(fmev_err_t);
76 extern int fmev_shdl_valid(fmev_shdl_t);
77 extern fmev_t fmev_sysev2fmev(fmev_shdl_t, sysevent_t *sep, char **,
78     nvlist_t **);
79 extern topo_hdl_t *fmev_topohdl(fmev_shdl_t);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif /* _FMEV_IMPL_H */
86