Rev 4207 | Rev 4227 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4207 | Rev 4216 | ||
---|---|---|---|
Line 511... | Line 511... | ||
511 | int cmd_help(cmd_arg_t *argv) |
511 | int cmd_help(cmd_arg_t *argv) |
512 | { |
512 | { |
513 | spinlock_lock(&cmd_lock); |
513 | spinlock_lock(&cmd_lock); |
514 | 514 | ||
515 | link_t *cur; |
515 | link_t *cur; |
516 | size_t len = 0; |
516 | count_t len = 0; |
517 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
517 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
518 | cmd_info_t *hlp; |
518 | cmd_info_t *hlp; |
519 | hlp = list_get_instance(cur, cmd_info_t, link); |
519 | hlp = list_get_instance(cur, cmd_info_t, link); |
520 | 520 | ||
521 | spinlock_lock(&hlp->lock); |
521 | spinlock_lock(&hlp->lock); |
522 | if (str_size(hlp->name) > len) |
522 | if (str_length(hlp->name) > len) |
523 | len = str_size(hlp->name); |
523 | len = str_length(hlp->name); |
524 | spinlock_unlock(&hlp->lock); |
524 | spinlock_unlock(&hlp->lock); |
525 | } |
525 | } |
526 | 526 | ||
527 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
527 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
528 | cmd_info_t *hlp; |
528 | cmd_info_t *hlp; |
Line 580... | Line 580... | ||
580 | * @return 0 on failure, 1 on success. |
580 | * @return 0 on failure, 1 on success. |
581 | */ |
581 | */ |
582 | int cmd_desc(cmd_arg_t *argv) |
582 | int cmd_desc(cmd_arg_t *argv) |
583 | { |
583 | { |
584 | link_t *cur; |
584 | link_t *cur; |
585 | 585 | ||
586 | spinlock_lock(&cmd_lock); |
586 | spinlock_lock(&cmd_lock); |
587 | 587 | ||
588 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
588 | for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { |
589 | cmd_info_t *hlp; |
589 | cmd_info_t *hlp; |
590 | 590 | ||
591 | hlp = list_get_instance(cur, cmd_info_t, link); |
591 | hlp = list_get_instance(cur, cmd_info_t, link); |
592 | spinlock_lock(&hlp->lock); |
592 | spinlock_lock(&hlp->lock); |
593 | 593 | ||
594 | if (strncmp(hlp->name, (const char *) argv->buffer, str_size(hlp->name)) == 0) { |
594 | if (str_lcmp(hlp->name, (const char *) argv->buffer, str_length(hlp->name)) == 0) { |
595 | printf("%s - %s\n", hlp->name, hlp->description); |
595 | printf("%s - %s\n", hlp->name, hlp->description); |
596 | if (hlp->help) |
596 | if (hlp->help) |
597 | hlp->help(); |
597 | hlp->help(); |
598 | spinlock_unlock(&hlp->lock); |
598 | spinlock_unlock(&hlp->lock); |
599 | break; |
599 | break; |
600 | } |
600 | } |
601 | 601 | ||
602 | spinlock_unlock(&hlp->lock); |
602 | spinlock_unlock(&hlp->lock); |
603 | } |
603 | } |
604 | 604 | ||
605 | spinlock_unlock(&cmd_lock); |
605 | spinlock_unlock(&cmd_lock); |
606 | 606 | ||
607 | return 1; |
607 | return 1; |
608 | } |
608 | } |
609 | 609 | ||
610 | /** Search symbol table */ |
610 | /** Search symbol table */ |
611 | int cmd_symaddr(cmd_arg_t *argv) |
611 | int cmd_symaddr(cmd_arg_t *argv) |
Line 967... | Line 967... | ||
967 | * |
967 | * |
968 | * return Always 1. |
968 | * return Always 1. |
969 | */ |
969 | */ |
970 | int cmd_tests(cmd_arg_t *argv) |
970 | int cmd_tests(cmd_arg_t *argv) |
971 | { |
971 | { |
972 | size_t len = 0; |
972 | count_t len = 0; |
973 | test_t *test; |
973 | test_t *test; |
974 | for (test = tests; test->name != NULL; test++) { |
974 | for (test = tests; test->name != NULL; test++) { |
975 | if (str_size(test->name) > len) |
975 | if (str_length(test->name) > len) |
976 | len = str_size(test->name); |
976 | len = str_length(test->name); |
977 | } |
977 | } |
978 | 978 | ||
979 | for (test = tests; test->name != NULL; test++) |
979 | for (test = tests; test->name != NULL; test++) |
980 | printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)")); |
980 | printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)")); |
981 | 981 | ||
Line 1094... | Line 1094... | ||
1094 | */ |
1094 | */ |
1095 | int cmd_test(cmd_arg_t *argv) |
1095 | int cmd_test(cmd_arg_t *argv) |
1096 | { |
1096 | { |
1097 | test_t *test; |
1097 | test_t *test; |
1098 | 1098 | ||
1099 | if (strcmp((char *) argv->buffer, "*") == 0) { |
1099 | if (str_cmp((char *) argv->buffer, "*") == 0) { |
1100 | for (test = tests; test->name != NULL; test++) { |
1100 | for (test = tests; test->name != NULL; test++) { |
1101 | if (test->safe) { |
1101 | if (test->safe) { |
1102 | printf("\n"); |
1102 | printf("\n"); |
1103 | if (!run_test(test)) |
1103 | if (!run_test(test)) |
1104 | break; |
1104 | break; |
Line 1106... | Line 1106... | ||
1106 | } |
1106 | } |
1107 | } else { |
1107 | } else { |
1108 | bool fnd = false; |
1108 | bool fnd = false; |
1109 | 1109 | ||
1110 | for (test = tests; test->name != NULL; test++) { |
1110 | for (test = tests; test->name != NULL; test++) { |
1111 | if (strcmp(test->name, (char *) argv->buffer) == 0) { |
1111 | if (str_cmp(test->name, (char *) argv->buffer) == 0) { |
1112 | fnd = true; |
1112 | fnd = true; |
1113 | run_test(test); |
1113 | run_test(test); |
1114 | break; |
1114 | break; |
1115 | } |
1115 | } |
1116 | } |
1116 | } |
Line 1134... | Line 1134... | ||
1134 | uint32_t cnt = argv[1].intval; |
1134 | uint32_t cnt = argv[1].intval; |
1135 | 1135 | ||
1136 | bool fnd = false; |
1136 | bool fnd = false; |
1137 | 1137 | ||
1138 | for (test = tests; test->name != NULL; test++) { |
1138 | for (test = tests; test->name != NULL; test++) { |
1139 | if (strcmp(test->name, (char *) argv->buffer) == 0) { |
1139 | if (str_cmp(test->name, (char *) argv->buffer) == 0) { |
1140 | fnd = true; |
1140 | fnd = true; |
1141 | 1141 | ||
1142 | if (test->safe) |
1142 | if (test->safe) |
1143 | run_bench(test, cnt); |
1143 | run_bench(test, cnt); |
1144 | else |
1144 | else |