[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 30/52] xen/drivers/char/console.c: let custom parameter parsing routines return errno
Modify the custom parameter parsing routines in: xen/drivers/char/console.c to indicate whether the parameter value was parsed successfully. Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Tim Deegan <tim@xxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- xen/drivers/char/console.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index f0659fba1b..daf0e1878d 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -67,7 +67,7 @@ enum con_timestamp_mode static enum con_timestamp_mode __read_mostly opt_con_timestamp_mode = TSM_NONE; -static void parse_console_timestamps(char *s); +static int parse_console_timestamps(char *s); custom_param("console_timestamps", parse_console_timestamps); /* conring_size: allows a large console ring than default (16kB). */ @@ -123,8 +123,8 @@ static int __read_mostly xenlog_guest_upper_thresh = static int __read_mostly xenlog_guest_lower_thresh = XENLOG_GUEST_LOWER_THRESHOLD; -static void parse_loglvl(char *s); -static void parse_guest_loglvl(char *s); +static int parse_loglvl(char *s); +static int parse_guest_loglvl(char *s); /* * <lvl> := none|error|warning|info|debug|all @@ -156,23 +156,26 @@ static int __init __parse_loglvl(char *s, char **ps) return 2; /* sane fallback */ } -static void __init _parse_loglvl(char *s, int *lower, int *upper) +static int __init _parse_loglvl(char *s, int *lower, int *upper) { *lower = *upper = __parse_loglvl(s, &s); if ( *s == '/' ) *upper = __parse_loglvl(s+1, &s); if ( *upper < *lower ) *upper = *lower; + + return *s ? -EINVAL : 0; } -static void __init parse_loglvl(char *s) +static int __init parse_loglvl(char *s) { - _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh); + return _parse_loglvl(s, &xenlog_lower_thresh, &xenlog_upper_thresh); } -static void __init parse_guest_loglvl(char *s) +static int __init parse_guest_loglvl(char *s) { - _parse_loglvl(s, &xenlog_guest_lower_thresh, &xenlog_guest_upper_thresh); + return _parse_loglvl(s, &xenlog_guest_lower_thresh, + &xenlog_guest_upper_thresh); } static char *loglvl_str(int lvl) @@ -603,16 +606,16 @@ static int printk_prefix_check(char *p, char **pp) ((loglvl < upper_thresh) && printk_ratelimit())); } -static void __init parse_console_timestamps(char *s) +static int __init parse_console_timestamps(char *s) { switch ( parse_bool(s) ) { case 0: opt_con_timestamp_mode = TSM_NONE; - return; + return 0; case 1: opt_con_timestamp_mode = TSM_DATE; - return; + return 0; } if ( *s == '\0' || /* Compat for old booleanparam() */ !strcmp(s, "date") ) @@ -623,6 +626,10 @@ static void __init parse_console_timestamps(char *s) opt_con_timestamp_mode = TSM_BOOT; else if ( !strcmp(s, "none") ) opt_con_timestamp_mode = TSM_NONE; + else + return -EINVAL; + + return 0; } static void printk_start_of_line(const char *prefix) -- 2.12.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |