xref: /titanic_44/usr/src/cmd/fm/fmd/common/fmd_fmri.h (revision 54925bf60766fbb4f1f2d7c843721406a7b7a3fb)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMD_FMRI_H
28 #define	_FMD_FMRI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/fm/protocol.h>
34 #include <libnvpair.h>
35 #include <errno.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * Fault Management Daemon FMRI Scheme Interfaces
43  *
44  * Note: The contents of this file are private to the implementation of the
45  * Solaris system and FMD subsystem and are subject to change at any time
46  * without notice.  Applications and drivers using these interfaces will fail
47  * to run on future releases.  These interfaces should not be used for any
48  * purpose until they are publicly documented for use outside of Sun.
49  */
50 
51 /*
52  * The following utility functions (in addition to libnvpair) are provided by
53  * fmd to facilitate the implementation of each FMRI scheme library.
54  */
55 
56 struct topo_hdl;
57 
58 #ifndef	MIN
59 #define	MIN(x, y) ((x) < (y) ? (x) : (y))
60 #endif
61 
62 #ifndef	MAX
63 #define	MAX(x, y) ((x) > (y) ? (x) : (y))
64 #endif
65 
66 extern void *fmd_fmri_alloc(size_t);
67 extern void *fmd_fmri_zalloc(size_t);
68 extern void fmd_fmri_free(void *, size_t);
69 
70 extern int fmd_fmri_set_errno(int);
71 extern void fmd_fmri_warn(const char *, ...);
72 
73 extern char *fmd_fmri_auth2str(nvlist_t *);
74 extern char *fmd_fmri_strescape(const char *);
75 extern char *fmd_fmri_strdup(const char *);
76 extern void fmd_fmri_strfree(char *);
77 
78 extern const char *fmd_fmri_get_rootdir(void);
79 extern const char *fmd_fmri_get_platform(void);
80 
81 extern uint64_t fmd_fmri_get_drgen(void);
82 
83 extern struct topo_hdl *fmd_fmri_topo_hold(int);
84 extern void fmd_fmri_topo_rele(struct topo_hdl *);
85 
86 /*
87  * The following entry points are to be implemented by each scheme:
88  */
89 extern int fmd_fmri_init(void);
90 extern void fmd_fmri_fini(void);
91 extern ssize_t fmd_fmri_nvl2str(nvlist_t *, char *, size_t);
92 extern int fmd_fmri_expand(nvlist_t *);
93 extern int fmd_fmri_present(nvlist_t *);
94 extern int fmd_fmri_unusable(nvlist_t *);
95 extern int fmd_fmri_contains(nvlist_t *, nvlist_t *);
96 extern nvlist_t *fmd_fmri_translate(nvlist_t *, nvlist_t *);
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif	/* _FMD_FMRI_H */
103