Skip to content

Commit b39cded

Browse files
b49020Daniel Thompson
authored andcommitted
kdb: Rename struct defcmd_set to struct kdb_macro
Rename struct defcmd_set to struct kdb_macro as that sounds more appropriate given its purpose. Suggested-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Link: https://lore.kernel.org/r/20210712134620.276667-2-sumit.garg@linaro.org Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
1 parent 95f7f15 commit b39cded

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

‎kernel/debug/kdb/kdb_main.c‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -654,24 +654,24 @@ static void kdb_cmderror(int diag)
654654
* Returns:
655655
* zero for success, a kdb diagnostic if error
656656
*/
657-
struct defcmd_set {
657+
struct kdb_macro {
658658
int count;
659659
bool usable;
660660
char *name;
661661
char *usage;
662662
char *help;
663663
char **command;
664664
};
665-
static struct defcmd_set *defcmd_set;
666-
static int defcmd_set_count;
665+
static struct kdb_macro *kdb_macro;
666+
static int kdb_macro_count;
667667
static bool defcmd_in_progress;
668668

669669
/* Forward references */
670670
static int kdb_exec_defcmd(int argc, const char **argv);
671671

672672
static int kdb_defcmd2(const char *cmdstr, const char *argv0)
673673
{
674-
struct defcmd_set *s = defcmd_set + defcmd_set_count - 1;
674+
struct kdb_macro *s = kdb_macro + kdb_macro_count - 1;
675675
char **save_command = s->command;
676676
if (strcmp(argv0, "endefcmd") == 0) {
677677
defcmd_in_progress = false;
@@ -704,15 +704,15 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
704704

705705
static int kdb_defcmd(int argc, const char **argv)
706706
{
707-
struct defcmd_set *save_defcmd_set = defcmd_set, *s;
707+
struct kdb_macro *save_kdb_macro = kdb_macro, *s;
708708
if (defcmd_in_progress) {
709709
kdb_printf("kdb: nested defcmd detected, assuming missing "
710710
"endefcmd\n");
711711
kdb_defcmd2("endefcmd", "endefcmd");
712712
}
713713
if (argc == 0) {
714714
int i;
715-
for (s = defcmd_set; s < defcmd_set + defcmd_set_count; ++s) {
715+
for (s = kdb_macro; s < kdb_macro + kdb_macro_count; ++s) {
716716
kdb_printf("defcmd %s \"%s\" \"%s\"\n", s->name,
717717
s->usage, s->help);
718718
for (i = 0; i < s->count; ++i)
@@ -727,13 +727,13 @@ static int kdb_defcmd(int argc, const char **argv)
727727
kdb_printf("Command only available during kdb_init()\n");
728728
return KDB_NOTIMP;
729729
}
730-
defcmd_set = kmalloc_array(defcmd_set_count + 1, sizeof(*defcmd_set),
731-
GFP_KDB);
732-
if (!defcmd_set)
730+
kdb_macro = kmalloc_array(kdb_macro_count + 1, sizeof(*kdb_macro),
731+
GFP_KDB);
732+
if (!kdb_macro)
733733
goto fail_defcmd;
734-
memcpy(defcmd_set, save_defcmd_set,
735-
defcmd_set_count * sizeof(*defcmd_set));
736-
s = defcmd_set + defcmd_set_count;
734+
memcpy(kdb_macro, save_kdb_macro,
735+
kdb_macro_count * sizeof(*kdb_macro));
736+
s = kdb_macro + kdb_macro_count;
737737
memset(s, 0, sizeof(*s));
738738
s->usable = true;
739739
s->name = kdb_strdup(argv[1], GFP_KDB);
@@ -753,19 +753,19 @@ static int kdb_defcmd(int argc, const char **argv)
753753
strcpy(s->help, argv[3]+1);
754754
s->help[strlen(s->help)-1] = '\0';
755755
}
756-
++defcmd_set_count;
756+
++kdb_macro_count;
757757
defcmd_in_progress = true;
758-
kfree(save_defcmd_set);
758+
kfree(save_kdb_macro);
759759
return 0;
760760
fail_help:
761761
kfree(s->usage);
762762
fail_usage:
763763
kfree(s->name);
764764
fail_name:
765-
kfree(defcmd_set);
765+
kfree(kdb_macro);
766766
fail_defcmd:
767-
kdb_printf("Could not allocate new defcmd_set entry for %s\n", argv[1]);
768-
defcmd_set = save_defcmd_set;
767+
kdb_printf("Could not allocate new kdb_macro entry for %s\n", argv[1]);
768+
kdb_macro = save_kdb_macro;
769769
return KDB_NOTIMP;
770770
}
771771

@@ -781,14 +781,14 @@ static int kdb_defcmd(int argc, const char **argv)
781781
static int kdb_exec_defcmd(int argc, const char **argv)
782782
{
783783
int i, ret;
784-
struct defcmd_set *s;
784+
struct kdb_macro *s;
785785
if (argc != 0)
786786
return KDB_ARGCOUNT;
787-
for (s = defcmd_set, i = 0; i < defcmd_set_count; ++i, ++s) {
787+
for (s = kdb_macro, i = 0; i < kdb_macro_count; ++i, ++s) {
788788
if (strcmp(s->name, argv[0]) == 0)
789789
break;
790790
}
791-
if (i == defcmd_set_count) {
791+
if (i == kdb_macro_count) {
792792
kdb_printf("kdb_exec_defcmd: could not find commands for %s\n",
793793
argv[0]);
794794
return KDB_NOTIMP;

0 commit comments

Comments
 (0)