* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed @ 2012-02-09 17:15 Bernhard Walle 2012-02-17 14:15 ` Detlev Zundel 0 siblings, 1 reply; 11+ messages in thread From: Bernhard Walle @ 2012-02-09 17:15 UTC (permalink / raw) To: u-boot In addition to the error message also display the error code. I had the problem that my malloc memory was not enough (ENOMEM), and if u-boot had displayed the error code immediately that would have saved me some debugging. Signed-off-by: Bernhard Walle <walle@corscience.de> --- fs/ubifs/super.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 26b48f0..0b1440b 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) mnt = NULL; ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); if (ret) { - printf("Error reading superblock on volume '%s'!\n", name); + printf("Error reading superblock on volume '%s': %d!\n", name, -ret); return -1; } -- 1.7.9 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-09 17:15 [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed Bernhard Walle @ 2012-02-17 14:15 ` Detlev Zundel 2012-02-17 14:31 ` Bernhard Walle 0 siblings, 1 reply; 11+ messages in thread From: Detlev Zundel @ 2012-02-17 14:15 UTC (permalink / raw) To: u-boot Hi Bernhard, > In addition to the error message also display the error code. I had the > problem that my malloc memory was not enough (ENOMEM), and if u-boot > had displayed the error code immediately that would have saved me some > debugging. > > Signed-off-by: Bernhard Walle <walle@corscience.de> > --- > fs/ubifs/super.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c > index 26b48f0..0b1440b 100644 > --- a/fs/ubifs/super.c > +++ b/fs/ubifs/super.c > @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) > mnt = NULL; > ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); > if (ret) { > - printf("Error reading superblock on volume '%s'!\n", name); > + printf("Error reading superblock on volume '%s': %d!\n", name, -ret); > return -1; > } I think this makes sense, but I think it would be more natural to print the real error code, not the negative value. I don't know how to search for all such occurrences, but I cannot find any but a lot of sites printing the error code as is. Cheers Detlev -- The fact is, volatile on data structures is a bug. It's a wart in the C language. It shouldn't be used. -- Linus Torvalds -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-17 14:15 ` Detlev Zundel @ 2012-02-17 14:31 ` Bernhard Walle 2012-02-17 15:00 ` Detlev Zundel 2012-02-20 8:44 ` Bernhard Walle 0 siblings, 2 replies; 11+ messages in thread From: Bernhard Walle @ 2012-02-17 14:31 UTC (permalink / raw) To: u-boot Hi Detlev, * Detlev Zundel <dzu@denx.de> [2012-02-17 15:15]: > > > @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) > > mnt = NULL; > > ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); > > if (ret) { > > - printf("Error reading superblock on volume '%s'!\n", name); > > + printf("Error reading superblock on volume '%s': %d!\n", name, -ret); > > return -1; > > } > > I think this makes sense, but I think it would be more natural to print > the real error code, not the negative value. I don't know how to search > for all such occurrences, but I cannot find any but a lot of sites > printing the error code as is. well, the return value is negative, so my intention was to print the error code as positive number. So you think we should display it as negative number (-12 instead of 12 for ENOMEM)? Regards, Bernhard ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-17 14:31 ` Bernhard Walle @ 2012-02-17 15:00 ` Detlev Zundel 2012-02-20 8:44 ` Bernhard Walle 1 sibling, 0 replies; 11+ messages in thread From: Detlev Zundel @ 2012-02-17 15:00 UTC (permalink / raw) To: u-boot Hi Bernhard, > Hi Detlev, > > * Detlev Zundel <dzu@denx.de> [2012-02-17 15:15]: >> >> > @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) >> > mnt = NULL; >> > ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); >> > if (ret) { >> > - printf("Error reading superblock on volume '%s'!\n", name); >> > + printf("Error reading superblock on volume '%s': %d!\n", name, -ret); >> > return -1; >> > } >> >> I think this makes sense, but I think it would be more natural to print >> the real error code, not the negative value. I don't know how to search >> for all such occurrences, but I cannot find any but a lot of sites >> printing the error code as is. > > well, the return value is negative, so my intention was to print the > error code as positive number. So you think we should display it as > negative number (-12 instead of 12 for ENOMEM)? Personally I believe that any transformation in the printing can mislead people in the search for the cause or the responsible code. So if the error value is -12, then we should print it. After all, the assignment to generate that value will very likely be "return -ENOMEM" and people will thus know what to look for. On the other hand I am open to the consistency argument, so if every error printing would do such a transformation then it would be better to also do it. But as I said, I don't know an easy grep pattern to search for such locations and quick searches showed that I all places I found print the error codes unmangeld. Cheers Detlev -- Basically, Barnes & Noble separates things by how old they are -- current stuff is "Fiction", stuff from 20 years ago is "Literature", stuff from 100 years ago is "Classics", stuff from 400 years ago is "Shakespeare" [..] and stuff from 2000 years ago is "History". -- James "Kibo" Parry in <kibo-1207032212000001@10.0.1.2> -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-17 14:31 ` Bernhard Walle 2012-02-17 15:00 ` Detlev Zundel @ 2012-02-20 8:44 ` Bernhard Walle 2012-02-20 8:59 ` Albert ARIBAUD 1 sibling, 1 reply; 11+ messages in thread From: Bernhard Walle @ 2012-02-20 8:44 UTC (permalink / raw) To: u-boot In addition to the error message also display the error code. I had the problem that my malloc memory was not enough (ENOMEM), and if u-boot had displayed the error code immediately that would have saved me some debugging. Signed-off-by: Bernhard Walle <walle@corscience.de> --- v2: Print the non-negated error value. fs/ubifs/super.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 26b48f0..e6c02f5 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) mnt = NULL; ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); if (ret) { - printf("Error reading superblock on volume '%s'!\n", name); + printf("Error reading superblock on volume '%s': %d!\n", name, ret); return -1; } -- 1.7.9.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-20 8:44 ` Bernhard Walle @ 2012-02-20 8:59 ` Albert ARIBAUD 2012-02-20 9:11 ` Bernhard Walle 0 siblings, 1 reply; 11+ messages in thread From: Albert ARIBAUD @ 2012-02-20 8:59 UTC (permalink / raw) To: u-boot Hi Bernard, Le 20/02/2012 09:44, Bernhard Walle a ?crit : > In addition to the error message also display the error code. I had the > problem that my malloc memory was not enough (ENOMEM), and if u-boot > had displayed the error code immediately that would have saved me some > debugging. > > Signed-off-by: Bernhard Walle<walle@corscience.de> > --- > v2: Print the non-negated error value. > > fs/ubifs/super.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c > index 26b48f0..e6c02f5 100644 > --- a/fs/ubifs/super.c > +++ b/fs/ubifs/super.c > @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) > mnt = NULL; > ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); > if (ret) { > - printf("Error reading superblock on volume '%s'!\n", name); > + printf("Error reading superblock on volume '%s': %d!\n", name, ret); > return -1; > } > Dry numbers as error messages are better than no error messages but only marginally IMO. Isn't there a way to emit a readable message re malloc instead of emitting an int value? Amicalement, -- Albert. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-20 8:59 ` Albert ARIBAUD @ 2012-02-20 9:11 ` Bernhard Walle 2012-02-20 10:01 ` Albert ARIBAUD 0 siblings, 1 reply; 11+ messages in thread From: Bernhard Walle @ 2012-02-20 9:11 UTC (permalink / raw) To: u-boot Am 20.02.2012 09:59, schrieb Albert ARIBAUD: > > Dry numbers as error messages are better than no error messages but only > marginally IMO. Isn't there a way to emit a readable message re malloc > instead of emitting an int value? Well, I'm not familiar with the u-boot codebase. Does u-boot have a strerror table? How is it handled on other places? Should an error message printed directly before returning -ENOMEM? Regards, Bernhard ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-20 9:11 ` Bernhard Walle @ 2012-02-20 10:01 ` Albert ARIBAUD 2012-04-02 11:58 ` Thomas Weber 0 siblings, 1 reply; 11+ messages in thread From: Albert ARIBAUD @ 2012-02-20 10:01 UTC (permalink / raw) To: u-boot Hi Bernhard, Le 20/02/2012 10:11, Bernhard Walle a ?crit : > Am 20.02.2012 09:59, schrieb Albert ARIBAUD: >> >> Dry numbers as error messages are better than no error messages but only >> marginally IMO. Isn't there a way to emit a readable message re malloc >> instead of emitting an int value? > > Well, I'm not familiar with the u-boot codebase. Does u-boot have a > strerror table? How is it handled on other places? Should an error > message printed directly before returning -ENOMEM? I don't think there is an strerror() API. But at least, if the newly printed int uses errno values, then instead of '... %d!", you could print "... errno=%d", which would give some hint to the reader. > Regards, > Bernhard Amicalement, -- Albert. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-02-20 10:01 ` Albert ARIBAUD @ 2012-04-02 11:58 ` Thomas Weber 2012-05-15 20:33 ` Thomas Weber 2012-08-09 20:12 ` Wolfgang Denk 0 siblings, 2 replies; 11+ messages in thread From: Thomas Weber @ 2012-04-02 11:58 UTC (permalink / raw) To: u-boot From: Bernhard Walle <walle@corscience.de> In addition to the error message also display the error code. I had the problem that my malloc memory was not enough (ENOMEM), and if u-boot had displayed the error code immediately that would have saved me some debugging. Signed-off-by: Bernhard Walle <walle@corscience.de> Use ubifs_err instead of printf. Add "errno=%d" in output as suggested by Albert Aribaud. Signed-off-by: Thomas Weber <weber@corscience.de> --- fs/ubifs/super.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 26b48f0..30ccd98 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) mnt = NULL; ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); if (ret) { - printf("Error reading superblock on volume '%s'!\n", name); + ubifs_err("Error reading superblock on volume '%s' errno=%d!\n", name, ret); return -1; } -- 1.7.8.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-04-02 11:58 ` Thomas Weber @ 2012-05-15 20:33 ` Thomas Weber 2012-08-09 20:12 ` Wolfgang Denk 1 sibling, 0 replies; 11+ messages in thread From: Thomas Weber @ 2012-05-15 20:33 UTC (permalink / raw) To: u-boot Ccing Albert Thomas On 04/02/2012 01:58 PM, Thomas Weber wrote: > From: Bernhard Walle <walle@corscience.de> > > In addition to the error message also display the error code. I had the > problem that my malloc memory was not enough (ENOMEM), and if u-boot > had displayed the error code immediately that would have saved me some > debugging. > > Signed-off-by: Bernhard Walle <walle@corscience.de> > > Use ubifs_err instead of printf. > Add "errno=%d" in output as suggested by Albert Aribaud. > Signed-off-by: Thomas Weber <weber@corscience.de> > --- > fs/ubifs/super.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c > index 26b48f0..30ccd98 100644 > --- a/fs/ubifs/super.c > +++ b/fs/ubifs/super.c > @@ -1191,7 +1191,7 @@ int ubifs_mount(char *vol_name) > mnt = NULL; > ret = ubifs_get_sb(&ubifs_fs_type, flags, name, data, mnt); > if (ret) { > - printf("Error reading superblock on volume '%s'!\n", name); > + ubifs_err("Error reading superblock on volume '%s' errno=%d!\n", name, ret); > return -1; > } > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed 2012-04-02 11:58 ` Thomas Weber 2012-05-15 20:33 ` Thomas Weber @ 2012-08-09 20:12 ` Wolfgang Denk 1 sibling, 0 replies; 11+ messages in thread From: Wolfgang Denk @ 2012-08-09 20:12 UTC (permalink / raw) To: u-boot Dear Thomas Weber, In message <1333367914-20461-1-git-send-email-weber@corscience.de> you wrote: > From: Bernhard Walle <walle@corscience.de> > > In addition to the error message also display the error code. I had the > problem that my malloc memory was not enough (ENOMEM), and if u-boot > had displayed the error code immediately that would have saved me some > debugging. > > Signed-off-by: Bernhard Walle <walle@corscience.de> > > Use ubifs_err instead of printf. > Add "errno=%d" in output as suggested by Albert Aribaud. > Signed-off-by: Thomas Weber <weber@corscience.de> > --- > fs/ubifs/super.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Applied, thanks. Stefan, I hope this is OK with you. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de > Is there a way to determine Yesterday's date using Unix utilities? echo "what is yesterday's date?" | /bin/mail root -- Randal L. Schwartz in <ukbuh2y982.fsf@julie.teleport.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-08-09 20:12 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-09 17:15 [U-Boot] [PATCH] UBIFS: Improve error message when reading superblock failed Bernhard Walle 2012-02-17 14:15 ` Detlev Zundel 2012-02-17 14:31 ` Bernhard Walle 2012-02-17 15:00 ` Detlev Zundel 2012-02-20 8:44 ` Bernhard Walle 2012-02-20 8:59 ` Albert ARIBAUD 2012-02-20 9:11 ` Bernhard Walle 2012-02-20 10:01 ` Albert ARIBAUD 2012-04-02 11:58 ` Thomas Weber 2012-05-15 20:33 ` Thomas Weber 2012-08-09 20:12 ` Wolfgang Denk
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox