mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
fd37a8632d
commit
2fa3485f30
1 file changed
+19
-12
+19
-12
@@ -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(const 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(const char *s);
|
||||
static int parse_guest_loglvl(const char *s);
|
||||
|
||||
/*
|
||||
* <lvl> := none|error|warning|info|debug|all
|
||||
@@ -145,7 +145,7 @@ static atomic_t print_everything = ATOMIC_INIT(0);
|
||||
return (lvlnum); \
|
||||
}
|
||||
|
||||
static int __init __parse_loglvl(char *s, char **ps)
|
||||
static int __init __parse_loglvl(const char *s, const char **ps)
|
||||
{
|
||||
___parse_loglvl(s, ps, "none", 0);
|
||||
___parse_loglvl(s, ps, "error", 1);
|
||||
@@ -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(const 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(const 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(const 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(const char *s)
|
||||
{
|
||||
switch ( parse_bool(s, NULL) )
|
||||
{
|
||||
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)
|
||||
|
||||