2 * Copyright (c) 2015-2016 Landon Fuller <landonf@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification.
11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13 * redistribution must be conditioned upon including a substantially
14 * similar Disclaimer requirement for further binary redistribution.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGES.
32 #ifndef _BHND_NVRAM_BHND_NVRAM_STORE_H_
33 #define _BHND_NVRAM_BHND_NVRAM_STORE_H_
36 #include <sys/param.h>
44 #include <sys/queue.h>
46 #include "bhnd_nvram_data.h"
47 #include "bhnd_nvram_io.h"
49 struct bhnd_nvram_store;
55 BHND_NVSTORE_EXPORT_CHILDREN = (1<<0), /**< Include all subpaths */
56 BHND_NVSTORE_EXPORT_PRESERVE_DEVPATHS = (1<<1), /**< Preserve existing device path definitions (default) */
57 BHND_NVSTORE_EXPORT_COMPACT_DEVPATHS = (1<<2), /**< Re-encode all device paths using compact syntax */
58 BHND_NVSTORE_EXPORT_EXPAND_DEVPATHS = (1<<3), /**< Re-encode all device paths using non-compact syntax */
59 BHND_NVSTORE_EXPORT_ALL_VARS = (1<<6|1<<7), /**< Include all variables (default) */
60 BHND_NVSTORE_EXPORT_COMMITTED = (1<<6), /**< Include all committed changes */
61 BHND_NVSTORE_EXPORT_UNCOMMITTED = (1<<7), /**< Include all uncommitted changes (not including deletions) */
62 BHND_NVSTORE_EXPORT_DELETED = (1<<8), /**< Include all uncommitted deltions (as
63 properties of type BHND_NVRAM_TYPE_NULL) */
66 int bhnd_nvram_store_new(struct bhnd_nvram_store **store,
67 struct bhnd_nvram_data *data);
69 int bhnd_nvram_store_parse_new(struct bhnd_nvram_store **store,
70 struct bhnd_nvram_io *io, bhnd_nvram_data_class *cls);
72 void bhnd_nvram_store_free(struct bhnd_nvram_store *store);
74 int bhnd_nvram_store_export(struct bhnd_nvram_store *store,
75 const char *path, bhnd_nvram_data_class **cls,
76 bhnd_nvram_plist **props, bhnd_nvram_plist **options,
79 int bhnd_nvram_store_serialize(struct bhnd_nvram_store *store,
80 const char *path, struct bhnd_nvram_io **data, uint32_t flags);
82 int bhnd_nvram_store_getvar(struct bhnd_nvram_store *sc, const char *name,
83 void *outp, size_t *olen, bhnd_nvram_type otype);
84 int bhnd_nvram_store_setvar(struct bhnd_nvram_store *sc, const char *name,
85 const void *inp, size_t ilen, bhnd_nvram_type itype);
86 int bhnd_nvram_store_unsetvar(struct bhnd_nvram_store *sc,
89 int bhnd_nvram_store_setval(struct bhnd_nvram_store *sc, const char *name,
90 bhnd_nvram_val *value);
92 #endif /* _BHND_NVRAM_BHND_NVRAM_STORE_H_ */