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
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.
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]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Each general-purpose state structure is named by an FMRI - the FMRI of the
34 * piece of hardware being described. FMRIs are nvlists, and thus require
35 * special handling if they are to be persisted along with the general-purpose
36 * buffer. The cmd_fmri_t manages the FMRI, both in packed (persistable) and
37 * unpacked formats. The packed FMRI is stored in a separate buffer (named by
38 * the fmri_packnm member), from which it can be unpacked on restore.
45 * |,-------| ,-------------.
46 * ||fmri_t | ----> |packed nvlist|
47 * |`-------| `-------------'
50 * The buffer for the general purpose buffer is named and stored independently.
51 * This subsystem creates and manages the packed nvlist buffer, using a name
52 * provided by the caller.
55 #include <libnvpair.h>
56 #include <fm/fmd_api.h>
57 #include <sys/types.h>
59 #include <cmd_state.h>
65 typedef struct cmd_fmri
{
66 nvlist_t
*fmri_nvl
; /* The unpacked FMRI FMRI */
67 char *fmri_packbuf
; /* In-core packed nvlist buffer */
68 size_t fmri_packsz
; /* Size of packed nvlist buffer */
69 char fmri_packnm
[CMD_BUFNMLEN
]; /* Persistent buffer name for FMRI */
72 extern void cmd_fmri_init(fmd_hdl_t
*, cmd_fmri_t
*, nvlist_t
*,
74 extern void cmd_fmri_fini(fmd_hdl_t
*, cmd_fmri_t
*, int);
76 extern void cmd_fmri_restore(fmd_hdl_t
*, cmd_fmri_t
*);
77 extern void cmd_fmri_write(fmd_hdl_t
*, cmd_fmri_t
*);
83 #endif /* _CMD_FMRI_H */