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 _CMD_FMRI_H 28 #define _CMD_FMRI_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 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. 39 * 40 * Data structures: 41 * 42 * ,--------. 43 * |G.P. | 44 * |buffer | 45 * |,-------| ,-------------. 46 * ||fmri_t | ----> |packed nvlist| 47 * |`-------| `-------------' 48 * `--------' 49 * 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. 53 */ 54 55 #include <libnvpair.h> 56 #include <fm/fmd_api.h> 57 #include <sys/types.h> 58 59 #include <cmd_state.h> 60 61 #ifdef __cplusplus 62 extern "C" { 63 #endif 64 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 */ 70 } cmd_fmri_t; 71 72 extern void cmd_fmri_init(fmd_hdl_t *, cmd_fmri_t *, nvlist_t *, 73 const char *, ...); 74 extern void cmd_fmri_fini(fmd_hdl_t *, cmd_fmri_t *, int); 75 76 extern void cmd_fmri_restore(fmd_hdl_t *, cmd_fmri_t *); 77 extern void cmd_fmri_write(fmd_hdl_t *, cmd_fmri_t *); 78 79 #ifdef __cplusplus 80 } 81 #endif 82 83 #endif /* _CMD_FMRI_H */ 84