* [PATCH upstream 1/4] state: use packet attribute for on storage structs
@ 2016-11-02 7:54 Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 2/4] state: fix indentation Stefan Lengfeld
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Stefan Lengfeld @ 2016-11-02 7:54 UTC (permalink / raw)
To: barebox
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 packet attribute
the later.
Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
---
common/state/backend_bucket_circular.c | 2 +-
common/state/backend_bucket_direct.c | 2 +-
common/state/backend_format_raw.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 72e165e..d8504e0 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/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/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 08892f0..5225433 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/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/common/state/backend_format_raw.c b/common/state/backend_format_raw.c
index 4209424..e028ea6 100644
--- a/common/state/backend_format_raw.c
+++ b/common/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;
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH upstream 2/4] state: fix indentation
2016-11-02 7:54 [PATCH upstream 1/4] state: use packet attribute for on storage structs Stefan Lengfeld
@ 2016-11-02 7:54 ` Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 3/4] state: fix state is not saved when string variable is changed Stefan Lengfeld
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Lengfeld @ 2016-11-02 7:54 UTC (permalink / raw)
To: barebox
Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
---
common/state/state_variables.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/state/state_variables.c b/common/state/state_variables.c
index efc2456..1e37856 100644
--- a/common/state/state_variables.c
+++ b/common/state/state_variables.c
@@ -441,9 +441,9 @@ static struct variable_type types[] = {
{
.type = STATE_TYPE_U8,
.type_name = "uint8",
- .export = state_uint32_export,
- .import = state_uint32_import,
- .create = state_uint8_create,
+ .export = state_uint32_export,
+ .import = state_uint32_import,
+ .create = state_uint8_create,
}, {
.type = STATE_TYPE_U32,
.type_name = "uint32",
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH upstream 3/4] state: fix state is not saved when string variable is changed
2016-11-02 7:54 [PATCH upstream 1/4] state: use packet attribute for on storage structs Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 2/4] state: fix indentation Stefan Lengfeld
@ 2016-11-02 7:54 ` Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 4/4] docs: state: make string variable type clearer Stefan Lengfeld
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Lengfeld @ 2016-11-02 7:54 UTC (permalink / raw)
To: barebox
The dirty flag was not set properly.
Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
---
common/state/state_variables.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/state/state_variables.c b/common/state/state_variables.c
index 1e37856..fd072a0 100644
--- a/common/state/state_variables.c
+++ b/common/state/state_variables.c
@@ -383,7 +383,7 @@ static int state_string_set(struct param_d *p, void *priv)
if (ret)
return ret;
- return state_set_dirty(p, sv->state);
+ return state_set_dirty(p, sv);
}
static int state_string_get(struct param_d *p, void *priv)
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH upstream 4/4] docs: state: make string variable type clearer
2016-11-02 7:54 [PATCH upstream 1/4] state: use packet attribute for on storage structs Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 2/4] state: fix indentation Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 3/4] state: fix state is not saved when string variable is changed Stefan Lengfeld
@ 2016-11-02 7:54 ` Stefan Lengfeld
2016-11-02 14:17 ` [PATCH upstream 1/4] state: use packet attribute for on storage structs Andrey Smirnov
2016-11-03 6:21 ` Sascha Hauer
4 siblings, 0 replies; 7+ messages in thread
From: Stefan Lengfeld @ 2016-11-02 7:54 UTC (permalink / raw)
To: barebox
Only fixed length strings are supported. Make the wording clearer.
Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
---
Documentation/devicetree/bindings/barebox/barebox,state.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst
index e39245f..438cc43 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,state.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst
@@ -51,8 +51,8 @@ variable. The node name may end with ``@<ADDRESS>``, but the suffix is
stripped from the variable name.
State variables have a type. Currenty supported types are: ``uint8``,
-``uint32``, ``enum32``, ``mac`` address or ``string``. Variable length
-strings are not planned.
+``uint32``, ``enum32``, ``mac`` address or ``string`` (fixed length string).
+Variable length strings are not planned.
Required properties:
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH upstream 1/4] state: use packet attribute for on storage structs
2016-11-02 7:54 [PATCH upstream 1/4] state: use packet attribute for on storage structs Stefan Lengfeld
` (2 preceding siblings ...)
2016-11-02 7:54 ` [PATCH upstream 4/4] docs: state: make string variable type clearer Stefan Lengfeld
@ 2016-11-02 14:17 ` Andrey Smirnov
2016-11-03 6:21 ` Sascha Hauer
4 siblings, 0 replies; 7+ messages in thread
From: Andrey Smirnov @ 2016-11-02 14:17 UTC (permalink / raw)
To: Stefan Lengfeld; +Cc: barebox
On Wed, Nov 2, 2016 at 12:54 AM, Stefan Lengfeld <s.lengfeld@phytec.de> wrote:
> 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 packet attribute
"packed" instead of "packet"?
> the later.
>
> Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> ---
> common/state/backend_bucket_circular.c | 2 +-
> common/state/backend_bucket_direct.c | 2 +-
> common/state/backend_format_raw.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
> index 72e165e..d8504e0 100644
> --- a/common/state/backend_bucket_circular.c
> +++ b/common/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 {
#include <linux/compiler.h> defines "__packed" macro which might make
things less verbose. Ditto for the rest of the changes in this patch.
> uint32_t magic;
> uint32_t written_length;
> };
> diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
> index 08892f0..5225433 100644
> --- a/common/state/backend_bucket_direct.c
> +++ b/common/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/common/state/backend_format_raw.c b/common/state/backend_format_raw.c
> index 4209424..e028ea6 100644
> --- a/common/state/backend_format_raw.c
> +++ b/common/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;
> --
> 1.9.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH upstream 1/4] state: use packet attribute for on storage structs
2016-11-02 7:54 [PATCH upstream 1/4] state: use packet attribute for on storage structs Stefan Lengfeld
` (3 preceding siblings ...)
2016-11-02 14:17 ` [PATCH upstream 1/4] state: use packet attribute for on storage structs Andrey Smirnov
@ 2016-11-03 6:21 ` Sascha Hauer
2016-11-03 8:38 ` Stefan Lengfeld
4 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2016-11-03 6:21 UTC (permalink / raw)
To: Stefan Lengfeld; +Cc: barebox
On Wed, Nov 02, 2016 at 08:54:27AM +0100, Stefan Lengfeld wrote:
> 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 packet attribute
> the later.
>
> Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
Applied all, thanks. 3/4 went to master, the rest to next. Also fixed
s/packet/packed/ while applying.
Sascha
> ---
> common/state/backend_bucket_circular.c | 2 +-
> common/state/backend_bucket_direct.c | 2 +-
> common/state/backend_format_raw.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
> index 72e165e..d8504e0 100644
> --- a/common/state/backend_bucket_circular.c
> +++ b/common/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/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
> index 08892f0..5225433 100644
> --- a/common/state/backend_bucket_direct.c
> +++ b/common/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/common/state/backend_format_raw.c b/common/state/backend_format_raw.c
> index 4209424..e028ea6 100644
> --- a/common/state/backend_format_raw.c
> +++ b/common/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;
> --
> 1.9.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH upstream 1/4] state: use packet attribute for on storage structs
2016-11-03 6:21 ` Sascha Hauer
@ 2016-11-03 8:38 ` Stefan Lengfeld
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Lengfeld @ 2016-11-03 8:38 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
On Thu, Nov 03, 2016 at 07:21:34AM +0100, Sascha Hauer wrote:
> On Wed, Nov 02, 2016 at 08:54:27AM +0100, Stefan Lengfeld wrote:
> > 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 packet attribute
> > the later.
> >
> > Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
>
> Applied all, thanks. 3/4 went to master, the rest to next. Also fixed
> s/packet/packed/ while applying.
>
> Sascha
thanks for fixing my typo :-)
Mit freundlichen Grüßen / Kind regards,
Stefan Lengfeld
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-11-03 8:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-02 7:54 [PATCH upstream 1/4] state: use packet attribute for on storage structs Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 2/4] state: fix indentation Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 3/4] state: fix state is not saved when string variable is changed Stefan Lengfeld
2016-11-02 7:54 ` [PATCH upstream 4/4] docs: state: make string variable type clearer Stefan Lengfeld
2016-11-02 14:17 ` [PATCH upstream 1/4] state: use packet attribute for on storage structs Andrey Smirnov
2016-11-03 6:21 ` Sascha Hauer
2016-11-03 8:38 ` Stefan Lengfeld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox