Lines Matching +full:child +full:- +full:nodes
1 /* SPDX-License-Identifier: GPL-2.0 */
27 #define BOOTCONFIG_ALIGN_MASK (BOOTCONFIG_ALIGN - 1)
30 * xbc_calc_checksum() - Calculate checksum of bootconfig
43 while (size--) in xbc_calc_checksum()
52 uint16_t child; member
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
82 return node->data & XBC_VALUE; in xbc_node_is_value()
86 * xbc_node_is_key() - Test the node is a key node
97 * xbc_node_is_array() - 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
112 * or no child. Returns true if it is a leaf node, or false if not.
113 * Note that the leaf node can have subkey nodes in addition to the
119 (!node->child || xbc_node_is_value(xbc_node_get_child(node))); in xbc_node_is_leaf()
122 /* Tree-based key-value access APIs */
137 * xbc_find_value() - Find a value which matches the key
143 * Note that this can return 0-length string and store NULL in *@vnode for
144 * key-only (non-value) entry.
153 * xbc_find_node() - Find a node which matches the key
165 * xbc_node_get_subkey() - Return the first subkey node if exists
168 * Return the first subkey node of the @node. If the @node has no child
173 struct xbc_node *child = xbc_node_get_child(node); in xbc_node_get_subkey() local
175 if (child && xbc_node_is_value(child)) in xbc_node_get_subkey()
176 return xbc_node_get_next(child); in xbc_node_get_subkey()
178 return child; in xbc_node_get_subkey()
182 * xbc_array_for_each_value() - Iterate value nodes on an array
186 * Iterate array value nodes and values starts from @anode. This is expected to
196 * xbc_node_for_each_child() - Iterate child nodes
198 * @child: Iterated XBC node.
200 * Iterate child nodes of @parent. Each child nodes are stored to @child.
201 * The @child can be mixture of a value node and subkey nodes.
203 #define xbc_node_for_each_child(parent, child) \ argument
204 for (child = xbc_node_get_child(parent); child != NULL ; \
205 child = xbc_node_get_next(child))
208 * xbc_node_for_each_subkey() - Iterate child subkey nodes
210 * @child: Iterated XBC node.
212 * Iterate subkey nodes of @parent. Each child nodes are stored to @child.
213 * The @child is only the subkey node.
215 #define xbc_node_for_each_subkey(parent, child) \ argument
216 for (child = xbc_node_get_subkey(parent); child != NULL ; \
217 child = xbc_node_get_next(child))
220 * xbc_node_for_each_array_value() - Iterate array entries of geven key
231 * (key-only node), this does nothing. So don't use this for testing the
232 * key-value pair existence.
240 * xbc_node_for_each_key_value() - Iterate key-value pairs under a node
245 * Iterate key-value pairs under @node. Each key node and value string are
253 * xbc_for_each_key_value() - Iterate key-value pairs
257 * Iterate key-value pairs in whole XBC tree. Each key node and value string
268 * xbc_node_compose_key() - Compose full key string of the XBC node
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.