summaryrefslogtreecommitdiffstats
path: root/contrib/dtc/dtc.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/dtc/dtc.h')
-rw-r--r--contrib/dtc/dtc.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/contrib/dtc/dtc.h b/contrib/dtc/dtc.h
index 7ee2d54..20e4d56 100644
--- a/contrib/dtc/dtc.h
+++ b/contrib/dtc/dtc.h
@@ -66,7 +66,6 @@ typedef uint32_t cell_t;
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/* Data blobs */
enum markertype {
@@ -119,7 +118,7 @@ struct data data_append_align(struct data d, int align);
struct data data_add_marker(struct data d, enum markertype type, char *ref);
-int data_is_one_string(struct data d);
+bool data_is_one_string(struct data d);
/* DT constraints */
@@ -128,11 +127,13 @@ int data_is_one_string(struct data d);
/* Live trees */
struct label {
+ bool deleted;
char *label;
struct label *next;
};
struct property {
+ bool deleted;
char *name;
struct data val;
@@ -142,6 +143,7 @@ struct property {
};
struct node {
+ bool deleted;
char *name;
struct property *proplist;
struct node *children;
@@ -158,28 +160,47 @@ struct node {
struct label *labels;
};
-#define for_each_label(l0, l) \
+#define for_each_label_withdel(l0, l) \
for ((l) = (l0); (l); (l) = (l)->next)
-#define for_each_property(n, p) \
+#define for_each_label(l0, l) \
+ for_each_label_withdel(l0, l) \
+ if (!(l)->deleted)
+
+#define for_each_property_withdel(n, p) \
for ((p) = (n)->proplist; (p); (p) = (p)->next)
-#define for_each_child(n, c) \
+#define for_each_property(n, p) \
+ for_each_property_withdel(n, p) \
+ if (!(p)->deleted)
+
+#define for_each_child_withdel(n, c) \
for ((c) = (n)->children; (c); (c) = (c)->next_sibling)
+#define for_each_child(n, c) \
+ for_each_child_withdel(n, c) \
+ if (!(c)->deleted)
+
void add_label(struct label **labels, char *label);
+void delete_labels(struct label **labels);
struct property *build_property(char *name, struct data val);
+struct property *build_property_delete(char *name);
struct property *chain_property(struct property *first, struct property *list);
struct property *reverse_properties(struct property *first);
struct node *build_node(struct property *proplist, struct node *children);
+struct node *build_node_delete(void);
struct node *name_node(struct node *node, char *name);
struct node *chain_node(struct node *first, struct node *list);
struct node *merge_nodes(struct node *old_node, struct node *new_node);
void add_property(struct node *node, struct property *prop);
+void delete_property_by_name(struct node *node, char *name);
+void delete_property(struct property *prop);
void add_child(struct node *parent, struct node *child);
+void delete_node_by_name(struct node *parent, char *name);
+void delete_node(struct node *node);
const char *get_unitname(struct node *node);
struct property *get_property(struct node *node, const char *propname);
@@ -227,7 +248,7 @@ void sort_tree(struct boot_info *bi);
/* Checks */
void parse_checks_option(bool warn, bool error, const char *optarg);
-void process_checks(int force, struct boot_info *bi);
+void process_checks(bool force, struct boot_info *bi);
/* Flattened trees */
OpenPOWER on IntegriCloud