mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] environment: "wrong magic" give the impression of an error
@ 2016-09-22  5:00 Sam Ravnborg
  2016-09-22  8:08 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2016-09-22  5:00 UTC (permalink / raw)
  To: Barebox List

From 144e3252f9604e44c48f90735489611f636e3e36 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <srn@skov.dk>
Date: Thu, 22 Sep 2016 06:54:42 +0200
Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
 error

Introduce a more soft wording when the magic of
the superblock does not match.
Include a hint to the typical reason "(envfs never written?)"

This prevents a "what is wrong?" moment when looking at
the boot log.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 common/environment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/environment.c b/common/environment.c
index db127d7..e0dfc12 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
 static int envfs_check_super(struct envfs_super *super, size_t *size)
 {
 	if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
-		printf("envfs: wrong magic\n");
+		printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
 		return -EIO;
 	}
 
@@ -436,7 +436,7 @@ static int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
 		buf += sizeof(struct envfs_inode);
 
 		if (ENVFS_32(inode->magic) != ENVFS_INODE_MAGIC) {
-			printf("envfs: wrong magic\n");
+			printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
 			ret = -EIO;
 			goto out;
 		}
-- 
1.8.3.1


_______________________________________________
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] environment: "wrong magic" give the impression of an error
  2016-09-22  5:00 [PATCH] environment: "wrong magic" give the impression of an error Sam Ravnborg
@ 2016-09-22  8:08 ` Sascha Hauer
  2016-09-22 19:16   ` [PATCH v2] environment: "wrong magic" gives " Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2016-09-22  8:08 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Barebox List

Hi Sam,

On Thu, Sep 22, 2016 at 07:00:41AM +0200, Sam Ravnborg wrote:
> From 144e3252f9604e44c48f90735489611f636e3e36 Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg <srn@skov.dk>
> Date: Thu, 22 Sep 2016 06:54:42 +0200
> Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
>  error
> 
> Introduce a more soft wording when the magic of
> the superblock does not match.
> Include a hint to the typical reason "(envfs never written?)"
> 
> This prevents a "what is wrong?" moment when looking at
> the boot log.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  common/environment.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/environment.c b/common/environment.c
> index db127d7..e0dfc12 100644
> --- a/common/environment.c
> +++ b/common/environment.c
> @@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
>  static int envfs_check_super(struct envfs_super *super, size_t *size)
>  {
>  	if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
> -		printf("envfs: wrong magic\n");
> +		printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");

When the super block cannot be found it could indeed be that an envfs
was never written,...

>  		return -EIO;
>  	}
>  
> @@ -436,7 +436,7 @@ static int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
>  		buf += sizeof(struct envfs_inode);
>  
>  		if (ENVFS_32(inode->magic) != ENVFS_INODE_MAGIC) {
> -			printf("envfs: wrong magic\n");
> +			printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");

... but when the super block is fine then a failure to read the data is
really that - a failure, no?

Sascha

-- 
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] 4+ messages in thread

* [PATCH v2] environment: "wrong magic" gives the impression of an error
  2016-09-22  8:08 ` Sascha Hauer
@ 2016-09-22 19:16   ` Sam Ravnborg
  2016-09-26  6:05     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Ravnborg @ 2016-09-22 19:16 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List

From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <srn@skov.dk>
Date: Thu, 22 Sep 2016 06:54:42 +0200
Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
 error

Introduce a more soft wording when the magic of
the superblock does not match.
Include a hint to the typical reason "(envfs never written?)"

This prevents a "what is wrong?" moment when looking at
the boot log.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---

v2:
Dropped change in envfs_load_data(). envfs_load_data() is used
to traverse the inodes and if we reach this far we
have encountered a real error which should be reported.
Thanks to Sascha for spottign this mistake!

	Sam

 common/environment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/environment.c b/common/environment.c
index db127d7..c9cef63 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
 static int envfs_check_super(struct envfs_super *super, size_t *size)
 {
 	if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
-		printf("envfs: wrong magic\n");
+		printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
 		return -EIO;
 	}
 
-- 
1.8.3.1


_______________________________________________
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 v2] environment: "wrong magic" gives the impression of an error
  2016-09-22 19:16   ` [PATCH v2] environment: "wrong magic" gives " Sam Ravnborg
@ 2016-09-26  6:05     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2016-09-26  6:05 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Barebox List

On Thu, Sep 22, 2016 at 09:16:34PM +0200, Sam Ravnborg wrote:
> From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg <srn@skov.dk>
> Date: Thu, 22 Sep 2016 06:54:42 +0200
> Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
>  error
> 
> Introduce a more soft wording when the magic of
> the superblock does not match.
> Include a hint to the typical reason "(envfs never written?)"
> 
> This prevents a "what is wrong?" moment when looking at
> the boot log.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> ---

Applied, thanks

Sascha

> 
> v2:
> Dropped change in envfs_load_data(). envfs_load_data() is used
> to traverse the inodes and if we reach this far we
> have encountered a real error which should be reported.
> Thanks to Sascha for spottign this mistake!
> 
> 	Sam
> 
>  common/environment.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/environment.c b/common/environment.c
> index db127d7..c9cef63 100644
> --- a/common/environment.c
> +++ b/common/environment.c
> @@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
>  static int envfs_check_super(struct envfs_super *super, size_t *size)
>  {
>  	if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
> -		printf("envfs: wrong magic\n");
> +		printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
>  		return -EIO;
>  	}
>  
> -- 
> 1.8.3.1
> 
> 

-- 
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] 4+ messages in thread

end of thread, other threads:[~2016-09-26  6:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-22  5:00 [PATCH] environment: "wrong magic" give the impression of an error Sam Ravnborg
2016-09-22  8:08 ` Sascha Hauer
2016-09-22 19:16   ` [PATCH v2] environment: "wrong magic" gives " Sam Ravnborg
2016-09-26  6:05     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox