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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
30 * Each general-purpose state structure is named by an FMRI - the FMRI of the
31 * piece of hardware being described. FMRIs are nvlists, and thus require
32 * special handling if they are to be persisted along with the general-purpose
33 * buffer. The gmem_fmri_t manages the FMRI, both in packed (persistable) and
34 * unpacked formats. The packed FMRI is stored in a separate buffer (named by
35 * the fmri_packnm member), from which it can be unpacked on restore.
42 * |,-------| ,-------------.
43 * ||fmri_t | ----> |packed nvlist|
44 * |`-------| `-------------'
47 * The buffer for the general purpose buffer is named and stored independently.
48 * This subsystem creates and manages the packed nvlist buffer, using a name
49 * provided by the caller.
52 #include <libnvpair.h>
53 #include <fm/fmd_api.h>
54 #include <sys/types.h>
56 #include <gmem_state.h>
62 typedef struct gmem_fmri
{
63 nvlist_t
*fmri_nvl
; /* The unpacked FMRI FMRI */
64 char *fmri_packbuf
; /* In-core packed nvlist buffer */
65 size_t fmri_packsz
; /* Size of packed nvlist buffer */
66 char fmri_packnm
[GMEM_BUFNMLEN
]; /* Persistent buffer name for FMRI */
69 extern void gmem_fmri_init(fmd_hdl_t
*, gmem_fmri_t
*, nvlist_t
*,
71 extern void gmem_fmri_fini(fmd_hdl_t
*, gmem_fmri_t
*, int);
73 extern void gmem_fmri_restore(fmd_hdl_t
*, gmem_fmri_t
*);
74 extern void gmem_fmri_write(fmd_hdl_t
*, gmem_fmri_t
*);
80 #endif /* _GMEM_FMRI_H */