9
0
Fork 0

remove typedef cmd_tbl_t and replace it with struct command

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2010-01-04 10:21:11 +01:00
parent 88351d2e4b
commit 922bb41a47
69 changed files with 105 additions and 109 deletions

View File

@ -162,7 +162,7 @@ int cleanup_before_linux (void)
* required. * required.
*/ */
static int do_icache(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_icache(struct command *cmdtp, int argc, char *argv[])
{ {
if (argc == 1) { if (argc == 1) {
printf("icache is %sabled\n", icache_status() ? "en" : "dis"); printf("icache is %sabled\n", icache_status() ? "en" : "dis");

View File

@ -41,7 +41,7 @@ static char *crbits[] = {"M", "A", "C", "W", "P", "D", "L", "B", "S", "R",
"F", "Z", "I", "V", "RR", "L4", "", "", "", "", "", "FI", "U", "XP", "F", "Z", "I", "V", "RR", "L4", "", "", "", "", "", "FI", "U", "XP",
"VE", "EE", "L2"}; "VE", "EE", "L2"};
static int do_cpuinfo(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_cpuinfo(struct command *cmdtp, int argc, char *argv[])
{ {
unsigned long mainid, cache, cr; unsigned long mainid, cache, cr;
char *architecture, *implementer; char *architecture, *implementer;

View File

@ -235,7 +235,7 @@ struct zimage_header {
u32 end; u32 end;
}; };
static int do_bootz(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_bootz(struct command *cmdtp, int argc, char *argv[])
{ {
void (*theKernel)(int zero, int arch, void *params); void (*theKernel)(int zero, int arch, void *params);
const char *commandline = getenv("bootargs"); const char *commandline = getenv("bootargs");
@ -308,7 +308,7 @@ BAREBOX_CMD_END
#endif /* CONFIG_CMD_BOOTZ */ #endif /* CONFIG_CMD_BOOTZ */
#ifdef CONFIG_CMD_BOOTU #ifdef CONFIG_CMD_BOOTU
static int do_bootu(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_bootu(struct command *cmdtp, int argc, char *argv[])
{ {
void (*theKernel)(int zero, int arch, void *params); void (*theKernel)(int zero, int arch, void *params);
const char *commandline = getenv("bootargs"); const char *commandline = getenv("bootargs");

View File

@ -4,7 +4,7 @@
#include <mach/imx-regs.h> #include <mach/imx-regs.h>
#include <mach/clock.h> #include <mach/clock.h>
static int do_clko (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_clko(struct command *cmdtp, int argc, char *argv[])
{ {
int opt, div = 0, src = -2, ret; int opt, div = 0, src = -2, ret;

View File

@ -69,7 +69,7 @@ unsigned int imx_decode_pll(unsigned int reg_val, unsigned int freq)
extern void imx_dump_clocks(void); extern void imx_dump_clocks(void);
static int do_clocks (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_clocks(struct command *cmdtp, int argc, char *argv[])
{ {
imx_dump_clocks(); imx_dump_clocks();

View File

@ -116,7 +116,7 @@ int loadxc(int xcno) {
return 0; return 0;
} }
int do_loadxc (cmd_tbl_t *cmdtp, int argc, char *argv[]) int do_loadxc(struct command *cmdtp, int argc, char *argv[])
{ {
int xcno; int xcno;

View File

@ -314,7 +314,7 @@ void irq_free_handler(int irq)
/****************************************************************************/ /****************************************************************************/
#if (CONFIG_COMMANDS & CFG_CMD_IRQ) #if (CONFIG_COMMANDS & CFG_CMD_IRQ)
void do_irqinfo(cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[]) void do_irqinfo(struct command * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
{ {
int irq, re_enable; int irq, re_enable;
u32 intr_ctrl; u32 intr_ctrl;

View File

@ -6,7 +6,7 @@
#define MAGIC 0x19691228 #define MAGIC 0x19691228
static int do_alternate (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_alternate(struct command *cmdtp, int argc, char *argv[])
{ {
void *buf; void *buf;
size_t size; size_t size;

View File

@ -353,7 +353,7 @@ core_initcall(pcm043_core_setup);
#define MPCTL_PARAM_399 (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5)) #define MPCTL_PARAM_399 (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
#define MPCTL_PARAM_532 ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1)) #define MPCTL_PARAM_532 ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
static int do_cpufreq(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
{ {
unsigned long freq; unsigned long freq;

View File

@ -29,7 +29,7 @@ static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, int
} }
} }
static int do_bmp(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_bmp(struct command *cmdtp, int argc, char *argv[])
{ {
int ret, opt, fd; int ret, opt, fd;
char *fbdev = "/dev/fb0"; char *fbdev = "/dev/fb0";

View File

@ -52,7 +52,7 @@
* - loaded (first part of) image to header load address, * - loaded (first part of) image to header load address,
* - disabled interrupts. * - disabled interrupts.
*/ */
typedef void boot_os_Fcn (cmd_tbl_t *cmdtp, int flag, typedef void boot_os_Fcn(struct command *cmdtp, int flag,
int argc, char *argv[], int argc, char *argv[],
ulong addr, /* of image to boot */ ulong addr, /* of image to boot */
ulong *len_ptr, /* multi-file image length table */ ulong *len_ptr, /* multi-file image length table */
@ -364,7 +364,7 @@ static int handler_parse_options(struct image_data *data, int opt, char *optarg)
return -1; return -1;
} }
static int do_bootm (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_bootm(struct command *cmdtp, int argc, char *argv[])
{ {
ulong iflag; ulong iflag;
int opt; int opt;
@ -464,7 +464,7 @@ BAREBOX_CMD_START(bootm)
BAREBOX_CMD_END BAREBOX_CMD_END
#ifdef CONFIG_CMD_IMI #ifdef CONFIG_CMD_IMI
static int do_iminfo ( cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_iminfo(struct command *cmdtp, int argc, char *argv[])
{ {
int arg; int arg;
ulong addr; ulong addr;

View File

@ -39,7 +39,7 @@
* @param[in] argc Argument count from command line * @param[in] argc Argument count from command line
* @param[in] argv List of input arguments * @param[in] argv List of input arguments
*/ */
static int do_cat(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_cat(struct command *cmdtp, int argc, char *argv[])
{ {
int ret; int ret;
int fd, i; int fd, i;

View File

@ -30,7 +30,7 @@
#include <fs.h> #include <fs.h>
#include <errno.h> #include <errno.h>
static int do_cd (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_cd(struct command *cmdtp, int argc, char *argv[])
{ {
int ret; int ret;

View File

@ -24,7 +24,7 @@
#include <command.h> #include <command.h>
#include <readkey.h> #include <readkey.h>
static int do_clear (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_clear(struct command *cmdtp, int argc, char *argv[])
{ {
printf(ANSI_CLEAR_SCREEN); printf(ANSI_CLEAR_SCREEN);

View File

@ -37,7 +37,7 @@
* @param[in] argc Argument count from command line * @param[in] argc Argument count from command line
* @param[in] argv List of input arguments * @param[in] argv List of input arguments
*/ */
static int do_cp ( cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_cp(struct command *cmdtp, int argc, char *argv[])
{ {
int ret = 1; int ret = 1;
struct stat statbuf; struct stat statbuf;

View File

@ -30,7 +30,7 @@
#include <malloc.h> #include <malloc.h>
#include <linux/ctype.h> #include <linux/ctype.h>
static int do_crc (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_crc(struct command *cmdtp, int argc, char *argv[])
{ {
ulong start = 0, size = ~0, total = 0; ulong start = 0, size = ~0, total = 0;
ulong crc = 0, vcrc = 0; ulong crc = 0, vcrc = 0;

View File

@ -95,7 +95,7 @@ static int dfu_do_parse_one(char *partstr, char **endstr, struct usb_dfu_dev *df
* s = save mode (download whole image before flashing) * s = save mode (download whole image before flashing)
* r = read back (firmware image can be downloaded back from host) * r = read back (firmware image can be downloaded back from host)
*/ */
static int do_dfu(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_dfu(struct command *cmdtp, int argc, char *argv[])
{ {
int opt, n = 0; int opt, n = 0;
struct usb_dfu_pdata pdata; struct usb_dfu_pdata pdata;

View File

@ -26,7 +26,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
static int do_echo (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_echo(struct command *cmdtp, int argc, char *argv[])
{ {
int i, optind = 1; int i, optind = 1;
int fd = stdout, opt, newline = 1; int fd = stdout, opt, newline = 1;

View File

@ -389,7 +389,7 @@ static void getwinsize(void) {
} }
#endif #endif
static int do_edit(cmd_tbl_t * cmdtp, int argc, char *argv[]) static int do_edit(struct command * cmdtp, int argc, char *argv[])
{ {
int lastscrcol; int lastscrcol;
int i; int i;

View File

@ -29,7 +29,7 @@
#include <malloc.h> #include <malloc.h>
#include <xfuncs.h> #include <xfuncs.h>
static int do_exec(cmd_tbl_t * cmdtp, int argc, char *argv[]) static int do_exec(struct command * cmdtp, int argc, char *argv[])
{ {
int i; int i;
char *script; char *script;

View File

@ -28,7 +28,7 @@
#include <errno.h> #include <errno.h>
#include <environment.h> #include <environment.h>
static int do_export ( cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_export(struct command *cmdtp, int argc, char *argv[])
{ {
int i = 1; int i = 1;
char *ptr; char *ptr;

View File

@ -24,7 +24,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
static int do_false (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_false(struct command *cmdtp, int argc, char *argv[])
{ {
return 1; return 1;
} }

View File

@ -37,7 +37,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <linux/stat.h> #include <linux/stat.h>
static int do_flerase (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_flerase(struct command *cmdtp, int argc, char *argv[])
{ {
int fd; int fd;
char *filename = NULL; char *filename = NULL;
@ -107,7 +107,7 @@ BAREBOX_CMD_END
* Refer \b addpart, \b delpart and \b devinfo for partition handling. * Refer \b addpart, \b delpart and \b devinfo for partition handling.
*/ */
static int do_protect (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_protect(struct command *cmdtp, int argc, char *argv[])
{ {
int fd; int fd;
char *filename = NULL; char *filename = NULL;

View File

@ -30,7 +30,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <errno.h> #include <errno.h>
static int do_go (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_go(struct command *cmdtp, int argc, char *argv[])
{ {
void *addr; void *addr;
int rcode = 1; int rcode = 1;

View File

@ -20,7 +20,7 @@
#include <errno.h> #include <errno.h>
#include <gpio.h> #include <gpio.h>
static int do_gpio_get_value(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_gpio_get_value(struct command *cmdtp, int argc, char *argv[])
{ {
int gpio, value; int gpio, value;
@ -45,7 +45,7 @@ BAREBOX_CMD_START(gpio_get_value)
BAREBOX_CMD_HELP(cmd_gpio_get_value_help) BAREBOX_CMD_HELP(cmd_gpio_get_value_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_gpio_set_value(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_gpio_set_value(struct command *cmdtp, int argc, char *argv[])
{ {
int gpio, value; int gpio, value;
@ -69,7 +69,7 @@ BAREBOX_CMD_START(gpio_set_value)
BAREBOX_CMD_HELP(cmd_gpio_set_value_help) BAREBOX_CMD_HELP(cmd_gpio_set_value_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_gpio_direction_input(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_gpio_direction_input(struct command *cmdtp, int argc, char *argv[])
{ {
int gpio, ret; int gpio, ret;
@ -94,7 +94,7 @@ BAREBOX_CMD_START(gpio_direction_input)
BAREBOX_CMD_HELP(cmd_do_gpio_direction_input_help) BAREBOX_CMD_HELP(cmd_do_gpio_direction_input_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_gpio_direction_output(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_gpio_direction_output(struct command *cmdtp, int argc, char *argv[])
{ {
int gpio, value, ret; int gpio, value, ret;

View File

@ -28,7 +28,7 @@
* Use puts() instead of printf() to avoid printf buffer overflow * Use puts() instead of printf() to avoid printf buffer overflow
* for long help messages * for long help messages
*/ */
static int do_help (cmd_tbl_t * cmdtp, int argc, char *argv[]) static int do_help(struct command * cmdtp, int argc, char *argv[])
{ {
if (argc == 1) { /* show list of commands */ if (argc == 1) { /* show list of commands */
for_each_command(cmdtp) { for_each_command(cmdtp) {

View File

@ -5,7 +5,7 @@
#include <fs.h> #include <fs.h>
#include <malloc.h> #include <malloc.h>
static int do_insmod (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_insmod(struct command *cmdtp, int argc, char *argv[])
{ {
struct module *module; struct module *module;
void *buf; void *buf;

View File

@ -688,7 +688,7 @@ static struct console_device *get_current_console(void)
* *
* @return success or failure * @return success or failure
*/ */
static int do_load_serial_bin(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_load_serial_bin(struct command *cmdtp, int argc, char *argv[])
{ {
ulong offset = 0; ulong offset = 0;
ulong addr; ulong addr;

View File

@ -27,7 +27,7 @@
#include <command.h> #include <command.h>
#include <environment.h> #include <environment.h>
static int do_loadenv(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_loadenv(struct command *cmdtp, int argc, char *argv[])
{ {
char *filename, *dirname; char *filename, *dirname;

View File

@ -42,7 +42,7 @@ static int save_serial (ulong offset, ulong size);
static int write_record (char *buf); static int write_record (char *buf);
# endif /* CFG_CMD_SAVES */ # endif /* CFG_CMD_SAVES */
int do_load_serial (cmd_tbl_t *cmdtp, int argc, char *argv[]) int do_load_serial(struct command *cmdtp, int argc, char *argv[])
{ {
ulong offset = 0; ulong offset = 0;
ulong addr; ulong addr;
@ -233,7 +233,7 @@ read_record (char *buf, ulong len)
#if (CONFIG_COMMANDS & CFG_CMD_SAVES) #if (CONFIG_COMMANDS & CFG_CMD_SAVES)
int do_save_serial (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_save_serial(struct command *cmdtp, int flag, int argc, char *argv[])
{ {
ulong offset = 0; ulong offset = 0;
ulong size = 0; ulong size = 0;

View File

@ -111,7 +111,7 @@ out:
return 0; return 0;
} }
static int do_ls (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_ls(struct command *cmdtp, int argc, char *argv[])
{ {
int ret, opt, o; int ret, opt, o;
struct stat s; struct stat s;

View File

@ -2,7 +2,7 @@
#include <command.h> #include <command.h>
#include <module.h> #include <module.h>
static int do_lsmod (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_lsmod(struct command *cmdtp, int argc, char *argv[])
{ {
struct module *mod; struct module *mod;

View File

@ -163,7 +163,7 @@ static int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
return 0; return 0;
} }
static int do_mem_md(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mem_md(struct command *cmdtp, int argc, char *argv[])
{ {
ulong start = 0, size = 0x100; ulong start = 0, size = 0x100;
int r, now; int r, now;
@ -238,7 +238,7 @@ BAREBOX_CMD_START(md)
BAREBOX_CMD_HELP(cmd_md_help) BAREBOX_CMD_HELP(cmd_md_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_mem_mw ( cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mem_mw(struct command *cmdtp, int argc, char *argv[])
{ {
int ret = 0; int ret = 0;
int fd; int fd;
@ -301,7 +301,7 @@ BAREBOX_CMD_START(mw)
BAREBOX_CMD_HELP(cmd_mw_help) BAREBOX_CMD_HELP(cmd_mw_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_mem_cmp(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mem_cmp(struct command *cmdtp, int argc, char *argv[])
{ {
ulong addr1, addr2, count = ~0; ulong addr1, addr2, count = ~0;
int mode = O_RWSIZE_1; int mode = O_RWSIZE_1;
@ -410,7 +410,7 @@ BAREBOX_CMD_START(memcmp)
BAREBOX_CMD_HELP(cmd_memcmp_help) BAREBOX_CMD_HELP(cmd_memcmp_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_mem_cp(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mem_cp(struct command *cmdtp, int argc, char *argv[])
{ {
ulong count; ulong count;
ulong dest, src; ulong dest, src;
@ -506,7 +506,7 @@ BAREBOX_CMD_START(memcpy)
BAREBOX_CMD_HELP(cmd_memcpy_help) BAREBOX_CMD_HELP(cmd_memcpy_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_memset(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_memset(struct command *cmdtp, int argc, char *argv[])
{ {
ulong s, c, n; ulong s, c, n;
int fd; int fd;

View File

@ -23,7 +23,7 @@
#include <command.h> #include <command.h>
#include <malloc.h> #include <malloc.h>
static int do_meminfo (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_meminfo(struct command *cmdtp, int argc, char *argv[])
{ {
malloc_stats(); malloc_stats();

View File

@ -322,7 +322,7 @@ static int mem_test(ulong _start, ulong _end, ulong pattern)
} }
#endif #endif
static int do_mem_mtest (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mem_mtest(struct command *cmdtp, int argc, char *argv[])
{ {
ulong start, end, pattern = 0; ulong start, end, pattern = 0;

View File

@ -26,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
static int do_mkdir (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mkdir(struct command *cmdtp, int argc, char *argv[])
{ {
int opt, parent = 0, ret; int opt, parent = 0, ret;

View File

@ -30,7 +30,7 @@
#include <fs.h> #include <fs.h>
#include <errno.h> #include <errno.h>
static int do_mount (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mount(struct command *cmdtp, int argc, char *argv[])
{ {
int ret = 0; int ret = 0;
struct mtab_entry *entry = NULL; struct mtab_entry *entry = NULL;

View File

@ -279,7 +279,7 @@ out1:
#define NAND_DEL (1 << 1) #define NAND_DEL (1 << 1)
#define NAND_MARKBAD (1 << 2) #define NAND_MARKBAD (1 << 2)
static int do_nand(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_nand(struct command *cmdtp, int argc, char *argv[])
{ {
int opt; int opt;
struct nand_bb *bb; struct nand_bb *bb;

View File

@ -76,7 +76,7 @@ void netboot_update_env(void)
#ifdef CONFIG_NET_RARP #ifdef CONFIG_NET_RARP
extern void RarpRequest(void); extern void RarpRequest(void);
static int do_rarpb (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_rarpb(struct command *cmdtp, int argc, char *argv[])
{ {
int size; int size;
@ -102,7 +102,7 @@ BAREBOX_CMD_START(rarpboot)
BAREBOX_CMD_END BAREBOX_CMD_END
#endif /* CONFIG_NET_RARP */ #endif /* CONFIG_NET_RARP */
static int do_ethact (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_ethact(struct command *cmdtp, int argc, char *argv[])
{ {
struct eth_device *edev; struct eth_device *edev;

View File

@ -99,7 +99,7 @@ static int mtd_part_do_parse_one(char *devname, const char *partstr,
return ret; return ret;
} }
static int do_addpart(cmd_tbl_t * cmdtp, int argc, char *argv[]) static int do_addpart(struct command * cmdtp, int argc, char *argv[])
{ {
char *devname; char *devname;
char *endp; char *endp;
@ -180,7 +180,7 @@ BAREBOX_CMD_END
* @note This command has to be reworked and will probably change it's API. * @note This command has to be reworked and will probably change it's API.
*/ */
static int do_delpart(cmd_tbl_t * cmdtp, int argc, char *argv[]) static int do_delpart(struct command * cmdtp, int argc, char *argv[])
{ {
int i, err; int i, err;

View File

@ -28,7 +28,7 @@
#include <errno.h> #include <errno.h>
#include <environment.h> #include <environment.h>
static int do_printenv (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_printenv(struct command *cmdtp, int argc, char *argv[])
{ {
struct variable_d *var; struct variable_d *var;
struct env_context *c, *current_c; struct env_context *c, *current_c;

View File

@ -23,7 +23,7 @@
#include <command.h> #include <command.h>
#include <fs.h> #include <fs.h>
static int do_pwd (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_pwd(struct command *cmdtp, int argc, char *argv[])
{ {
printf("%s\n", getcwd()); printf("%s\n", getcwd());
return 0; return 0;

View File

@ -27,7 +27,7 @@
#include <xfuncs.h> #include <xfuncs.h>
#include <environment.h> #include <environment.h>
static int do_readline (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_readline(struct command *cmdtp, int argc, char *argv[])
{ {
char *buf = xzalloc(CONFIG_CBSIZE); char *buf = xzalloc(CONFIG_CBSIZE);

View File

@ -23,7 +23,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
static int do_reginfo (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_reginfo(struct command *cmdtp, int argc, char *argv[])
{ {
reginfo(); reginfo();
return 0; return 0;

View File

@ -23,7 +23,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
static int cmd_reset (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int cmd_reset(struct command *cmdtp, int argc, char *argv[])
{ {
reset_cpu(0); reset_cpu(0);

View File

@ -24,7 +24,7 @@
#include <fs.h> #include <fs.h>
#include <errno.h> #include <errno.h>
static int do_rm (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_rm(struct command *cmdtp, int argc, char *argv[])
{ {
int i = 1; int i = 1;

View File

@ -3,7 +3,7 @@
#include <fs.h> #include <fs.h>
#include <errno.h> #include <errno.h>
static int do_rmdir (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_rmdir(struct command *cmdtp, int argc, char *argv[])
{ {
int i = 1; int i = 1;

View File

@ -30,7 +30,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <environment.h> #include <environment.h>
static int do_saveenv(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_saveenv(struct command *cmdtp, int argc, char *argv[])
{ {
int ret, fd; int ret, fd;
char *filename, *dirname; char *filename, *dirname;

View File

@ -28,7 +28,7 @@
#include <errno.h> #include <errno.h>
#include <environment.h> #include <environment.h>
static int do_setenv ( cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_setenv(struct command *cmdtp, int argc, char *argv[])
{ {
if (argc < 2) if (argc < 2)
return COMMAND_ERROR_USAGE; return COMMAND_ERROR_USAGE;

View File

@ -24,7 +24,7 @@
#include <command.h> #include <command.h>
#include <clock.h> #include <clock.h>
static int do_sleep (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_sleep(struct command *cmdtp, int argc, char *argv[])
{ {
uint64_t start; uint64_t start;
ulong delay; ulong delay;

View File

@ -76,7 +76,7 @@ static int parse_opt(const char *opt)
return -1; return -1;
} }
static int do_test (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_test(struct command *cmdtp, int argc, char *argv[])
{ {
char **ap; char **ap;
int left, adv, expr, last_expr, neg, last_cmp, opt, zero; int left, adv, expr, last_expr, neg, last_cmp, opt, zero;

View File

@ -31,7 +31,7 @@
#define TIMEOUT_ANYKEY (1 << 2) #define TIMEOUT_ANYKEY (1 << 2)
#define TIMEOUT_SILENT (1 << 3) #define TIMEOUT_SILENT (1 << 3)
static int do_timeout(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_timeout(struct command *cmdtp, int argc, char *argv[])
{ {
int timeout = 3, ret = 1; int timeout = 3, ret = 1;
int flags = 0, opt, countdown; int flags = 0, opt, countdown;

View File

@ -24,7 +24,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
static int do_true (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_true(struct command *cmdtp, int argc, char *argv[])
{ {
return 0; return 0;
} }

View File

@ -24,7 +24,7 @@
#include <fs.h> #include <fs.h>
#include <errno.h> #include <errno.h>
static int do_umount (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_umount(struct command *cmdtp, int argc, char *argv[])
{ {
int ret = 0; int ret = 0;

View File

@ -24,7 +24,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
static int do_version (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_version(struct command *cmdtp, int argc, char *argv[])
{ {
extern char version_string[]; extern char version_string[];
printf ("\n%s\n", version_string); printf ("\n%s\n", version_string);

View File

@ -44,7 +44,7 @@ EXPORT_SYMBOL(command_list);
#ifdef CONFIG_SHELL_HUSH #ifdef CONFIG_SHELL_HUSH
static int do_exit (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_exit(struct command *cmdtp, int argc, char *argv[])
{ {
int r; int r;
@ -62,7 +62,7 @@ BAREBOX_CMD_END
#endif #endif
void barebox_cmd_usage(cmd_tbl_t *cmdtp) void barebox_cmd_usage(struct command *cmdtp)
{ {
#ifdef CONFIG_LONGHELP #ifdef CONFIG_LONGHELP
/* found - print (long) help info */ /* found - print (long) help info */
@ -85,15 +85,15 @@ EXPORT_SYMBOL(barebox_cmd_usage);
static int compare(struct list_head *a, struct list_head *b) static int compare(struct list_head *a, struct list_head *b)
{ {
char *na = (char*)list_entry(a, cmd_tbl_t, list)->name; char *na = (char*)list_entry(a, struct command, list)->name;
char *nb = (char*)list_entry(b, cmd_tbl_t, list)->name; char *nb = (char*)list_entry(b, struct command, list)->name;
return strcmp(na, nb); return strcmp(na, nb);
} }
int execute_command(int argc, char **argv) int execute_command(int argc, char **argv)
{ {
cmd_tbl_t *cmdtp; struct command *cmdtp;
int ret; int ret;
getopt_reset(); getopt_reset();
@ -117,7 +117,7 @@ int execute_command(int argc, char **argv)
} }
} }
int register_command(cmd_tbl_t *cmd) int register_command(struct command *cmd)
{ {
/* /*
* We do not check if the command already exists. * We do not check if the command already exists.
@ -133,9 +133,9 @@ int register_command(cmd_tbl_t *cmd)
char **aliases = (char**)cmd->aliases; char **aliases = (char**)cmd->aliases;
while(*aliases) { while(*aliases) {
char *usage = "alias for "; char *usage = "alias for ";
cmd_tbl_t *c = xzalloc(sizeof(cmd_tbl_t)); struct command *c = xzalloc(sizeof(struct command));
memcpy(c, cmd, sizeof(cmd_tbl_t)); memcpy(c, cmd, sizeof(struct command));
c->name = *aliases; c->name = *aliases;
c->usage = xmalloc(strlen(usage) + strlen(cmd->name) + 1); c->usage = xmalloc(strlen(usage) + strlen(cmd->name) + 1);
@ -156,15 +156,15 @@ EXPORT_SYMBOL(register_command);
/* /*
* find command table entry for a command * find command table entry for a command
*/ */
cmd_tbl_t *find_cmd (const char *cmd) struct command *find_cmd (const char *cmd)
{ {
cmd_tbl_t *cmdtp; struct command *cmdtp;
cmd_tbl_t *cmdtp_temp = &__barebox_cmd_start; /*Init value */ struct command *cmdtp_temp = &__barebox_cmd_start; /*Init value */
int len; int len;
int n_found = 0; int n_found = 0;
len = strlen (cmd); len = strlen (cmd);
cmdtp = list_entry(&command_list, cmd_tbl_t, list); cmdtp = list_entry(&command_list, struct command, list);
for_each_command(cmdtp) { for_each_command(cmdtp) {
if (strncmp (cmd, cmdtp->name, len) == 0) { if (strncmp (cmd, cmdtp->name, len) == 0) {
@ -191,7 +191,7 @@ cmd_tbl_t *find_cmd (const char *cmd)
*/ */
static int init_command_list(void) static int init_command_list(void)
{ {
cmd_tbl_t *cmdtp; struct command *cmdtp;
for (cmdtp = &__barebox_cmd_start; for (cmdtp = &__barebox_cmd_start;
cmdtp != &__barebox_cmd_end; cmdtp != &__barebox_cmd_end;

View File

@ -69,7 +69,7 @@ out:
static int command_complete(struct string_list *sl, char *instr) static int command_complete(struct string_list *sl, char *instr)
{ {
cmd_tbl_t *cmdtp; struct command *cmdtp;
char cmd[128]; char cmd[128];
for_each_command(cmdtp) { for_each_command(cmdtp) {

View File

@ -122,7 +122,7 @@
#include <glob.h> #include <glob.h>
/*cmd_boot.c*/ /*cmd_boot.c*/
extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); /* do_bootd */ extern int do_bootd(struct command *cmdtp, int flag, int argc, char *argv[]); /* do_bootd */
#define SPECIAL_VAR_SYMBOL 03 #define SPECIAL_VAR_SYMBOL 03
@ -1583,7 +1583,7 @@ int run_shell(void)
return rcode; return rcode;
} }
static int do_sh(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_sh(struct command *cmdtp, int argc, char *argv[])
{ {
if (argc < 2) if (argc < 2)
return COMMAND_ERROR_USAGE; return COMMAND_ERROR_USAGE;
@ -1602,7 +1602,7 @@ BAREBOX_CMD_START(sh)
BAREBOX_CMD_HELP(cmd_sh_help) BAREBOX_CMD_HELP(cmd_sh_help)
BAREBOX_CMD_END BAREBOX_CMD_END
static int do_source(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_source(struct command *cmdtp, int argc, char *argv[])
{ {
if (argc < 2) if (argc < 2)
return COMMAND_ERROR_USAGE; return COMMAND_ERROR_USAGE;

View File

@ -297,8 +297,8 @@ struct module * load_module(void *mod_image, unsigned long len)
#ifdef CONFIG_COMMAND #ifdef CONFIG_COMMAND
cmdindex = find_sec(ehdr, sechdrs, secstrings, ".barebox_cmd"); cmdindex = find_sec(ehdr, sechdrs, secstrings, ".barebox_cmd");
if (cmdindex) { if (cmdindex) {
cmd_tbl_t *cmd = (cmd_tbl_t *)sechdrs[cmdindex].sh_addr; struct command *cmd =(struct command *)sechdrs[cmdindex].sh_addr;
for (i = 0; i < sechdrs[cmdindex].sh_size / sizeof(cmd_tbl_t); i++) { for (i = 0; i < sechdrs[cmdindex].sh_size / sizeof(struct command); i++) {
register_command(cmd); register_command(cmd);
cmd++; cmd++;
} }

View File

@ -1129,7 +1129,7 @@ void __nand_boot_init imx_nand_load_image(void *dest, int size)
#ifdef CONFIG_NAND_IMX_BOOT_DEBUG #ifdef CONFIG_NAND_IMX_BOOT_DEBUG
#include <command.h> #include <command.h>
static int do_nand_boot_test(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_nand_boot_test(struct command *cmdtp, int argc, char *argv[])
{ {
void *dest; void *dest;
int size; int size;

View File

@ -484,7 +484,7 @@ void __nand_boot_init s3c24x0_nand_load_image(void *dest, int size, int page, in
#ifdef CONFIG_NAND_S3C24XX_BOOT_DEBUG #ifdef CONFIG_NAND_S3C24XX_BOOT_DEBUG
#include <command.h> #include <command.h>
static int do_nand_boot_test(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_nand_boot_test(struct command *cmdtp, int argc, char *argv[])
{ {
void *dest; void *dest;
int size, pagesize; int size, pagesize;

View File

@ -470,7 +470,7 @@ fail_out:
} }
#include <command.h> #include <command.h>
static int do_mycdev (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_mycdev(struct command *cmdtp, int argc, char *argv[])
{ {
int i,j; int i,j;

View File

@ -478,7 +478,7 @@ static int __usb_init(void)
return 0; return 0;
} }
static int do_usb(cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_usb(struct command *cmdtp, int argc, char *argv[])
{ {
__usb_init(); __usb_init();

View File

@ -42,12 +42,11 @@ extern struct list_head command_list;
/* /*
* Monitor Command Table * Monitor Command Table
*/ */
struct command {
struct cmd_tbl_s {
const char *name; /* Command Name */ const char *name; /* Command Name */
const char **aliases; const char **aliases;
/* Implementation function */ /* Implementation function */
int (*cmd)(struct cmd_tbl_s *, int, char *[]); int (*cmd)(struct command *, int, char *[]);
const char *usage; /* Usage message (short) */ const char *usage; /* Usage message (short) */
struct list_head list; /* List of commands */ struct list_head list; /* List of commands */
@ -61,17 +60,14 @@ __attribute__((aligned(64)))
#endif #endif
; ;
extern struct command __barebox_cmd_start;
typedef struct cmd_tbl_s cmd_tbl_t; extern struct command __barebox_cmd_end;
extern cmd_tbl_t __barebox_cmd_start;
extern cmd_tbl_t __barebox_cmd_end;
/* common/command.c */ /* common/command.c */
cmd_tbl_t *find_cmd(const char *cmd); struct command *find_cmd(const char *cmd);
int execute_command(int argc, char **argv); int execute_command(int argc, char **argv);
void barebox_cmd_usage(cmd_tbl_t *cmdtp); void barebox_cmd_usage(struct command *cmdtp);
#define COMMAND_SUCCESS 0 #define COMMAND_SUCCESS 0
#define COMMAND_ERROR 1 #define COMMAND_ERROR 1
@ -86,7 +82,7 @@ void barebox_cmd_usage(cmd_tbl_t *cmdtp);
#define Struct_Section __attribute__ ((unused,section (".barebox_cmd"))) #define Struct_Section __attribute__ ((unused,section (".barebox_cmd")))
#define BAREBOX_CMD_START(_name) \ #define BAREBOX_CMD_START(_name) \
const cmd_tbl_t __barebox_cmd_##_name \ const struct command __barebox_cmd_##_name \
__attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) = { \ __attribute__ ((unused,section (".barebox_cmd_" __stringify(_name)))) = { \
.name = #_name, .name = #_name,
@ -99,6 +95,6 @@ const cmd_tbl_t __barebox_cmd_##_name \
#define BAREBOX_CMD_HELP(text) #define BAREBOX_CMD_HELP(text)
#endif #endif
int register_command(cmd_tbl_t *); int register_command(struct command *);
#endif /* __COMMAND_H */ #endif /* __COMMAND_H */

View File

@ -280,7 +280,7 @@ void devices_shutdown(void)
#ifdef CONFIG_CMD_DEVINFO #ifdef CONFIG_CMD_DEVINFO
static int do_devinfo ( cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
{ {
struct device_d *dev; struct device_d *dev;
struct driver_d *drv; struct driver_d *drv;

View File

@ -589,7 +589,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
} }
static int do_dhcp (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_dhcp(struct command *cmdtp, int argc, char *argv[])
{ {
int size; int size;

View File

@ -706,7 +706,7 @@ NfsStart (char *p)
NfsSend (); NfsSend ();
} }
static int do_nfs (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_nfs(struct command *cmdtp, int argc, char *argv[])
{ {
int rcode = 0; int rcode = 0;
char *localfile; char *localfile;

View File

@ -81,7 +81,7 @@ PingHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
NetState = NETLOOP_SUCCESS; NetState = NETLOOP_SUCCESS;
} }
int do_ping (cmd_tbl_t *cmdtp, int argc, char *argv[]) int do_ping(struct command *cmdtp, int argc, char *argv[])
{ {
if (argc < 2 || string_to_ip(argv[1], &NetPingIP)) if (argc < 2 || string_to_ip(argv[1], &NetPingIP))
return COMMAND_ERROR_USAGE; return COMMAND_ERROR_USAGE;

View File

@ -256,7 +256,7 @@ void TftpStart(char *filename)
TftpSend(); TftpSend();
} }
static int do_tftpb (cmd_tbl_t *cmdtp, int argc, char *argv[]) static int do_tftpb(struct command *cmdtp, int argc, char *argv[])
{ {
int rcode = 0; int rcode = 0;
char *localfile; char *localfile;