Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4295 → Rev 4296

/branches/dd/kernel/generic/src/console/cmd.c
31,8 → 31,8
*/
 
/**
* @file cmd.c
* @brief Kernel console command wrappers.
* @file cmd.c
* @brief Kernel console command wrappers.
*
* This file is meant to contain all wrapper functions for
* all kconsole commands. The point is in separating
64,7 → 64,7
#include <proc/task.h>
#include <ipc/ipc.h>
#include <ipc/irq.h>
#include <event/event.h>
#include <ipc/event.h>
#include <symtab.h>
#include <errno.h>
 
513,14 → 513,14
spinlock_lock(&cmd_lock);
link_t *cur;
size_t len = 0;
count_t len = 0;
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
cmd_info_t *hlp;
hlp = list_get_instance(cur, cmd_info_t, link);
spinlock_lock(&hlp->lock);
if (strlen(hlp->name) > len)
len = strlen(hlp->name);
if (str_length(hlp->name) > len)
len = str_length(hlp->name);
spinlock_unlock(&hlp->lock);
}
582,7 → 582,7
int cmd_desc(cmd_arg_t *argv)
{
link_t *cur;
 
spinlock_lock(&cmd_lock);
for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
590,8 → 590,8
hlp = list_get_instance(cur, cmd_info_t, link);
spinlock_lock(&hlp->lock);
 
if (strncmp(hlp->name, (const char *) argv->buffer, strlen(hlp->name)) == 0) {
if (str_lcmp(hlp->name, (const char *) argv->buffer, str_length(hlp->name)) == 0) {
printf("%s - %s\n", hlp->name, hlp->description);
if (hlp->help)
hlp->help();
598,12 → 598,12
spinlock_unlock(&hlp->lock);
break;
}
 
spinlock_unlock(&hlp->lock);
}
spinlock_unlock(&cmd_lock);
 
return 1;
}
 
969,11 → 969,11
*/
int cmd_tests(cmd_arg_t *argv)
{
size_t len = 0;
count_t len = 0;
test_t *test;
for (test = tests; test->name != NULL; test++) {
if (strlen(test->name) > len)
len = strlen(test->name);
if (str_length(test->name) > len)
len = str_length(test->name);
}
for (test = tests; test->name != NULL; test++)
996,7 → 996,8
interrupts_restore(ipl);
/* Execute the test */
char * ret = test->entry(false);
test_quiet = false;
char *ret = test->entry();
/* Update and read thread accounting */
ipl = interrupts_disable();
1048,7 → 1049,8
interrupts_restore(ipl);
/* Execute the test */
char * ret = test->entry(true);
test_quiet = true;
char * ret = test->entry();
/* Update and read thread accounting */
ipl = interrupts_disable();
1096,7 → 1098,7
{
test_t *test;
if (strcmp((char *) argv->buffer, "*") == 0) {
if (str_cmp((char *) argv->buffer, "*") == 0) {
for (test = tests; test->name != NULL; test++) {
if (test->safe) {
printf("\n");
1108,7 → 1110,7
bool fnd = false;
for (test = tests; test->name != NULL; test++) {
if (strcmp(test->name, (char *) argv->buffer) == 0) {
if (str_cmp(test->name, (char *) argv->buffer) == 0) {
fnd = true;
run_test(test);
break;
1133,24 → 1135,33
test_t *test;
uint32_t cnt = argv[1].intval;
bool fnd = false;
for (test = tests; test->name != NULL; test++) {
if (strcmp(test->name, (char *) argv->buffer) == 0) {
fnd = true;
if (test->safe)
run_bench(test, cnt);
else
printf("Unsafe test\n");
break;
if (str_cmp((char *) argv->buffer, "*") == 0) {
for (test = tests; test->name != NULL; test++) {
if (test->safe) {
if (!run_bench(test, cnt))
break;
}
}
} else {
bool fnd = false;
for (test = tests; test->name != NULL; test++) {
if (str_cmp(test->name, (char *) argv->buffer) == 0) {
fnd = true;
if (test->safe)
run_bench(test, cnt);
else
printf("Unsafe test\n");
break;
}
}
if (!fnd)
printf("Unknown test\n");
}
if (!fnd)
printf("Unknown test\n");
 
return 1;
}