summaryrefslogtreecommitdiffstats
path: root/common/state/state.h
diff options
context:
space:
mode:
authorDaniel Schultz <d.schultz@phytec.de>2018-04-12 11:13:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-04-16 09:54:11 +0200
commit67c1c0853fa06bcbc1725e93b6ad9942e80a1e56 (patch)
treee7595ca6de862364a112767a6c3ca09995f62833 /common/state/state.h
parent6377d27b951bfddc67bba16e83f79ae1d9fa8eb9 (diff)
downloadbarebox-67c1c0853fa06bcbc1725e93b6ad9942e80a1e56.tar.gz
barebox-67c1c0853fa06bcbc1725e93b6ad9942e80a1e56.tar.xz
common: state: Add property to protect existing data
After an update to a newer barebox version with an enabled state framework, existing data in storage memories could be overwritten. Add a new property to check in front of every write task, if the meta magic field only contains the magic number, zeros or ones. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state/state.h')
-rw-r--r--common/state/state.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/state/state.h b/common/state/state.h
index 6670523cbb..3a0662fd25 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -46,6 +46,7 @@ struct state_backend_storage_bucket {
void *buf;
ssize_t len;
bool needs_refresh;
+ bool wrong_magic;
};
/**
@@ -105,6 +106,7 @@ struct state {
char *of_path;
const char *name;
uint32_t magic;
+ bool keep_prev_content;
struct list_head variables; /* Sorted list of variables */