xref: /illumos-gate/usr/src/cmd/fm/fmd/common/fmd_fmri.h (revision e8031f0a)
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 2005 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 #ifndef	MIN
58 #define	MIN(x, y) ((x) < (y) ? (x) : (y))
59 #endif
60 
61 #ifndef	MAX
62 #define	MAX(x, y) ((x) > (y) ? (x) : (y))
63 #endif
64 
65 extern void *fmd_fmri_alloc(size_t);
66 extern void *fmd_fmri_zalloc(size_t);
67 extern void fmd_fmri_free(void *, size_t);
68 
69 extern int fmd_fmri_set_errno(int);
70 extern void fmd_fmri_warn(const char *, ...);
71 
72 extern char *fmd_fmri_auth2str(nvlist_t *);
73 extern char *fmd_fmri_strescape(const char *);
74 extern char *fmd_fmri_strdup(const char *);
75 extern void fmd_fmri_strfree(char *);
76 
77 extern const char *fmd_fmri_get_rootdir(void);
78 extern const char *fmd_fmri_get_platform(void);
79 
80 extern uint64_t fmd_fmri_get_drgen(void);
81 
82 /*
83  * The following entry points are to be implemented by each scheme:
84  */
85 extern int fmd_fmri_init(void);
86 extern void fmd_fmri_fini(void);
87 extern ssize_t fmd_fmri_nvl2str(nvlist_t *, char *, size_t);
88 extern int fmd_fmri_expand(nvlist_t *);
89 extern int fmd_fmri_present(nvlist_t *);
90 extern int fmd_fmri_unusable(nvlist_t *);
91 extern int fmd_fmri_contains(nvlist_t *, nvlist_t *);
92 extern nvlist_t *fmd_fmri_translate(nvlist_t *, nvlist_t *);
93 
94 #ifdef	__cplusplus
95 }
96 #endif
97 
98 #endif	/* _FMD_FMRI_H */
99