* [PATCH] xfsdump: remove redundant error code mapping
@ 2011-09-02 14:22 Bill Kendall
2011-09-19 21:02 ` Alex Elder
0 siblings, 1 reply; 3+ messages in thread
From: Bill Kendall @ 2011-09-02 14:22 UTC (permalink / raw)
To: xfs
Currently there is both an exit_strings array and an exit_codestring()
function for mapping an exit code to a string. They are very similar
except the latter prefaces every string with "EXIT_" and the former
uses "SUCCESS" instead of "NORMAL", and cannot handle an invalid exit
code. exit_codestring() is not currently used in active code (it's for
multi-stream), so its values can be changed to allow the exit_strings
array to be removed.
---
common/exit.h | 10 +++++-----
common/mlog.c | 14 ++------------
2 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/common/exit.h b/common/exit.h
index ef01684..f7e4878 100644
--- a/common/exit.h
+++ b/common/exit.h
@@ -29,12 +29,12 @@ static inline const char *
exit_codestring( intgen_t code )
{
switch ( code ) {
- case EXIT_NORMAL: return "EXIT_NORMAL";
- case EXIT_ERROR: return "EXIT_ERROR";
- case EXIT_INTERRUPT: return "EXIT_INTERRUPT";
- case EXIT_FAULT: return "EXIT_FAULT";
+ case EXIT_NORMAL: return "SUCCESS";
+ case EXIT_ERROR: return "ERROR";
+ case EXIT_INTERRUPT: return "INTERRUPT";
+ case EXIT_FAULT: return "FAULT";
}
- return "???";
+ return "UNKNOWN";
}
#endif /* EXIT_H */
diff --git a/common/mlog.c b/common/mlog.c
index 55cb5cd..2265895 100644
--- a/common/mlog.c
+++ b/common/mlog.c
@@ -457,11 +457,6 @@ mlog_va( intgen_t levelarg, char *fmt, va_list args )
}
}
-
-static const char *exit_strings[] =
- { "SUCCESS", "ERROR", "INTERRUPT", "", "FAULT" };
-
-
/*
* Map RV codes to actual error messages.
*/
@@ -584,7 +579,7 @@ _mlog_exit( const char *file, int line, int exit_code, rv_t rv )
"%s: %d: mlog_exit called: "
"exit_code: %s return: %s (%s)\n",
file, line,
- exit_strings[exit_code],
+ exit_codestring(exit_code),
rvp->rv_string, rvp->rv_desc);
if (rv < 0 || rv >= _RV_NUM) {
@@ -780,12 +775,7 @@ mlog_exit_flush(void)
if (interrupt) status_str = "INTERRUPT";
else if (quit) status_str = "QUIT";
else if (incomplete) status_str = "INCOMPLETE";
-#ifdef NDEBUG
- /* We should never get here, but if we do make sure we don't die
- horribly when not running debug. */
- else if (! VALID_EXIT_CODE(mlog_main_exit_code)) status_str = "UNKNOWN";
-#endif /* NDEBUG */
- else status_str = exit_strings[mlog_main_exit_code];
+ else status_str = exit_codestring(mlog_main_exit_code);
/* now print the overall state of the dump/restore */
fprintf(mlog_fp, "%s: %s Status: %s\n", progname, PROGSTR_CAPS, status_str);
--
1.7.0.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfsdump: remove redundant error code mapping
2011-09-02 14:22 [PATCH] xfsdump: remove redundant error code mapping Bill Kendall
@ 2011-09-19 21:02 ` Alex Elder
2011-09-19 21:31 ` Bill Kendall
0 siblings, 1 reply; 3+ messages in thread
From: Alex Elder @ 2011-09-19 21:02 UTC (permalink / raw)
To: Bill Kendall; +Cc: xfs
On Fri, 2011-09-02 at 09:22 -0500, Bill Kendall wrote:
> Currently there is both an exit_strings array and an exit_codestring()
> function for mapping an exit code to a string. They are very similar
> except the latter prefaces every string with "EXIT_" and the former
> uses "SUCCESS" instead of "NORMAL", and cannot handle an invalid exit
> code. exit_codestring() is not currently used in active code (it's for
> multi-stream), so its values can be changed to allow the exit_strings
> array to be removed.
Looks good. You need to add your signoff on these things, i.e.:
Signed-off-by: Bill Kendall <wkendall@sgi.com>
We follow the signoff process used in the Linux kernel. See
sections 12-14 in this document:
https://github.com/torvalds/linux/blob/master/Documentation/SubmittingPatches
Reviewed-by: Alex Elder <aeldre@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xfsdump: remove redundant error code mapping
2011-09-19 21:02 ` Alex Elder
@ 2011-09-19 21:31 ` Bill Kendall
0 siblings, 0 replies; 3+ messages in thread
From: Bill Kendall @ 2011-09-19 21:31 UTC (permalink / raw)
To: aelder; +Cc: xfs
On 09/19/2011 04:02 PM, Alex Elder wrote:
> On Fri, 2011-09-02 at 09:22 -0500, Bill Kendall wrote:
>> Currently there is both an exit_strings array and an exit_codestring()
>> function for mapping an exit code to a string. They are very similar
>> except the latter prefaces every string with "EXIT_" and the former
>> uses "SUCCESS" instead of "NORMAL", and cannot handle an invalid exit
>> code. exit_codestring() is not currently used in active code (it's for
>> multi-stream), so its values can be changed to allow the exit_strings
>> array to be removed.
>
> Looks good. You need to add your signoff on these things, i.e.:
> Signed-off-by: Bill Kendall<wkendall@sgi.com>
> We follow the signoff process used in the Linux kernel. See
> sections 12-14 in this document:
> https://github.com/torvalds/linux/blob/master/Documentation/SubmittingPatches
>
>
> Reviewed-by: Alex Elder<aeldre@sgi.com>
>
Sorry, forgot the --signoff when formatting the patch. Need me to
resubmit?
Bill
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-19 21:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 14:22 [PATCH] xfsdump: remove redundant error code mapping Bill Kendall
2011-09-19 21:02 ` Alex Elder
2011-09-19 21:31 ` Bill Kendall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox