[PATCH 36/42] state: backend_circular: Set minumum writesize to 8

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 31 00:03:40 PDT 2017


NOR flashes have a write size of 1. With this the metadata may
end up on non-4-byte-aligned offsets. Force the minimum writesize
to 8 so that the metadata is always at aligned offsets.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/state/backend_bucket_circular.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 58fffd18e3..5a525f68e1 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -475,6 +475,9 @@ int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
 	struct state_backend_storage_bucket_circular *circ;
 	int ret;
 
+	if (writesize < 8)
+		writesize = 8;
+
 	circ = xzalloc(sizeof(*circ));
 	circ->eraseblock = eraseblock;
 	circ->writesize = writesize;
-- 
2.11.0




More information about the barebox mailing list