Skip to contentSkip to conversation

environment: "wrong magic" give the impression of an error

PATCH Superseded Sam Ravnborg 2 participants 4 messages Sep 22, 2016 – Sep 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 environment: "wrong magic" give the impression of an error

From 144e3252f9604e44c48f90735489611f636e3e36 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
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.

---
 common/environment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/environment.c +2 -2
index db127d7..e0dfc12 100644
@@ -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;
 		}
Signature · 7 lines
1.8.3.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hi Sam,

Quoted 23 lines · Sam Ravnborg

From 144e3252f9604e44c48f90735489611f636e3e36 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
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.

---
 common/environment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/environment.c +0 -0
index db127d7..e0dfc12 100644

common/environment.c EXPORT_SYMBOL(envfs_save); · line 385

Quoted 5 lines
common/environment.c +1 -1
@@ -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,...

common/environment.c static int envfs_load_data(struct envfs_super *super, void *buf, size_t size, · line 439

Quoted 9 lines
common/environment.c +1 -1
 		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

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 1/1 environment: "wrong magic" gives the impression of an error

From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
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.

---

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(-)
common/environment.c +1 -1
index db127d7..c9cef63 100644
@@ -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;
 	}
 
Signature · 7 lines
1.8.3.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#3 lore raw

Re: [PATCH v2] environment: "wrong magic" gives the impression of an error

Quoted 10 lines · Sam Ravnborg

From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
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?)"

Quoted 5 lines

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

---

Applied, thanks

Sascha

Quoted 29 lines

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(-)
common/environment.c +1 -1
index db127d7..c9cef63 100644
@@ -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;
 	}
 
Signature · 1 line
1.8.3.1
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox