Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Sumit Garg and committed by
Daniel Thompson
b39cded8 95f7f154

+20 -20
+20 -20
kernel/debug/kdb/kdb_main.c
··· 654 654 * Returns: 655 655 * zero for success, a kdb diagnostic if error 656 656 */ 657 - struct defcmd_set { 657 + struct kdb_macro { 658 658 int count; 659 659 bool usable; 660 660 char *name; ··· 662 662 char *help; 663 663 char **command; 664 664 }; 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; 667 667 static bool defcmd_in_progress; 668 668 669 669 /* Forward references */ ··· 671 671 672 672 static int kdb_defcmd2(const char *cmdstr, const char *argv0) 673 673 { 674 - struct defcmd_set *s = defcmd_set + defcmd_set_count - 1; 674 + struct kdb_macro *s = kdb_macro + kdb_macro_count - 1; 675 675 char **save_command = s->command; 676 676 if (strcmp(argv0, "endefcmd") == 0) { 677 677 defcmd_in_progress = false; ··· 704 704 705 705 static int kdb_defcmd(int argc, const char **argv) 706 706 { 707 - struct defcmd_set *save_defcmd_set = defcmd_set, *s; 707 + struct kdb_macro *save_kdb_macro = kdb_macro, *s; 708 708 if (defcmd_in_progress) { 709 709 kdb_printf("kdb: nested defcmd detected, assuming missing " 710 710 "endefcmd\n"); ··· 712 712 } 713 713 if (argc == 0) { 714 714 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) { 716 716 kdb_printf("defcmd %s \"%s\" \"%s\"\n", s->name, 717 717 s->usage, s->help); 718 718 for (i = 0; i < s->count; ++i) ··· 727 727 kdb_printf("Command only available during kdb_init()\n"); 728 728 return KDB_NOTIMP; 729 729 } 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) 733 733 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; 737 737 memset(s, 0, sizeof(*s)); 738 738 s->usable = true; 739 739 s->name = kdb_strdup(argv[1], GFP_KDB); ··· 753 753 strcpy(s->help, argv[3]+1); 754 754 s->help[strlen(s->help)-1] = '\0'; 755 755 } 756 - ++defcmd_set_count; 756 + ++kdb_macro_count; 757 757 defcmd_in_progress = true; 758 - kfree(save_defcmd_set); 758 + kfree(save_kdb_macro); 759 759 return 0; 760 760 fail_help: 761 761 kfree(s->usage); 762 762 fail_usage: 763 763 kfree(s->name); 764 764 fail_name: 765 - kfree(defcmd_set); 765 + kfree(kdb_macro); 766 766 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; 769 769 return KDB_NOTIMP; 770 770 } 771 771 ··· 781 781 static int kdb_exec_defcmd(int argc, const char **argv) 782 782 { 783 783 int i, ret; 784 - struct defcmd_set *s; 784 + struct kdb_macro *s; 785 785 if (argc != 0) 786 786 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) { 788 788 if (strcmp(s->name, argv[0]) == 0) 789 789 break; 790 790 } 791 - if (i == defcmd_set_count) { 791 + if (i == kdb_macro_count) { 792 792 kdb_printf("kdb_exec_defcmd: could not find commands for %s\n", 793 793 argv[0]); 794 794 return KDB_NOTIMP;