Changeset View
Changeset View
Standalone View
Standalone View
stand/common/console.c
Show All 35 Lines | |||||
*/ | */ | ||||
static int cons_set(struct env_var *ev, int flags, const void *value); | static int cons_set(struct env_var *ev, int flags, const void *value); | ||||
static int cons_find(const char *name); | static int cons_find(const char *name); | ||||
static int cons_check(const char *string); | static int cons_check(const char *string); | ||||
static int cons_change(const char *string); | static int cons_change(const char *string); | ||||
static int twiddle_set(struct env_var *ev, int flags, const void *value); | static int twiddle_set(struct env_var *ev, int flags, const void *value); | ||||
#ifndef MODULE_VERBOSE | |||||
# define MODULE_VERBOSE MODULE_VERBOSE_TWIDDLE | |||||
#endif | |||||
int module_verbose = MODULE_VERBOSE; | |||||
static int | |||||
module_verbose_set(struct env_var *ev, int flags, const void *value) | |||||
{ | |||||
u_long v; | |||||
char *eptr; | |||||
v = strtoul(value, &eptr, 0); | |||||
if (*(const char *)value == 0 || *eptr != 0) { | |||||
printf("invalid module_verbose '%s'\n", (const char *)value); | |||||
return (CMD_ERROR); | |||||
} | |||||
module_verbose = (int)v; | |||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); | |||||
return (CMD_OK); | |||||
} | |||||
/* | /* | ||||
* Detect possible console(s) to use. If preferred console(s) have been | * Detect possible console(s) to use. If preferred console(s) have been | ||||
* specified, mark them as active. Else, mark the first probed console | * specified, mark them as active. Else, mark the first probed console | ||||
* as active. Also create the console variable. | * as active. Also create the console variable. | ||||
*/ | */ | ||||
void | void | ||||
cons_probe(void) | cons_probe(void) | ||||
{ | { | ||||
int cons; | int cons; | ||||
int active; | int active; | ||||
char *prefconsole; | char *prefconsole; | ||||
char module_verbose_buf[8]; | |||||
TSENTER(); | TSENTER(); | ||||
/* We want a callback to install the new value when this var changes. */ | /* We want a callback to install the new value when these vars change. */ | ||||
snprintf(module_verbose_buf, sizeof(module_verbose_buf), "%d", | |||||
module_verbose); | |||||
env_setenv("module_verbose", EV_VOLATILE, module_verbose_buf, | |||||
module_verbose_set, env_nounset); | |||||
env_setenv("twiddle_divisor", EV_VOLATILE, "16", twiddle_set, | env_setenv("twiddle_divisor", EV_VOLATILE, "16", twiddle_set, | ||||
env_nounset); | env_nounset); | ||||
/* Do all console probes */ | /* Do all console probes */ | ||||
for (cons = 0; consoles[cons] != NULL; cons++) { | for (cons = 0; consoles[cons] != NULL; cons++) { | ||||
consoles[cons]->c_flags = 0; | consoles[cons]->c_flags = 0; | ||||
consoles[cons]->c_probe(consoles[cons]); | consoles[cons]->c_probe(consoles[cons]); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | twiddle_set(struct env_var *ev, int flags, const void *value) | ||||
if (*(const char *)value == 0 || *eptr != 0) { | if (*(const char *)value == 0 || *eptr != 0) { | ||||
printf("invalid twiddle_divisor '%s'\n", (const char *)value); | printf("invalid twiddle_divisor '%s'\n", (const char *)value); | ||||
return (CMD_ERROR); | return (CMD_ERROR); | ||||
} | } | ||||
twiddle_divisor((u_int)tdiv); | twiddle_divisor((u_int)tdiv); | ||||
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); | env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); | ||||
return (CMD_OK); | return (CMD_OK); | ||||
} | } | ||||
rpokala: `v` is a `(u_long)`, while `module_verbose` is an `(int)`. Therefore, shouldn't this be:
```… |
v is a (u_long), while module_verbose is an (int). Therefore, shouldn't this be: