summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-20 14:15:56 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-21 09:47:10 +0100
commitc55e8e1a19fa37c1bc49a1a6ba666135bdc45d8a (patch)
treeba5e4f9419cfab42d1a4480618ee9e7096162a07
parent7691495338bd2b816469b4287f6169b4f8de79d2 (diff)
downloaddt-utils-c55e8e1a19fa37c1bc49a1a6ba666135bdc45d8a.tar.gz
dt-utils-c55e8e1a19fa37c1bc49a1a6ba666135bdc45d8a.tar.xz
state: use packed attribute for on storage structs
These structs are used for on-storage data layouts. They should be not affected by different integer precisions and alignment optimizations of 32bit or 64bit machines. Using the architecture independent integer data types, like uint32_t, achieves the former, using the packed attribute the later. Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--src/barebox-state/backend_bucket_circular.c2
-rw-r--r--src/barebox-state/backend_bucket_direct.c2
-rw-r--r--src/barebox-state/backend_format_raw.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c
index 13cd742..0bce900 100644
--- a/src/barebox-state/backend_bucket_circular.c
+++ b/src/barebox-state/backend_bucket_circular.c
@@ -47,7 +47,7 @@ struct state_backend_storage_bucket_circular {
struct device_d *dev;
};
-struct state_backend_storage_bucket_circular_meta {
+struct __attribute__((__packed__)) state_backend_storage_bucket_circular_meta {
uint32_t magic;
uint32_t written_length;
};
diff --git a/src/barebox-state/backend_bucket_direct.c b/src/barebox-state/backend_bucket_direct.c
index 08892f0..5225433 100644
--- a/src/barebox-state/backend_bucket_direct.c
+++ b/src/barebox-state/backend_bucket_direct.c
@@ -32,7 +32,7 @@ struct state_backend_storage_bucket_direct {
struct device_d *dev;
};
-struct state_backend_storage_bucket_direct_meta {
+struct __attribute__((__packed__)) state_backend_storage_bucket_direct_meta {
uint32_t magic;
uint32_t written_length;
};
diff --git a/src/barebox-state/backend_format_raw.c b/src/barebox-state/backend_format_raw.c
index f9102d4..cc225b2 100644
--- a/src/barebox-state/backend_format_raw.c
+++ b/src/barebox-state/backend_format_raw.c
@@ -37,7 +37,7 @@ struct state_backend_format_raw {
struct device_d *dev;
};
-struct backend_raw_header {
+struct __attribute__((__packed__)) backend_raw_header {
uint32_t magic;
uint16_t reserved;
uint16_t data_len;