summaryrefslogtreecommitdiffstats
path: root/include/state.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-03-10 15:54:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-12 08:28:31 +0100
commit1487e6b9ad2ec0fafb0a2a35c921a33fb6c37fec (patch)
tree22ae6baae5a65993b9ad46b39bdbc1e7f210b79e /include/state.h
parentdcc4a70a3c279669d21a90764cda29854244c237 (diff)
downloadbarebox-1487e6b9ad2ec0fafb0a2a35c921a33fb6c37fec.tar.gz
barebox-1487e6b9ad2ec0fafb0a2a35c921a33fb6c37fec.tar.xz
state: add framework for persistent state handling
This patch adds a framework to describe, access, store and restore a set of variables. A state variable set can be fully described in a devicetree node. This node could be part of the regular devicetree blob or it could be an extra devicetree solely for the state. The state variable set contains variables of different types and a place to store the variable set. For more information see: Documentation/devicetree/bindings/barebox/barebox,state.rst Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/state.h')
-rw-r--r--include/state.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/state.h b/include/state.h
new file mode 100644
index 0000000000..95bf8d263b
--- /dev/null
+++ b/include/state.h
@@ -0,0 +1,21 @@
+#ifndef __STATE_H
+#define __STATE_H
+
+struct state;
+
+int state_backend_dtb_file(struct state *state, const char *path);
+int state_backend_raw_file(struct state *state, const char *path,
+ off_t offset, size_t size);
+
+struct state *state_new_from_fdt(const char *name, void *fdt);
+struct state *state_new_from_node(const char *name, struct device_node *node);
+
+struct state *state_by_name(const char *name);
+struct state *state_by_node(const struct device_node *node);
+int state_get_name(const struct state *state, char const **name);
+
+int state_load(struct state *state);
+int state_save(struct state *state);
+void state_info(void);
+
+#endif /* __STATE_H */