• Home
  • Raw
  • Download

Lines Matching +full:key +full:- +full:value

1 /* SPDX-License-Identifier: GPL-2.0 */
27 #define BOOTCONFIG_ALIGN_MASK (BOOTCONFIG_ALIGN - 1)
30 * xbc_calc_checksum() - Calculate checksum of bootconfig
34 * Calculate the checksum value of the bootconfig data.
43 while (size--) in xbc_calc_checksum()
59 /* Maximum size of boot config is 32KB - 1 */
60 #define XBC_DATA_MAX (XBC_VALUE - 1)
75 * xbc_node_is_value() - Test the node is a value node
78 * Test the @node is a value node and return true if a value node, false if not.
82 return node->data & XBC_VALUE; in xbc_node_is_value()
86 * xbc_node_is_key() - Test the node is a key node
89 * Test the @node is a key node and return true if a key node, false if not.
97 * xbc_node_is_array() - Test the node is an arraied value node
100 * Test the @node is an arraied value node.
104 return xbc_node_is_value(node) && node->child != 0; in xbc_node_is_array()
108 * xbc_node_is_leaf() - Test the node is a leaf key node
111 * Test the @node is a leaf key node which is a key node and has a value node
114 * value node.
119 (!node->child || xbc_node_is_value(xbc_node_get_child(node))); in xbc_node_is_leaf()
122 /* Tree-based key-value access APIs */
124 const char *key);
127 const char *key,
137 * xbc_find_value() - Find a value which matches the key
138 * @key: Search key
139 * @vnode: A container pointer of XBC value node.
141 * Search a value whose key matches @key from whole of XBC tree and return
142 * the value if found. Found value node is stored in *@vnode.
143 * Note that this can return 0-length string and store NULL in *@vnode for
144 * key-only (non-value) entry.
147 xbc_find_value(const char *key, struct xbc_node **vnode) in xbc_find_value() argument
149 return xbc_node_find_value(NULL, key, vnode); in xbc_find_value()
153 * xbc_find_node() - Find a node which matches the key
154 * @key: Search key
156 * Search a (key) node whose key matches @key from whole of XBC tree and
159 static inline struct xbc_node * __init xbc_find_node(const char *key) in xbc_find_node() argument
161 return xbc_node_find_subkey(NULL, key); in xbc_find_node()
165 * xbc_node_get_subkey() - Return the first subkey node if exists
169 * or only value node, this will return NULL.
182 * xbc_array_for_each_value() - Iterate value nodes on an array
183 * @anode: An XBC arraied value node
184 * @value: A value
186 * Iterate array value nodes and values starts from @anode. This is expected to
190 #define xbc_array_for_each_value(anode, value) \ argument
191 for (value = xbc_node_get_data(anode); anode != NULL ; \
193 value = anode ? xbc_node_get_data(anode) : NULL)
196 * xbc_node_for_each_child() - Iterate child nodes
201 * The @child can be mixture of a value node and subkey nodes.
208 * xbc_node_for_each_subkey() - Iterate child subkey nodes
220 * xbc_node_for_each_array_value() - Iterate array entries of geven key
222 * @key: A key string searched under @node
224 * @value: Iterated value of array entry.
226 * Iterate array entries of given @key under @node. Each array entry node
227 * is stored to @anode and @value. If the @node doesn't have @key node,
229 * Note that even if the found key node has only one value (not array)
230 * this executes block once. However, if the found key node has no value
231 * (key-only node), this does nothing. So don't use this for testing the
232 * key-value pair existence.
234 #define xbc_node_for_each_array_value(node, key, anode, value) \ argument
235 for (value = xbc_node_find_value(node, key, &anode); value != NULL; \
237 value = anode ? xbc_node_get_data(anode) : NULL)
240 * xbc_node_for_each_key_value() - Iterate key-value pairs under a node
242 * @knode: Iterated key node
243 * @value: Iterated value string
245 * Iterate key-value pairs under @node. Each key node and value string are
246 * stored in @knode and @value respectively.
248 #define xbc_node_for_each_key_value(node, knode, value) \ argument
249 for (knode = NULL, value = xbc_node_find_next_key_value(node, &knode);\
250 knode != NULL; value = xbc_node_find_next_key_value(node, &knode))
253 * xbc_for_each_key_value() - Iterate key-value pairs
254 * @knode: Iterated key node
255 * @value: Iterated value string
257 * Iterate key-value pairs in whole XBC tree. Each key node and value string
258 * are stored in @knode and @value respectively.
260 #define xbc_for_each_key_value(knode, value) \ argument
261 xbc_node_for_each_key_value(NULL, knode, value)
263 /* Compose partial key */
268 * xbc_node_compose_key() - Compose full key string of the XBC node
270 * @buf: A buffer to store the key.
273 * Compose the full-length key of the @node into @buf. Returns the total
274 * length of the key stored in @buf. Or returns -EINVAL if @node is NULL,
275 * and -ERANGE if the key depth is deeper than max depth.