xref: /titanic_41/usr/src/cmd/fm/fmd/common/fmd_fmri.h (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef	_FMD_FMRI_H
29 #define	_FMD_FMRI_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #include <sys/types.h>
34 #include <sys/fm/protocol.h>
35 #include <libnvpair.h>
36 #include <errno.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Fault Management Daemon FMRI Scheme Interfaces
44  *
45  * Note: The contents of this file are private to the implementation of the
46  * Solaris system and FMD subsystem and are subject to change at any time
47  * without notice.  Applications and drivers using these interfaces will fail
48  * to run on future releases.  These interfaces should not be used for any
49  * purpose until they are publicly documented for use outside of Sun.
50  */
51 
52 /*
53  * The following utility functions (in addition to libnvpair) are provided by
54  * fmd to facilitate the implementation of each FMRI scheme library.
55  */
56 
57 struct topo_hdl;
58 
59 #ifndef	MIN
60 #define	MIN(x, y) ((x) < (y) ? (x) : (y))
61 #endif
62 
63 #ifndef	MAX
64 #define	MAX(x, y) ((x) > (y) ? (x) : (y))
65 #endif
66 
67 extern void *fmd_fmri_alloc(size_t);
68 extern void *fmd_fmri_zalloc(size_t);
69 extern void fmd_fmri_free(void *, size_t);
70 
71 extern int fmd_fmri_set_errno(int);
72 extern void fmd_fmri_warn(const char *, ...);
73 
74 extern char *fmd_fmri_auth2str(nvlist_t *);
75 extern char *fmd_fmri_strescape(const char *);
76 extern char *fmd_fmri_strdup(const char *);
77 extern void fmd_fmri_strfree(char *);
78 
79 extern const char *fmd_fmri_get_rootdir(void);
80 extern const char *fmd_fmri_get_platform(void);
81 
82 extern uint64_t fmd_fmri_get_drgen(void);
83 
84 extern struct topo_hdl *fmd_fmri_topology(int);
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