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