* [PATCH] state: make first boot with uninitialized legacy state less verbose
@ 2021-11-29 7:22 Ahmad Fatoum
2021-11-30 10:23 ` Sascha Hauer
0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2021-11-29 7:22 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With non-legacy state, barebox checks a header for a specific magic
signature. This can be all zero on an uninitialized state, so in that
particular case, bump down the log message severity.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
Applies on top of https://lore.barebox.org/barebox/20211125161042.3829996-3-a.fatoum@pengutronix.de/
---
common/state/backend_bucket_direct.c | 4 ++--
common/state/backend_storage.c | 7 +++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 517aec60634b..117cdfb46c9e 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -76,9 +76,9 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket
if (meta.magic != ~0 && !!meta.magic)
bucket->wrong_magic = 1;
if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) {
- dev_err(direct->dev, "No meta data header found\n");
dev_dbg(direct->dev, "Enable backward compatibility or increase stride size\n");
- return -EINVAL;
+ return dev_err_state_init(direct->dev, meta.magic ? -EINVAL : -ENOMEDIUM,
+ "No meta data header found\n");
}
read_len = direct->max_size;
if (lseek(direct->fd, direct->offset, SEEK_SET) !=
diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index 72f8bcf521ad..c55d22e37f70 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -156,10 +156,13 @@ int state_storage_read(struct state_backend_storage *storage,
totalbuckets++;
ret = bucket->read(bucket, &bucket->buf, &bucket->len);
- if (ret == -EUCLEAN)
+ if (ret == -EUCLEAN) {
bucket->needs_refresh = 1;
- else if (ret)
+ } else if (ret) {
+ if (ret == -ENOMEDIUM)
+ zerobuckets++;
continue;
+ }
/*
* Verify the buffer crcs. The buffer length is passed in the len argument,
--
2.33.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] state: make first boot with uninitialized legacy state less verbose
2021-11-29 7:22 [PATCH] state: make first boot with uninitialized legacy state less verbose Ahmad Fatoum
@ 2021-11-30 10:23 ` Sascha Hauer
2021-11-30 10:39 ` Ahmad Fatoum
0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2021-11-30 10:23 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Mon, Nov 29, 2021 at 08:22:35AM +0100, Ahmad Fatoum wrote:
> With non-legacy state, barebox checks a header for a specific magic
> signature. This can be all zero on an uninitialized state, so in that
> particular case, bump down the log message severity.
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> Applies on top of https://lore.barebox.org/barebox/20211125161042.3829996-3-a.fatoum@pengutronix.de/
> ---
> common/state/backend_bucket_direct.c | 4 ++--
> common/state/backend_storage.c | 7 +++++--
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
> index 517aec60634b..117cdfb46c9e 100644
> --- a/common/state/backend_bucket_direct.c
> +++ b/common/state/backend_bucket_direct.c
> @@ -76,9 +76,9 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket
> if (meta.magic != ~0 && !!meta.magic)
> bucket->wrong_magic = 1;
> if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) {
> - dev_err(direct->dev, "No meta data header found\n");
> dev_dbg(direct->dev, "Enable backward compatibility or increase stride size\n");
> - return -EINVAL;
> + return dev_err_state_init(direct->dev, meta.magic ? -EINVAL : -ENOMEDIUM,
> + "No meta data header found\n");
What is dev_err_state_init()? I don't have that in my tree.
> }
> read_len = direct->max_size;
> if (lseek(direct->fd, direct->offset, SEEK_SET) !=
> diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
> index 72f8bcf521ad..c55d22e37f70 100644
> --- a/common/state/backend_storage.c
> +++ b/common/state/backend_storage.c
> @@ -156,10 +156,13 @@ int state_storage_read(struct state_backend_storage *storage,
> totalbuckets++;
>
> ret = bucket->read(bucket, &bucket->buf, &bucket->len);
> - if (ret == -EUCLEAN)
> + if (ret == -EUCLEAN) {
> bucket->needs_refresh = 1;
> - else if (ret)
> + } else if (ret) {
> + if (ret == -ENOMEDIUM)
> + zerobuckets++;
This variable also does not exist. Does this patch depend on other
patches?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
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] 4+ messages in thread
* Re: [PATCH] state: make first boot with uninitialized legacy state less verbose
2021-11-30 10:23 ` Sascha Hauer
@ 2021-11-30 10:39 ` Ahmad Fatoum
2022-01-03 10:27 ` Ahmad Fatoum
0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2021-11-30 10:39 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum; +Cc: barebox
Hello Sascha,
On 30.11.21 11:23, Sascha Hauer wrote:
> On Mon, Nov 29, 2021 at 08:22:35AM +0100, Ahmad Fatoum wrote:
>> With non-legacy state, barebox checks a header for a specific magic
>> signature. This can be all zero on an uninitialized state, so in that
>> particular case, bump down the log message severity.
>>
>> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
>> ---
>> Applies on top of https://lore.barebox.org/barebox/20211125161042.3829996-3-a.fatoum@pengutronix.de/
Yes, please see ^ first.
>> ---
>> common/state/backend_bucket_direct.c | 4 ++--
>> common/state/backend_storage.c | 7 +++++--
>> 2 files changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
>> index 517aec60634b..117cdfb46c9e 100644
>> --- a/common/state/backend_bucket_direct.c
>> +++ b/common/state/backend_bucket_direct.c
>> @@ -76,9 +76,9 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket
>> if (meta.magic != ~0 && !!meta.magic)
>> bucket->wrong_magic = 1;
>> if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) {
>> - dev_err(direct->dev, "No meta data header found\n");
>> dev_dbg(direct->dev, "Enable backward compatibility or increase stride size\n");
>> - return -EINVAL;
>> + return dev_err_state_init(direct->dev, meta.magic ? -EINVAL : -ENOMEDIUM,
>> + "No meta data header found\n");
>
> What is dev_err_state_init()? I don't have that in my tree.
>
>> }
>> read_len = direct->max_size;
>> if (lseek(direct->fd, direct->offset, SEEK_SET) !=
>> diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
>> index 72f8bcf521ad..c55d22e37f70 100644
>> --- a/common/state/backend_storage.c
>> +++ b/common/state/backend_storage.c
>> @@ -156,10 +156,13 @@ int state_storage_read(struct state_backend_storage *storage,
>> totalbuckets++;
>>
>> ret = bucket->read(bucket, &bucket->buf, &bucket->len);
>> - if (ret == -EUCLEAN)
>> + if (ret == -EUCLEAN) {
>> bucket->needs_refresh = 1;
>> - else if (ret)
>> + } else if (ret) {
>> + if (ret == -ENOMEDIUM)
>> + zerobuckets++;
>
> This variable also does not exist. Does this patch depend on other
> patches?
It does. I
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
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] 4+ messages in thread
* Re: [PATCH] state: make first boot with uninitialized legacy state less verbose
2021-11-30 10:39 ` Ahmad Fatoum
@ 2022-01-03 10:27 ` Ahmad Fatoum
0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2022-01-03 10:27 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum; +Cc: barebox
Hello Sascha,
On 30.11.21 11:39, Ahmad Fatoum wrote:
> Hello Sascha,
>
> On 30.11.21 11:23, Sascha Hauer wrote:
>> On Mon, Nov 29, 2021 at 08:22:35AM +0100, Ahmad Fatoum wrote:
>>> With non-legacy state, barebox checks a header for a specific magic
>>> signature. This can be all zero on an uninitialized state, so in that
>>> particular case, bump down the log message severity.
>>>
>>> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
>>> ---
>>> Applies on top of https://lore.barebox.org/barebox/20211125161042.3829996-3-a.fatoum@pengutronix.de/
>
> Yes, please see ^ first.
Is this ok for next?
Cheers,
Ahmad
>
>>> ---
>>> common/state/backend_bucket_direct.c | 4 ++--
>>> common/state/backend_storage.c | 7 +++++--
>>> 2 files changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
>>> index 517aec60634b..117cdfb46c9e 100644
>>> --- a/common/state/backend_bucket_direct.c
>>> +++ b/common/state/backend_bucket_direct.c
>>> @@ -76,9 +76,9 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket
>>> if (meta.magic != ~0 && !!meta.magic)
>>> bucket->wrong_magic = 1;
>>> if (!IS_ENABLED(CONFIG_STATE_BACKWARD_COMPATIBLE)) {
>>> - dev_err(direct->dev, "No meta data header found\n");
>>> dev_dbg(direct->dev, "Enable backward compatibility or increase stride size\n");
>>> - return -EINVAL;
>>> + return dev_err_state_init(direct->dev, meta.magic ? -EINVAL : -ENOMEDIUM,
>>> + "No meta data header found\n");
>>
>> What is dev_err_state_init()? I don't have that in my tree.
>>
>>> }
>>> read_len = direct->max_size;
>>> if (lseek(direct->fd, direct->offset, SEEK_SET) !=
>>> diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
>>> index 72f8bcf521ad..c55d22e37f70 100644
>>> --- a/common/state/backend_storage.c
>>> +++ b/common/state/backend_storage.c
>>> @@ -156,10 +156,13 @@ int state_storage_read(struct state_backend_storage *storage,
>>> totalbuckets++;
>>>
>>> ret = bucket->read(bucket, &bucket->buf, &bucket->len);
>>> - if (ret == -EUCLEAN)
>>> + if (ret == -EUCLEAN) {
>>> bucket->needs_refresh = 1;
>>> - else if (ret)
>>> + } else if (ret) {
>>> + if (ret == -ENOMEDIUM)
>>> + zerobuckets++;
>>
>> This variable also does not exist. Does this patch depend on other
>> patches?
>
> It does. I
>
>>
>> Sascha
>>
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
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] 4+ messages in thread
end of thread, other threads:[~2022-01-03 10:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 7:22 [PATCH] state: make first boot with uninitialized legacy state less verbose Ahmad Fatoum
2021-11-30 10:23 ` Sascha Hauer
2021-11-30 10:39 ` Ahmad Fatoum
2022-01-03 10:27 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox