1*eb686149SLandon J. Fuller /*- 2*eb686149SLandon J. Fuller * Copyright (c) 2015-2016 Landon Fuller <landon@landonf.org> 3*eb686149SLandon J. Fuller * All rights reserved. 4*eb686149SLandon J. Fuller * 5*eb686149SLandon J. Fuller * Redistribution and use in source and binary forms, with or without 6*eb686149SLandon J. Fuller * modification, are permitted provided that the following conditions 7*eb686149SLandon J. Fuller * are met: 8*eb686149SLandon J. Fuller * 1. Redistributions of source code must retain the above copyright 9*eb686149SLandon J. Fuller * notice, this list of conditions and the following disclaimer, 10*eb686149SLandon J. Fuller * without modification. 11*eb686149SLandon J. Fuller * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12*eb686149SLandon J. Fuller * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13*eb686149SLandon J. Fuller * redistribution must be conditioned upon including a substantially 14*eb686149SLandon J. Fuller * similar Disclaimer requirement for further binary redistribution. 15*eb686149SLandon J. Fuller * 16*eb686149SLandon J. Fuller * NO WARRANTY 17*eb686149SLandon J. Fuller * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18*eb686149SLandon J. Fuller * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*eb686149SLandon J. Fuller * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 20*eb686149SLandon J. Fuller * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21*eb686149SLandon J. Fuller * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 22*eb686149SLandon J. Fuller * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23*eb686149SLandon J. Fuller * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24*eb686149SLandon J. Fuller * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25*eb686149SLandon J. Fuller * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26*eb686149SLandon J. Fuller * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27*eb686149SLandon J. Fuller * THE POSSIBILITY OF SUCH DAMAGES. 28*eb686149SLandon J. Fuller * 29*eb686149SLandon J. Fuller */ 30*eb686149SLandon J. Fuller 31*eb686149SLandon J. Fuller #ifndef _BHND_NVRAM_BHND_PLISTVAR_H_ 32*eb686149SLandon J. Fuller #define _BHND_NVRAM_BHND_PLISTVAR_H_ 33*eb686149SLandon J. Fuller 34*eb686149SLandon J. Fuller #include "bhnd_nvram_plist.h" 35*eb686149SLandon J. Fuller #include <sys/queue.h> 36*eb686149SLandon J. Fuller 37*eb686149SLandon J. Fuller LIST_HEAD(bhnd_nvram_plist_entry_list, bhnd_nvram_plist_entry); 38*eb686149SLandon J. Fuller 39*eb686149SLandon J. Fuller typedef struct bhnd_nvram_plist_entry bhnd_nvram_plist_entry; 40*eb686149SLandon J. Fuller typedef struct bhnd_nvram_plist_entry_list bhnd_nvram_plist_entry_list; 41*eb686149SLandon J. Fuller 42*eb686149SLandon J. Fuller /** 43*eb686149SLandon J. Fuller * NVRAM property. 44*eb686149SLandon J. Fuller */ 45*eb686149SLandon J. Fuller struct bhnd_nvram_prop { 46*eb686149SLandon J. Fuller volatile u_int refs; /**< refcount */ 47*eb686149SLandon J. Fuller 48*eb686149SLandon J. Fuller char *name; /**< property name */ 49*eb686149SLandon J. Fuller bhnd_nvram_val *val; /**< property value */ 50*eb686149SLandon J. Fuller }; 51*eb686149SLandon J. Fuller 52*eb686149SLandon J. Fuller /** 53*eb686149SLandon J. Fuller * NVRAM property list entry. 54*eb686149SLandon J. Fuller */ 55*eb686149SLandon J. Fuller struct bhnd_nvram_plist_entry { 56*eb686149SLandon J. Fuller bhnd_nvram_prop *prop; 57*eb686149SLandon J. Fuller 58*eb686149SLandon J. Fuller TAILQ_ENTRY(bhnd_nvram_plist_entry) pl_link; 59*eb686149SLandon J. Fuller LIST_ENTRY(bhnd_nvram_plist_entry) pl_hash_link; 60*eb686149SLandon J. Fuller }; 61*eb686149SLandon J. Fuller 62*eb686149SLandon J. Fuller /** 63*eb686149SLandon J. Fuller * NVRAM property list. 64*eb686149SLandon J. Fuller * 65*eb686149SLandon J. Fuller * Provides an ordered list of property values. 66*eb686149SLandon J. Fuller */ 67*eb686149SLandon J. Fuller struct bhnd_nvram_plist { 68*eb686149SLandon J. Fuller volatile u_int refs; /**< refcount */ 69*eb686149SLandon J. Fuller TAILQ_HEAD(,bhnd_nvram_plist_entry) entries; /**< all properties */ 70*eb686149SLandon J. Fuller size_t num_entries; /**< entry count */ 71*eb686149SLandon J. Fuller bhnd_nvram_plist_entry_list names[16]; /**< name-based hash table */ 72*eb686149SLandon J. Fuller }; 73*eb686149SLandon J. Fuller 74*eb686149SLandon J. Fuller #endif /* _BHND_NVRAM_BHND_PLISTVAR_H_ */ 75