diff options
author | Chris Johns <chrisj@rtems.org> | 2007-12-17 00:12:01 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2007-12-17 00:12:01 +0000 |
commit | 2eeb648c35eef0a378470f3cca523963978ffd09 (patch) | |
tree | 1c9ad13fdbf0117c6c953979da82cad8daf48d76 | |
parent | 2007-12-16 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-2eeb648c35eef0a378470f3cca523963978ffd09.tar.bz2 |
2007-12-17 Chris Johns <chrisj@rtems.org>
* libnetworking/rtems/tftp.h: Provide a decl to the TFTP file
system opts table.
* libnetworking/rtems/ftpfs.h: Provide a decl to the FTP file
system opts table.
* libmisc/Makefile.am: Add the mount command and supporting files.
* libmisc/preinstall.am: Rebuilt.
* libmisc/shell/cat_file.c, libmisc/shell/cmds.c,
libmisc/shell/main_alias.c, libmisc/shell/main_cat.c,
libmisc/shell/main_cd.c, libmisc/shell/main_chdir.c,
libmisc/shell/main_chmod.c, libmisc/shell/main_chroot.c,
libmisc/shell/main_cpuuse.c, libmisc/shell/main_date.c,
libmisc/shell/main_dir.c, libmisc/shell/main_exit.c,
libmisc/shell/main_help.c, libmisc/shell/main_id.c,
libmisc/shell/main_logoff.c, libmisc/shell/main_ls.c,
libmisc/shell/main_mallocdump.c, libmisc/shell/main_mdump.c,
libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c,
libmisc/shell/main_mkdir.c, libmisc/shell/main_mmove.c,
libmisc/shell/main_mwdump.c, libmisc/shell/main_pwd.c,
libmisc/shell/main_rm.c, libmisc/shell/main_rmdir.c,
libmisc/shell/main_stackuse.c, libmisc/shell/main_tty.c,
libmisc/shell/main_umask.c, libmisc/shell/main_whoami.c,
libmisc/shell/shell.c, libmisc/shell/shell_cmdset.c,
libmisc/shell/shell_makeargs.c, libmisc/shell/str2int.c,
libmisc/shell/write_file.c: Move all shell_* types, variables and
functions to rtems_shell_* to avoid namespace clashes with
applications. The is an RTEMS shell after all.
* libmisc/shell/shell.h, libmisc/shell/internal.h,
libmisc/shell/shellconfig.h: Move all shell_* types, variables and
functions to rtems_shell_* to avoid namespace clashes with
applications. Add the mount command supporting types.
* libmisc/shell/main_mount.c, libmisc/shell/main_mount_ftp.c,
libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_nfs.c,
libmisc/shell/main_mount_tftp.c: New.
48 files changed, 873 insertions, 507 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 831087b3a0..b159d589d3 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,39 @@ +2007-12-17 Chris Johns <chrisj@rtems.org> + + * libnetworking/rtems/tftp.h: Provide a decl to the TFTP file + system opts table. + * libnetworking/rtems/ftpfs.h: Provide a decl to the FTP file + system opts table. + * libmisc/Makefile.am: Add the mount command and supporting files. + * libmisc/preinstall.am: Rebuilt. + * libmisc/shell/cat_file.c, libmisc/shell/cmds.c, + libmisc/shell/main_alias.c, libmisc/shell/main_cat.c, + libmisc/shell/main_cd.c, libmisc/shell/main_chdir.c, + libmisc/shell/main_chmod.c, libmisc/shell/main_chroot.c, + libmisc/shell/main_cpuuse.c, libmisc/shell/main_date.c, + libmisc/shell/main_dir.c, libmisc/shell/main_exit.c, + libmisc/shell/main_help.c, libmisc/shell/main_id.c, + libmisc/shell/main_logoff.c, libmisc/shell/main_ls.c, + libmisc/shell/main_mallocdump.c, libmisc/shell/main_mdump.c, + libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c, + libmisc/shell/main_mkdir.c, libmisc/shell/main_mmove.c, + libmisc/shell/main_mwdump.c, libmisc/shell/main_pwd.c, + libmisc/shell/main_rm.c, libmisc/shell/main_rmdir.c, + libmisc/shell/main_stackuse.c, libmisc/shell/main_tty.c, + libmisc/shell/main_umask.c, libmisc/shell/main_whoami.c, + libmisc/shell/shell.c, libmisc/shell/shell_cmdset.c, + libmisc/shell/shell_makeargs.c, libmisc/shell/str2int.c, + libmisc/shell/write_file.c: Move all shell_* types, variables and + functions to rtems_shell_* to avoid namespace clashes with + applications. The is an RTEMS shell after all. + * libmisc/shell/shell.h, libmisc/shell/internal.h, + libmisc/shell/shellconfig.h: Move all shell_* types, variables and + functions to rtems_shell_* to avoid namespace clashes with + applications. Add the mount command supporting types. + * libmisc/shell/main_mount.c, libmisc/shell/main_mount_ftp.c, + libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_nfs.c, + libmisc/shell/main_mount_tftp.c: New. + 2007-12-16 Ralf Corsépius <ralf.corsepius@rtems.org> * configure.ac: Revert Joel's 2007-06-13 NDEBUG patch. diff --git a/cpukit/libmisc/Makefile.am b/cpukit/libmisc/Makefile.am index bb9f4f5662..b8eba903d5 100644 --- a/cpukit/libmisc/Makefile.am +++ b/cpukit/libmisc/Makefile.am @@ -64,6 +64,10 @@ libmw_fb_a_SOURCES = mw-fb/mw_fb.c mw-fb/mw_uid.c mw-fb/mw_fb.h \ if LIBSHELL noinst_LIBRARIES += libshell.a +if LIBNETWORKING +shell_mount_fs = shell/main_mount_ftp.c shell/main_mount_nfs.c \ + shell/main_mount_tftp.c +endif libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \ shell/main_alias.c shell/main_cat.c shell/main_cd.c \ shell/main_chdir.c shell/main_chmod.c shell/main_chroot.c \ @@ -71,10 +75,11 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \ shell/main_exit.c shell/main_help.c shell/main_id.c \ shell/main_logoff.c shell/main_ls.c shell/main_mallocdump.c \ shell/main_mdump.c shell/main_medit.c shell/main_mfill.c \ - shell/main_mkdir.c shell/main_mmove.c shell/main_mwdump.c \ - shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c shell/main_stackuse.c \ - shell/main_tty.c shell/main_umask.c shell/main_whoami.c \ - shell/shell.c shell/shell_cmdset.c shell/shellconfig.c \ + shell/main_mkdir.c shell/main_mount.c $(shell_mount_fs) \ + shell/main_mount_msdos.c shell/main_mmove.c shell/main_mwdump.c \ + shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c \ + shell/main_stackuse.c shell/main_tty.c shell/main_umask.c \ + shell/main_whoami.c shell/shell.c shell/shell_cmdset.c shell/shellconfig.c \ shell/shellconfig.h shell/shell.h shell/shell_makeargs.c \ shell/str2int.c shell/write_file.c endif diff --git a/cpukit/libmisc/preinstall.am b/cpukit/libmisc/preinstall.am index dba6cc4d81..f6a7e763d2 100644 --- a/cpukit/libmisc/preinstall.am +++ b/cpukit/libmisc/preinstall.am @@ -5,3 +5,5 @@ $(srcdir)/preinstall.am: Makefile.am $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am endif +if LIBSHELL +endif diff --git a/cpukit/libmisc/shell/cat_file.c b/cpukit/libmisc/shell/cat_file.c index 5bb7ffbee1..9fe683021e 100644 --- a/cpukit/libmisc/shell/cat_file.c +++ b/cpukit/libmisc/shell/cat_file.c @@ -18,7 +18,7 @@ #include <stdio.h> -void cat_file(FILE * out,char * name) { +void rtems_shell_cat_file(FILE * out,char * name) { FILE * fd; int c; diff --git a/cpukit/libmisc/shell/cmds.c b/cpukit/libmisc/shell/cmds.c index d40839ad1e..8a351bb00c 100644 --- a/cpukit/libmisc/shell/cmds.c +++ b/cpukit/libmisc/shell/cmds.c @@ -28,7 +28,7 @@ * with this you can call at all the rtems monitor commands. * Not all work fine but you can show the rtems status and more. *-----------------------------------------------------------*/ -int main_monitor(int argc,char * argv[]) { +int rtems_shell_main_monitor(int argc,char * argv[]) { rtems_monitor_command_entry_t *command; if ((command=rtems_monitor_command_lookup(rtems_monitor_commands,argc,argv))) @@ -37,15 +37,15 @@ int main_monitor(int argc,char * argv[]) { return 0; } -void shell_register_monitor_commands(void) +void rtems_shell_register_monitor_commands(void) { rtems_monitor_command_entry_t *command; /* monitor topic */ command = rtems_monitor_commands; while (command) { if (strcmp("exit",command->command)) /* Exclude EXIT (alias quit)*/ - shell_add_cmd(command->command,"monitor", - command->usage ,main_monitor); + rtems_shell_add_cmd(command->command,"monitor", + command->usage,rtems_shell_main_monitor); command = command->next; } } diff --git a/cpukit/libmisc/shell/internal.h b/cpukit/libmisc/shell/internal.h index c33909c619..1e4a4c88da 100644 --- a/cpukit/libmisc/shell/internal.h +++ b/cpukit/libmisc/shell/internal.h @@ -15,22 +15,27 @@ #include "config.h" #endif -struct shell_topic_tt; -typedef struct shell_topic_tt shell_topic_t; +struct rtems_shell_topic_tt; +typedef struct rtems_shell_topic_tt rtems_shell_topic_t; -struct shell_topic_tt { - char *topic; - shell_topic_t *next; +struct rtems_shell_topic_tt { + char *topic; + rtems_shell_topic_t *next; }; -extern shell_cmd_t * shell_first_cmd; -extern shell_topic_t * shell_first_topic; +extern rtems_shell_cmd_t * rtems_shell_first_cmd; +extern rtems_shell_topic_t * rtems_shell_first_topic; -shell_topic_t * shell_lookup_topic(char * topic); +rtems_shell_topic_t * rtems_shell_lookup_topic(char * topic); -void shell_register_monitor_commands(void); -void shell_initialize_command_set(void); +void rtems_shell_register_monitor_commands(void); +void rtems_shell_initialize_command_set(void); + +int rtems_shell_libc_mounter (const char* driver, + const char* path, + rtems_shell_filesystems_t* fs, + rtems_filesystem_options_t options); #endif diff --git a/cpukit/libmisc/shell/main_alias.c b/cpukit/libmisc/shell/main_alias.c index e1efce84b5..292daf89c5 100644 --- a/cpukit/libmisc/shell/main_alias.c +++ b/cpukit/libmisc/shell/main_alias.c @@ -22,24 +22,24 @@ #include <rtems/shell.h> #include "internal.h" -int main_alias(int argc, char **argv) +int rtems_shell_rtems_main_alias(int argc, char **argv) { if (argc<3) { fprintf(stdout,"too few arguments\n"); return 1; } - if (!shell_alias_cmd(argv[1],argv[2])) { + if (!rtems_shell_alias_cmd(argv[1],argv[2])) { fprintf(stdout,"unable to make an alias(%s,%s)\n",argv[1],argv[2]); } return 0; } -shell_cmd_t Shell_ALIAS_Command = { +rtems_shell_cmd_t rtems_Shell_ALIAS_Command = { "alias", /* name */ "alias old new", /* usage */ "misc", /* topic */ - main_alias, /* command */ + rtems_shell_rtems_main_alias, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_cat.c b/cpukit/libmisc/shell/main_cat.c index 58e8de9c55..3913986744 100644 --- a/cpukit/libmisc/shell/main_cat.c +++ b/cpukit/libmisc/shell/main_cat.c @@ -35,21 +35,21 @@ #include <rtems/shell.h> #include "internal.h" -int main_cat(int argc, char *argv[]) +int rtems_shell_main_cat(int argc, char *argv[]) { int n; n=1; while (n<argc) - cat_file(stdout,argv[n++]); + rtems_shell_cat_file(stdout,argv[n++]); return 0; } -shell_cmd_t Shell_CAT_Command = { +rtems_shell_cmd_t rtems_Shell_CAT_Command = { "cat", /* name */ "cat n1 [n2 [n3...]] # show the ascii contents", /* usage */ "files", /* topic */ - main_cat , /* command */ + rtems_shell_main_cat , /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_cd.c b/cpukit/libmisc/shell/main_cd.c index 31a7cfb075..561d6258ea 100644 --- a/cpukit/libmisc/shell/main_cd.c +++ b/cpukit/libmisc/shell/main_cd.c @@ -20,7 +20,7 @@ #include <rtems/shell.h> #include "internal.h" -shell_alias_t Shell_CD_Alias = { +rtems_shell_alias_t rtems_Shell_CD_Alias = { "chdir", /* command */ "cd" /* alias */ }; diff --git a/cpukit/libmisc/shell/main_chdir.c b/cpukit/libmisc/shell/main_chdir.c index 64be1dd67c..0cddb9a415 100644 --- a/cpukit/libmisc/shell/main_chdir.c +++ b/cpukit/libmisc/shell/main_chdir.c @@ -25,7 +25,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_chdir (int argc, char *argv[]) { +int rtems_shell_main_chdir (int argc, char *argv[]) { char *dir; dir = "/"; @@ -40,11 +40,11 @@ int main_chdir (int argc, char *argv[]) { return 0; } -shell_cmd_t Shell_CHDIR_Command = { +rtems_shell_cmd_t rtems_Shell_CHDIR_Command = { "chdir", /* name */ "chdir [dir] # change the current directory", /* usage */ "files", /* topic */ - main_chdir, /* command */ + rtems_shell_main_chdir, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_chmod.c b/cpukit/libmisc/shell/main_chmod.c index c3d0c5aade..4785b49a6e 100644 --- a/cpukit/libmisc/shell/main_chmod.c +++ b/cpukit/libmisc/shell/main_chmod.c @@ -28,13 +28,13 @@ #include <rtems/shell.h> #include "internal.h" -int main_chmod(int argc,char *argv[]) +int rtems_shell_main_chmod(int argc,char *argv[]) { int n; mode_t mode; if (argc > 2){ - mode = str2int(argv[1])&0777; + mode = rtems_shell_str2int(argv[1])&0777; n = 2; while (n<argc) chmod(argv[n++], mode); @@ -42,11 +42,11 @@ int main_chmod(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_CHMOD_Command = { +rtems_shell_cmd_t rtems_Shell_CHMOD_Command = { "chmod", /* name */ "chmod 0777 n1 n2... # change filemode", /* usage */ "files", /* topic */ - main_chmod, /* command */ + rtems_shell_main_chmod, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_chroot.c b/cpukit/libmisc/shell/main_chroot.c index e22e694ff0..a4febbedbe 100644 --- a/cpukit/libmisc/shell/main_chroot.c +++ b/cpukit/libmisc/shell/main_chroot.c @@ -25,7 +25,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_chroot(int argc,char * argv[]) { +int rtems_shell_main_chroot(int argc,char * argv[]) { char *new_root="/"; if (argc==2) @@ -39,11 +39,11 @@ int main_chroot(int argc,char * argv[]) { return 0; } -shell_cmd_t Shell_CHROOT_Command = { +rtems_shell_cmd_t rtems_Shell_CHROOT_Command = { "chroot", /* name */ "chroot [dir] # change the root directory", /* usage */ "files", /* topic */ - main_chroot, /* command */ + rtems_shell_main_chroot, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_cpuuse.c b/cpukit/libmisc/shell/main_cpuuse.c index f70ccbbb21..69dc5a2b5f 100644 --- a/cpukit/libmisc/shell/main_cpuuse.c +++ b/cpukit/libmisc/shell/main_cpuuse.c @@ -22,7 +22,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_cpuuse(int argc,char *argv[]) +int rtems_shell_main_cpuuse(int argc,char *argv[]) { if ( argc >= 1 && !strcmp( argv[1], "-r" ) ) { printf( "Resetting CPU Usage information\n" ); @@ -32,11 +32,11 @@ int main_cpuuse(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_CPUUSE_Command = { +rtems_shell_cmd_t rtems_Shell_CPUUSE_Command = { "cpuuse", /* name */ "[-r] print or reset per thread cpu usage", /* usage */ "rtems", /* topic */ - main_cpuuse, /* command */ + rtems_shell_main_cpuuse, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_date.c b/cpukit/libmisc/shell/main_date.c index 7f6fdbb52b..7d2fc34317 100644 --- a/cpukit/libmisc/shell/main_date.c +++ b/cpukit/libmisc/shell/main_date.c @@ -25,7 +25,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_date(int argc,char *argv[]) +int rtems_shell_main_date(int argc,char *argv[]) { time_t t; @@ -34,11 +34,11 @@ int main_date(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_DATE_Command = { +rtems_shell_cmd_t rtems_Shell_DATE_Command = { "date", /* name */ "date", /* usage */ "misc", /* topic */ - main_date, /* command */ + rtems_shell_main_date, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_dir.c b/cpukit/libmisc/shell/main_dir.c index a41de05fb1..f987cea1b7 100644 --- a/cpukit/libmisc/shell/main_dir.c +++ b/cpukit/libmisc/shell/main_dir.c @@ -20,7 +20,7 @@ #include <rtems/shell.h> #include "internal.h" -shell_alias_t Shell_DIR_Alias = { +rtems_shell_alias_t rtems_Shell_DIR_Alias = { "ls", /* command */ "dir" /* alias */ }; diff --git a/cpukit/libmisc/shell/main_exit.c b/cpukit/libmisc/shell/main_exit.c index 29225e0a11..8860729f7a 100644 --- a/cpukit/libmisc/shell/main_exit.c +++ b/cpukit/libmisc/shell/main_exit.c @@ -20,7 +20,7 @@ #include <rtems/shell.h> #include "internal.h" -shell_alias_t Shell_EXIT_Alias = { +rtems_shell_alias_t rtems_Shell_EXIT_Alias = { "logoff", /* command */ "exit" /* alias */ }; diff --git a/cpukit/libmisc/shell/main_help.c b/cpukit/libmisc/shell/main_help.c index 964b511b2b..299fbf6149 100644 --- a/cpukit/libmisc/shell/main_help.c +++ b/cpukit/libmisc/shell/main_help.c @@ -27,7 +27,7 @@ /* * show the help for one command. */ -int shell_help_cmd(shell_cmd_t * shell_cmd) { +int rtems_shell_help_cmd(rtems_shell_cmd_t * shell_cmd) { char * pc; int col,line; @@ -73,19 +73,19 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) { * Can you see the header of routine? Known? * The same with all the commands.... */ -int shell_help( +int rtems_shell_help( int argc, char * argv[] ) { int col,line,arg; - shell_topic_t *topic; - shell_cmd_t * shell_cmd = shell_first_cmd; + rtems_shell_topic_t *topic; + rtems_shell_cmd_t * shell_cmd = rtems_shell_first_cmd; if (argc<2) { printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n" " TOPIC? The topics are\n"); - topic = shell_first_topic; + topic = rtems_shell_first_topic; col = 0; while (topic) { if (!col){ @@ -110,14 +110,14 @@ int shell_help( printf("\n"); line = 0; } - topic = shell_lookup_topic(argv[arg]); + topic = rtems_shell_lookup_topic(argv[arg]); if (!topic){ - if ((shell_cmd = shell_lookup_cmd(argv[arg])) == NULL) { + if ((shell_cmd = rtems_shell_lookup_cmd(argv[arg])) == NULL) { printf("help: topic or cmd '%s' not found. Try <help> alone for a list\n", argv[arg]); line++; } else { - line+= shell_help_cmd(shell_cmd); + line+= rtems_shell_help_cmd(shell_cmd); } continue; } @@ -125,7 +125,7 @@ int shell_help( line++; while (shell_cmd) { if (!strcmp(topic->topic,shell_cmd->topic)) - line+= shell_help_cmd(shell_cmd); + line+= rtems_shell_help_cmd(shell_cmd); if (line>16) { printf("Press any key to continue..."); getchar(); @@ -139,11 +139,11 @@ int shell_help( return 0; } -shell_cmd_t Shell_HELP_Command = { +rtems_shell_cmd_t rtems_Shell_HELP_Command = { "help", /* name */ "help [topic] # list of usage of commands", /* usage */ "help", /* topic */ - shell_help, /* command */ + rtems_shell_help, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_id.c b/cpukit/libmisc/shell/main_id.c index a8bbdd7d45..0c4828a838 100644 --- a/cpukit/libmisc/shell/main_id.c +++ b/cpukit/libmisc/shell/main_id.c @@ -28,7 +28,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_id(int argc,char *argv[]) +int rtems_shell_main_id(int argc,char *argv[]) { struct passwd *pwd; struct group *grp; @@ -54,11 +54,11 @@ int main_id(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_ID_Command = { +rtems_shell_cmd_t rtems_Shell_ID_Command = { "id", /* name */ "show uid, gid, euid, and egid", /* usage */ "misc", /* topic */ - main_id , /* command */ + rtems_shell_main_id, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_logoff.c b/cpukit/libmisc/shell/main_logoff.c index 5653f7114b..5072fb7939 100644 --- a/cpukit/libmisc/shell/main_logoff.c +++ b/cpukit/libmisc/shell/main_logoff.c @@ -23,20 +23,20 @@ #include "internal.h" /*-----------------------------------------------------------*/ -int main_logoff(int argc,char *argv[]) +int rtems_shell_main_logoff(int argc,char *argv[]) { printf("logoff from the system..."); - current_shell_env->exit_shell=TRUE; + rtems_current_shell_env->exit_shell=TRUE; return 0; } -shell_cmd_t Shell_LOGOFF_Command = { +rtems_shell_cmd_t rtems_Shell_LOGOFF_Command = { "logoff", /* name */ "logoff from the system", /* usage */ "misc", /* topic */ - main_logoff, /* command */ + rtems_shell_main_logoff, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_ls.c b/cpukit/libmisc/shell/main_ls.c index 9dd9dff323..9ca3a6e3f3 100644 --- a/cpukit/libmisc/shell/main_ls.c +++ b/cpukit/libmisc/shell/main_ls.c @@ -35,7 +35,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_ls(int argc, char *argv[]) +int rtems_shell_main_ls(int argc, char *argv[]) { char *fname; DIR *dirp; @@ -98,11 +98,11 @@ int main_ls(int argc, char *argv[]) return 0; } -shell_cmd_t Shell_LS_Command = { +rtems_shell_cmd_t rtems_Shell_LS_Command = { "ls", /* name */ "ls [dir] # list files in the directory", /* usage */ "files", /* topic */ - main_ls , /* command */ + rtems_shell_main_ls, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_mallocdump.c b/cpukit/libmisc/shell/main_mallocdump.c index e8050bc247..44411770f3 100644 --- a/cpukit/libmisc/shell/main_mallocdump.c +++ b/cpukit/libmisc/shell/main_mallocdump.c @@ -21,19 +21,21 @@ #include "internal.h" /*----------------------------------------------------------------------------*/ -int main_malloc_dump(int argc,char * argv[]) { +int rtems_shell_main_malloc_dump(int argc,char * argv[]) { #ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */ void malloc_dump(void); malloc_dump(); + #else + fprintf(stdout, "No malloc dump built into RTEMS\n"); #endif return 0; } -shell_cmd_t Shell_MALLOC_DUMP_Command = { +rtems_shell_cmd_t rtems_Shell_MALLOC_DUMP_Command = { "malloc", /* name */ "mem show memory malloc'ed", /* usage */ "mem", /* topic */ - main_malloc_dump, /* command */ + rtems_shell_main_malloc_dump, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_mdump.c b/cpukit/libmisc/shell/main_mdump.c index efb57303fc..bc7cd816f8 100644 --- a/cpukit/libmisc/shell/main_mdump.c +++ b/cpukit/libmisc/shell/main_mdump.c @@ -28,16 +28,16 @@ * RAM MEMORY COMMANDS *----------------------------------------------------------------------------*/ -int main_mdump(int argc,char * argv[]) { +int rtems_shell_main_mdump(int argc,char * argv[]) { unsigned char n,m,max=0; uintptr_t addr; unsigned char *pb; - addr = current_shell_env->mdump_addr; + addr = rtems_current_shell_env->mdump_addr; if (argc>1) - addr = str2int(argv[1]); + addr = rtems_shell_str2int(argv[1]); if (argc>2) - max = str2int(argv[2]); + max = rtems_shell_str2int(argv[2]); max /= 16; @@ -45,7 +45,7 @@ int main_mdump(int argc,char * argv[]) { max = 20; for (m=0;m<max;m++) { - fprintf(stdout,"0x%08X ",addr); + fprintf(stdout,"0x%08lX ",addr); pb = (unsigned char*) addr; for (n=0;n<16;n++) fprintf(stdout,"%02X%c",pb[n],n==7?'-':' '); @@ -55,140 +55,16 @@ int main_mdump(int argc,char * argv[]) { fprintf(stdout,"\n"); addr += 16; } - current_shell_env->mdump_addr = addr; + rtems_current_shell_env->mdump_addr = addr; return 0; } -shell_cmd_t Shell_MDUMP_Command = { +rtems_shell_cmd_t rtems_Shell_MDUMP_Command = { "mdump", /* name */ "mdump [addr [size]]", /* usage */ "mem", /* topic */ - main_mdump, /* command */ + rtems_shell_main_mdump, /* command */ NULL, /* alias */ NULL /* next */ }; - -/*----------------------------------------------------------------------------*/ -int main_mwdump(int argc,char * argv[]) { - unsigned char n,m,max=0; - int addr=current_shell_env->mdump_addr; - unsigned short * pw; - - if (argc>1) - addr = str2int(argv[1]); - if (argc>2) - max = str2int(argv[2]); - - max /= 16; - - if (!max) - max = 20; - - for (m=0;m<max;m++) { - fprintf(stdout,"0x%08X ",addr); - pw = (unsigned short*) addr; - for (n=0;n<8;n++) - fprintf(stdout,"%02X %02X%c",pw[n]/0x100,pw[n]%0x100,n==3?'-':' '); - for (n=0;n<8;n++) { - fprintf(stdout,"%c",isprint(pw[n]/0x100)?pw[n]/0x100:'.'); - fprintf(stdout,"%c",isprint(pw[n]%0x100)?pw[n]%0x100:'.'); - } - fprintf(stdout,"\n"); - addr += 16; - } - current_shell_env->mdump_addr = addr; - return 0; -} - -shell_cmd_t Shell_WDUMP_Command = { - "wdump", /* name */ - "wdump [addr [size]]", /* usage */ - "mem", /* topic */ - main_mwdump, /* command */ - NULL, /* alias */ - NULL /* next */ -}; - -/*----------------------------------------------------------------------------*/ -int main_medit(int argc,char * argv[]) { - unsigned char * pb; - int n,i; - - if (argc<3) { - fprintf(stdout,"too few arguments\n"); - return 0; - } - - pb = (unsigned char*)str2int(argv[1]); - i = 2; - n = 0; - while (i<=argc) { - pb[n++] = str2int(argv[i++])%0x100; - } - current_shell_env->mdump_addr = (int)pb; - return main_mdump(0,NULL); -} - -shell_cmd_t Shell_MEDIT_Command = { - "medit", /* name */ - "medit addr value [value ...]", /* usage */ - "mem", /* topic */ - main_medit, /* command */ - NULL, /* alias */ - NULL /* next */ -}; - -/*----------------------------------------------------------------------------*/ -int main_mfill(int argc,char * argv[]) { - int addr; - int size; - unsigned char value; - - if (argc<4) { - fprintf(stdout,"too few arguments\n"); - return 0; - } - addr = str2int(argv[1]); - size = str2int(argv[2]); - value= str2int(argv[3]) % 0x100; - memset((unsigned char*)addr,size,value); - current_shell_env->mdump_addr = addr; - return main_mdump(0,NULL); -} - -shell_cmd_t Shell_MFILL_Command = { - "mfill", /* name */ - "mfill addr size value", /* usage */ - "mem", /* topic */ - main_mfill, /* command */ - NULL, /* alias */ - NULL /* next */ -}; - -/*----------------------------------------------------------------------------*/ -int main_mmove(int argc,char * argv[]) { - int src; - int dst; - int size; - - if (argc<4) { - fprintf(stdout,"too few arguments\n"); - return 0; - } - dst = str2int(argv[1]); - src = str2int(argv[2]); - size = str2int(argv[3]); - memcpy((unsigned char*)dst,(unsigned char*)src,size); - current_shell_env->mdump_addr = dst; - return main_mdump(0,NULL); -} - -shell_cmd_t Shell_MMOVE_Command = { - "mmove", /* name */ - "mmove dst src size", /* usage */ - "mem", /* topic */ - main_mmove, /* command */ - NULL, /* alias */ - NULL /* next */ -}; diff --git a/cpukit/libmisc/shell/main_medit.c b/cpukit/libmisc/shell/main_medit.c index ba59d0d8d8..da58fa630b 100644 --- a/cpukit/libmisc/shell/main_medit.c +++ b/cpukit/libmisc/shell/main_medit.c @@ -24,9 +24,9 @@ #include <rtems/shell.h> #include "internal.h" -extern int main_mdump(int, char *); +extern int rtems_shell_main_mdump(int, char *); -int main_medit(int argc,char * argv[]) { +int rtems_shell_main_medit(int argc,char * argv[]) { unsigned char * pb; int n,i; @@ -35,22 +35,22 @@ int main_medit(int argc,char * argv[]) { return 0; } - pb = (unsigned char*)str2int(argv[1]); + pb = (unsigned char*)rtems_shell_str2int(argv[1]); i = 2; n = 0; while (i<=argc) { - pb[n++] = str2int(argv[i++])%0x100; + pb[n++] = rtems_shell_str2int(argv[i++])%0x100; } - current_shell_env->mdump_addr = (int)pb; + rtems_current_shell_env->mdump_addr = (int)pb; - return main_mdump(0,NULL); + return rtems_shell_main_mdump(0,NULL); } -shell_cmd_t Shell_MEDIT_Command = { +rtems_shell_cmd_t rtems_Shell_MEDIT_Command = { "medit", /* name */ "medit addr value [value ...]", /* usage */ "mem", /* topic */ - main_medit, /* command */ + rtems_shell_main_medit, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_mfill.c b/cpukit/libmisc/shell/main_mfill.c index 4a8f3a4b3c..5d61450e28 100644 --- a/cpukit/libmisc/shell/main_mfill.c +++ b/cpukit/libmisc/shell/main_mfill.c @@ -24,9 +24,9 @@ #include <rtems/shell.h> #include "internal.h" -extern int main_mdump(int, char *); +extern int rtems_shell_main_mdump(int, char *); -int main_mfill(int argc,char * argv[]) { +int rtems_shell_main_mfill(int argc,char * argv[]) { uintptr_t addr; size_t size; unsigned char value; @@ -36,20 +36,20 @@ int main_mfill(int argc,char * argv[]) { return 0; } - addr = str2int(argv[1]); - size = str2int(argv[2]); - value= str2int(argv[3]) % 0x100; + addr = rtems_shell_str2int(argv[1]); + size = rtems_shell_str2int(argv[2]); + value= rtems_shell_str2int(argv[3]) % 0x100; memset((unsigned char*)addr,size,value); - current_shell_env->mdump_addr = addr; + rtems_current_shell_env->mdump_addr = addr; - return main_mdump(0,NULL); + return rtems_shell_main_mdump(0,NULL); } -shell_cmd_t Shell_MFILL_Command = { +rtems_shell_cmd_t rtems_Shell_MFILL_Command = { "mfill", /* name */ "mfill addr size value", /* usage */ "mem", /* topic */ - main_mfill, /* command */ + rtems_shell_main_mfill, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_mkdir.c b/cpukit/libmisc/shell/main_mkdir.c index 5c9f365226..1d42ed103b 100644 --- a/cpukit/libmisc/shell/main_mkdir.c +++ b/cpukit/libmisc/shell/main_mkdir.c @@ -27,7 +27,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_mkdir(int argc, char *argv[]) { +int rtems_shell_main_mkdir(int argc, char *argv[]) { char *dir; int n; @@ -41,11 +41,11 @@ int main_mkdir(int argc, char *argv[]) { return errno; } -shell_cmd_t Shell_MKDIR_Command = { +rtems_shell_cmd_t rtems_Shell_MKDIR_Command = { "mkdir", /* name */ "mkdir dir # make a directory", /* usage */ "files", /* topic */ - main_mkdir, /* command */ + rtems_shell_main_mkdir, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_mmove.c b/cpukit/libmisc/shell/main_mmove.c index 522f6f69c3..2cc88b8a24 100644 --- a/cpukit/libmisc/shell/main_mmove.c +++ b/cpukit/libmisc/shell/main_mmove.c @@ -24,9 +24,9 @@ #include <rtems/shell.h> #include "internal.h" -extern int main_mdump(int, char *); +extern int rtems_shell_main_mdump(int, char *); -int main_mmove(int argc,char * argv[]) { +int rtems_shell_main_mmove(int argc,char * argv[]) { uintptr_t src; uintptr_t dst; size_t size; @@ -36,20 +36,20 @@ int main_mmove(int argc,char * argv[]) { return 0; } - dst = str2int(argv[1]); - src = str2int(argv[2]); - size = str2int(argv[3]); + dst = rtems_shell_str2int(argv[1]); + src = rtems_shell_str2int(argv[2]); + size = rtems_shell_str2int(argv[3]); memcpy((unsigned char*)dst, (unsigned char*)src, size); - current_shell_env->mdump_addr = dst; + rtems_current_shell_env->mdump_addr = dst; - return main_mdump(0,NULL); + return rtems_shell_main_mdump(0,NULL); } -shell_cmd_t Shell_MMOVE_Command = { +rtems_shell_cmd_t rtems_Shell_MMOVE_Command = { "mmove", /* name */ "mmove dst src size", /* usage */ "mem", /* topic */ - main_mmove, /* command */ + rtems_shell_main_mmove, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_mount.c b/cpukit/libmisc/shell/main_mount.c new file mode 100644 index 0000000000..05cfdffd6b --- /dev/null +++ b/cpukit/libmisc/shell/main_mount.c @@ -0,0 +1,155 @@ +/* + * Shell Command Implmentation + * + * Author: Fernando RUIZ CASAS + * Work: fernando.ruiz@ctv.es + * Home: correo@fernando-ruiz.com + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <rtems.h> +#include <rtems/shell.h> +#include <rtems/shellconfig.h> +#include <rtems/dosfs.h> +#include <rtems/fsmount.h> +#include "internal.h" + +int rtems_shell_libc_mounter(const char* driver, + const char* path, + rtems_shell_filesystems_t* fs, + rtems_filesystem_options_t options) +{ + rtems_filesystem_mount_table_entry_t* mt_entry; + /* + * Mount the disk. + */ + + if (mount (&mt_entry, fs->fs_ops, options, (char*) driver, (char*) path) < 0) + { + printf ("error: mount failed: %s\n", strerror (errno)); + return 1; + } + + return 0; +} + +#define NUMOF(_i) (sizeof (_i) / sizeof (_i[0])) + +int rtems_shell_main_mount(int argc, char *argv[]) +{ + rtems_filesystem_options_t options = RTEMS_FILESYSTEM_READ_WRITE; + rtems_shell_filesystems_t* fs = NULL; + char* driver = NULL; + char* mount_point = NULL; + int arg; + + for (arg = 1; arg < argc; arg++) + { + if (argv[arg][0] == '-') + { + if (argv[arg][1] == 't') + { + rtems_shell_filesystems_t** a; + + arg++; + if (arg == argc) + { + fprintf (stdout, "error: -t needs a type of file-system;; see -L.\n"); + return 1; + } + + for (a = rtems_Shell_Mount_filesystems; *a; a++) + { + if (strcmp (argv[arg], (*a)->name) == 0) + { + fs = *a; + break; + } + } + } + else if (argv[arg][1] == 'r') + { + options = RTEMS_FILESYSTEM_READ_ONLY; + } + else if (argv[arg][1] == 'L') + { + rtems_shell_filesystems_t** a; + fprintf (stdout, "File systems: "); + for (a = rtems_Shell_Mount_filesystems; *a; a++) + if (*a) + fprintf (stdout, "%s ", (*a)->name); + fprintf (stdout, "\n"); + return 1; + } + else + { + fprintf (stdout, "unknown option: %s\n", argv[arg]); + return 1; + } + } + else + { + if (!driver) + driver = argv[arg]; + else if (!mount_point) + mount_point = argv[arg]; + else + { + printf ("error: driver and mount only require: %s\n", argv[arg]); + return 1; + } + } + } + + if (fs == NULL) + { + fprintf (stdout, "error: no file-system; see the -L option\n"); + return 1; + } + + if (fs->driver_needed && !driver) + { + fprintf (stdout, "error: no driver\n"); + return 1; + } + + if (!mount_point) + { + printf ("error: no mount point\n"); + return 1; + } + + /* + * Mount the disk. + */ + + if (fs->mounter (driver, mount_point, fs, options)) + return 1; + + printf ("mounted %s -> %s\n", driver, mount_point); + + return 0; +} + +rtems_shell_cmd_t rtems_Shell_MOUNT_Command = { + "mount", /* name */ + "mount [-t fstype] [-r] [-L] device path # mount disk", /* usage */ + "files", /* topic */ + rtems_shell_main_mount, /* command */ + NULL, /* alias */ + NULL /* next */ +}; diff --git a/cpukit/libmisc/shell/main_mount_ftp.c b/cpukit/libmisc/shell/main_mount_ftp.c new file mode 100644 index 0000000000..079f6e9996 --- /dev/null +++ b/cpukit/libmisc/shell/main_mount_ftp.c @@ -0,0 +1,37 @@ +/* + * Shell Command Implmentation + * + * Author: Fernando RUIZ CASAS + * Work: fernando.ruiz@ctv.es + * Home: correo@fernando-ruiz.com + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <rtems.h> +#include <rtems/shell.h> +#include <rtems/dosfs.h> +#include <rtems/fsmount.h> +#include "internal.h" + +#include <rtems/ftpfs.h> + +rtems_shell_filesystems_t rtems_Shell_Mount_FTP = { + name: "ftp", + driver_needed: 1, + fs_ops: &rtems_ftp_ops, + mounter: rtems_shell_libc_mounter +}; diff --git a/cpukit/libmisc/shell/main_mount_msdos.c b/cpukit/libmisc/shell/main_mount_msdos.c new file mode 100644 index 0000000000..973a352722 --- /dev/null +++ b/cpukit/libmisc/shell/main_mount_msdos.c @@ -0,0 +1,35 @@ +/* + * Shell Command Implmentation + * + * Author: Fernando RUIZ CASAS + * Work: fernando.ruiz@ctv.es + * Home: correo@fernando-ruiz.com + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <rtems.h> +#include <rtems/shell.h> +#include <rtems/dosfs.h> +#include <rtems/fsmount.h> +#include "internal.h" + +rtems_shell_filesystems_t rtems_Shell_Mount_MSDOS = { + name: "msdos", + driver_needed: 1, + fs_ops: &msdos_ops, + mounter: rtems_shell_libc_mounter +}; diff --git a/cpukit/libmisc/shell/main_mount_nfs.c b/cpukit/libmisc/shell/main_mount_nfs.c new file mode 100644 index 0000000000..c07191e0d9 --- /dev/null +++ b/cpukit/libmisc/shell/main_mount_nfs.c @@ -0,0 +1,63 @@ +/* + * Shell Command Implmentation + * + * Author: Fernando RUIZ CASAS + * Work: fernando.ruiz@ctv.es + * Home: correo@fernando-ruiz.com + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <rtems.h> +#include <rtems/shell.h> +#include "internal.h" + +#include <librtemsNfs.h> + +static int +rtems_shell_nfs_mounter (const char* device, + const char* mntpoint, + rtems_shell_filesystems_t* fs, + rtems_filesystem_options_t options) +{ + char* uidhost; + char* path; + int ret; + + if (strchr (device, ':') == NULL) + { + fprintf (stdout, "error: nfs mount device is [uid.gid@]host:path\n"); + return -1; + } + + uidhost = strdup (device); + path = strchr (uidhost, ':'); + *path = '\0'; + path++; + + ret = nfsMount(uidhost, path, (char*) mntpoint); + + free (uidhost); + + return ret; +} + +rtems_shell_filesystems_t rtems_Shell_Mount_NFS = { + name: "ftp", + driver_needed: 1, + fs_ops: NULL, + mounter: rtems_shell_nfs_mounter +}; diff --git a/cpukit/libmisc/shell/main_mount_tftp.c b/cpukit/libmisc/shell/main_mount_tftp.c new file mode 100644 index 0000000000..37454a2021 --- /dev/null +++ b/cpukit/libmisc/shell/main_mount_tftp.c @@ -0,0 +1,37 @@ +/* + * Shell Command Implmentation + * + * Author: Fernando RUIZ CASAS + * Work: fernando.ruiz@ctv.es + * Home: correo@fernando-ruiz.com + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <rtems.h> +#include <rtems/shell.h> +#include <rtems/fsmount.h> +#include "internal.h" + +#include <rtems/ftpfs.h> +#include <rtems/tftp.h> + +rtems_shell_filesystems_t rtems_Shell_Mount_TFTP = { + name: "tftp", + driver_needed: 0, + fs_ops: &rtems_tftp_ops, + mounter: rtems_shell_libc_mounter +}; diff --git a/cpukit/libmisc/shell/main_mwdump.c b/cpukit/libmisc/shell/main_mwdump.c index 9ba9fbb4f7..1faa5b9e96 100644 --- a/cpukit/libmisc/shell/main_mwdump.c +++ b/cpukit/libmisc/shell/main_mwdump.c @@ -24,15 +24,15 @@ #include <rtems/shell.h> #include "internal.h" -int main_mwdump(int argc,char * argv[]) { +int rtems_shell_main_mwdump(int argc,char * argv[]) { unsigned char n,m,max=0; - int addr=current_shell_env->mdump_addr; + int addr=rtems_current_shell_env->mdump_addr; unsigned short * pw; if (argc>1) - addr = str2int(argv[1]); + addr = rtems_shell_str2int(argv[1]); if (argc>2) - max = str2int(argv[2]); + max = rtems_shell_str2int(argv[2]); max /= 16; @@ -51,15 +51,15 @@ int main_mwdump(int argc,char * argv[]) { fprintf(stdout,"\n"); addr += 16; } - current_shell_env->mdump_addr = addr; + rtems_current_shell_env->mdump_addr = addr; return 0; } -shell_cmd_t Shell_WDUMP_Command = { +rtems_shell_cmd_t rtems_Shell_WDUMP_Command = { "wdump", /* name */ "wdump [addr [size]]", /* usage */ "mem", /* topic */ - main_mwdump, /* command */ + rtems_shell_main_mwdump, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_pwd.c b/cpukit/libmisc/shell/main_pwd.c index b33cef290e..c2caa4d4ad 100644 --- a/cpukit/libmisc/shell/main_pwd.c +++ b/cpukit/libmisc/shell/main_pwd.c @@ -23,7 +23,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_pwd (int argc, char *argv[]) { +int rtems_shell_main_pwd (int argc, char *argv[]) { char dir[1024]; getcwd(dir,1024); @@ -31,11 +31,11 @@ int main_pwd (int argc, char *argv[]) { return 0; } -shell_cmd_t Shell_PWD_Command = { +rtems_shell_cmd_t rtems_Shell_PWD_Command = { "pwd", /* name */ "pwd # print work directory", /* usage */ "files", /* topic */ - main_pwd , /* command */ + rtems_shell_main_pwd, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_rm.c b/cpukit/libmisc/shell/main_rm.c index 400521042e..682917d0aa 100644 --- a/cpukit/libmisc/shell/main_rm.c +++ b/cpukit/libmisc/shell/main_rm.c @@ -25,7 +25,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_rm(int argc, char *argv[]) +int rtems_shell_main_rm(int argc, char *argv[]) { int n; n = 1; @@ -40,11 +40,11 @@ int main_rm(int argc, char *argv[]) return 0; } -shell_cmd_t Shell_RM_Command = { +rtems_shell_cmd_t rtems_Shell_RM_Command = { "rm", /* name */ "rm n1 [n2 [n3...]] # remove files", /* usage */ "files", /* topic */ - main_rm, /* command */ + rtems_shell_main_rm, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_rmdir.c b/cpukit/libmisc/shell/main_rmdir.c index 1525a450fe..d2ffe25d8f 100644 --- a/cpukit/libmisc/shell/main_rmdir.c +++ b/cpukit/libmisc/shell/main_rmdir.c @@ -25,7 +25,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_rmdir (int argc, char *argv[]) +int rtems_shell_main_rmdir (int argc, char *argv[]) { char *dir; int n; @@ -39,11 +39,11 @@ int main_rmdir (int argc, char *argv[]) return errno; } -shell_cmd_t Shell_RMDIR_Command = { +rtems_shell_cmd_t rtems_Shell_RMDIR_Command = { "rmdir", /* name */ "rmdir dir # remove directory", /* usage */ "files", /* topic */ - main_rmdir, /* command */ + rtems_shell_main_rmdir, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_stackuse.c b/cpukit/libmisc/shell/main_stackuse.c index d316bf3262..4b1aa14419 100644 --- a/cpukit/libmisc/shell/main_stackuse.c +++ b/cpukit/libmisc/shell/main_stackuse.c @@ -22,7 +22,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_stackuse(int argc,char *argv[]) +int rtems_shell_main_stackuse(int argc,char *argv[]) { rtems_stack_checker_report_usage_with_plugin( stdout, @@ -31,11 +31,11 @@ int main_stackuse(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_STACKUSE_Command = { +rtems_shell_cmd_t rtems_Shell_STACKUSE_Command = { "stackuse", /* name */ "print per thread stack usage", /* usage */ "rtems", /* topic */ - main_stackuse, /* command */ + rtems_shell_main_stackuse, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_tty.c b/cpukit/libmisc/shell/main_tty.c index 7e1a4848e6..3836c00f31 100644 --- a/cpukit/libmisc/shell/main_tty.c +++ b/cpukit/libmisc/shell/main_tty.c @@ -26,17 +26,17 @@ #include <rtems/shell.h> #include "internal.h" -int main_tty(int argc,char *argv[]) +int rtems_shell_main_tty(int argc,char *argv[]) { printf("%s\n",ttyname(fileno(stdin))); return 0; } -shell_cmd_t Shell_TTY_Command = { +rtems_shell_cmd_t rtems_Shell_TTY_Command = { "tty", /* name */ "show ttyname", /* usage */ "misc", /* topic */ - main_tty , /* command */ + rtems_shell_main_tty, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_umask.c b/cpukit/libmisc/shell/main_umask.c index 677ded5ee4..9bda1187bd 100644 --- a/cpukit/libmisc/shell/main_umask.c +++ b/cpukit/libmisc/shell/main_umask.c @@ -28,12 +28,12 @@ #include <rtems/shell.h> #include "internal.h" -int main_umask(int argc,char *argv[]) +int rtems_shell_main_umask(int argc,char *argv[]) { mode_t msk = umask(0); if (argc == 2) - msk = str2int(argv[1]); + msk = rtems_shell_str2int(argv[1]); umask(msk); msk = umask(0); @@ -42,11 +42,11 @@ int main_umask(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_UMASK_Command = { +rtems_shell_cmd_t rtems_Shell_UMASK_Command = { "umask", /* name */ "umask [new_umask]", /* usage */ "misc", /* topic */ - main_umask , /* command */ + rtems_shell_main_umask, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/main_whoami.c b/cpukit/libmisc/shell/main_whoami.c index 1105772887..ec1c8e8cfa 100644 --- a/cpukit/libmisc/shell/main_whoami.c +++ b/cpukit/libmisc/shell/main_whoami.c @@ -27,7 +27,7 @@ #include <rtems/shell.h> #include "internal.h" -int main_whoami(int argc,char *argv[]) +int rtems_shell_main_whoami(int argc,char *argv[]) { struct passwd *pwd; @@ -36,11 +36,11 @@ int main_whoami(int argc,char *argv[]) return 0; } -shell_cmd_t Shell_WHOAMI_Command = { +rtems_shell_cmd_t rtems_Shell_WHOAMI_Command = { "whoami", /* name */ "show current user", /* usage */ "misc", /* topic */ - main_whoami, /* command */ + rtems_shell_main_whoami, /* command */ NULL, /* alias */ NULL /* next */ }; diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c index c6d4dae1b8..ea87edb145 100644 --- a/cpukit/libmisc/shell/shell.c +++ b/cpukit/libmisc/shell/shell.c @@ -39,36 +39,36 @@ #include <errno.h> #include <pwd.h> -shell_env_t global_shell_env; -shell_env_t *current_shell_env; +rtems_shell_env_t rtems_global_shell_env; +rtems_shell_env_t *rtems_current_shell_env; /* * Initialize the shell user/process environment information */ -shell_env_t *shell_init_env( - shell_env_t *shell_env_arg +rtems_shell_env_t *rtems_shell_init_env( + rtems_shell_env_t *shell_env_arg ) { - shell_env_t *shell_env; + rtems_shell_env_t *shell_env; shell_env = shell_env_arg; if ( !shell_env ) { - shell_env = malloc(sizeof(shell_env_t)); + shell_env = malloc(sizeof(rtems_shell_env_t)); if ( !shell_env ) return NULL; } - if (global_shell_env.magic != 0x600D600d) { - global_shell_env.magic = 0x600D600d; - global_shell_env.devname = ""; - global_shell_env.taskname = "GLOBAL"; - global_shell_env.tcflag = 0; - global_shell_env.exit_shell = 0; - global_shell_env.forever = TRUE; + if (rtems_global_shell_env.magic != 0x600D600d) { + rtems_global_shell_env.magic = 0x600D600d; + rtems_global_shell_env.devname = ""; + rtems_global_shell_env.taskname = "GLOBAL"; + rtems_global_shell_env.tcflag = 0; + rtems_global_shell_env.exit_shell = 0; + rtems_global_shell_env.forever = TRUE; } - *shell_env = global_shell_env; + *shell_env = rtems_global_shell_env; shell_env->taskname = NULL; shell_env->forever = FALSE; @@ -78,7 +78,7 @@ shell_env_t *shell_init_env( /* * Get a line of user input with modest features */ -int shell_scanline(char * line,int size,FILE * in,FILE * out) { +int rtems_shell_scanline(char * line,int size,FILE * in,FILE * out) { int c,col; col = 0; @@ -144,7 +144,7 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) { * TODO: Redirection. Tty Signals. ENVVARs. Shell language. * ----------------------------------------------- */ -void init_issue(void) { +void rtems_shell_init_issue(void) { static char issue_inited=FALSE; struct stat buf; @@ -156,19 +156,19 @@ void init_issue(void) { getpwnam("root"); if (stat("/etc/issue",&buf)) { - write_file("/etc/issue", - "Welcome to @V\\n" - "Login into @S\\n"); + rtems_shell_write_file("/etc/issue", + "Welcome to @V\\n" + "Login into @S\\n"); } if (stat("/etc/issue.net",&buf)) { - write_file("/etc/issue.net", - "Welcome to %v\n" - "running on %m\n"); + rtems_shell_write_file("/etc/issue.net", + "Welcome to %v\n" + "running on %m\n"); } } -int shell_login(FILE * in,FILE * out) { +int rtems_shell_login(FILE * in,FILE * out) { FILE *fd; int c; time_t t; @@ -177,23 +177,23 @@ int shell_login(FILE * in,FILE * out) { char pass[128]; struct passwd *passwd; - init_issue(); + rtems_shell_init_issue(); setuid(0); setgid(0); rtems_current_user_env->euid = rtems_current_user_env->egid =0; if (out) { - if ((current_shell_env->devname[5]!='p')|| - (current_shell_env->devname[6]!='t')|| - (current_shell_env->devname[7]!='y')) { + if ((rtems_current_shell_env->devname[5]!='p')|| + (rtems_current_shell_env->devname[6]!='t')|| + (rtems_current_shell_env->devname[7]!='y')) { fd = fopen("/etc/issue","r"); if (fd) { while ((c=fgetc(fd))!=EOF) { if (c=='@') { switch(c=fgetc(fd)) { case 'L': - fprintf(out,"%s",current_shell_env->devname); + fprintf(out,"%s",rtems_current_shell_env->devname); break; case 'B': fprintf(out,"0"); @@ -240,7 +240,7 @@ int shell_login(FILE * in,FILE * out) { if (c=='%') { switch(c=fgetc(fd)) { case 't': - fprintf(out,"%s",current_shell_env->devname); + fprintf(out,"%s",rtems_current_shell_env->devname); break; case 'h': fprintf(out,"0"); @@ -286,9 +286,9 @@ int shell_login(FILE * in,FILE * out) { times++; if (times>3) break; if (out) fprintf(out,"\nlogin: "); - if (!shell_scanline(name,sizeof(name),in,out )) break; + if (!rtems_shell_scanline(name,sizeof(name),in,out )) break; if (out) fprintf(out,"Password: "); - if (!shell_scanline(pass,sizeof(pass),in,NULL)) break; + if (!rtems_shell_scanline(pass,sizeof(pass),in,NULL)) break; if (out) fprintf(out,"\n"); if ((passwd=getpwnam(name))) { if (strcmp(passwd->pw_passwd,"!")) { /* valid user */ @@ -296,7 +296,7 @@ int shell_login(FILE * in,FILE * out) { setgid(passwd->pw_gid); rtems_current_user_env->euid = rtems_current_user_env->egid = 0; - chown(current_shell_env->devname,passwd->pw_uid,0); + chown(rtems_current_shell_env->devname,passwd->pw_uid,0); rtems_current_user_env->euid = passwd->pw_uid; rtems_current_user_env->egid = passwd->pw_gid; if (!strcmp(passwd->pw_passwd,"*")) { @@ -317,8 +317,8 @@ int shell_login(FILE * in,FILE * out) { } #if defined(SHELL_DEBUG) -void shell_print_env( - shell_env_t * shell_env +void rtems_shell_print_env( + rtems_shell_env_t * shell_env ) { if ( !shell_env ) { @@ -342,40 +342,47 @@ void shell_print_env( } #endif -rtems_task shell_shell(rtems_task_argument task_argument) +rtems_task rtems_shell_shell(rtems_task_argument task_argument) { - shell_env_t * shell_env =(shell_env_t*) task_argument; + rtems_shell_env_t * shell_env = (rtems_shell_env_t*) task_argument; - shell_shell_loop( shell_env ); + rtems_shell_shell_loop( shell_env ); rtems_task_delete( RTEMS_SELF ); } -#define SHELL_MAXIMUM_ARGUMENTS 128 +#define RTEMS_SHELL_MAXIMUM_ARGUMENTS 128 -rtems_boolean shell_shell_loop( - shell_env_t *shell_env_arg +rtems_boolean rtems_shell_shell_loop( + rtems_shell_env_t *shell_env_arg ) { - shell_env_t *shell_env; - shell_cmd_t *shell_cmd; + rtems_shell_env_t *shell_env; + rtems_shell_cmd_t *shell_cmd; rtems_status_code sc; struct termios term; char curdir[256]; char cmd[256]; char last_cmd[256]; /* to repeat 'r' */ int argc; - char *argv[SHELL_MAXIMUM_ARGUMENTS]; - - shell_initialize_command_set(); - - sc = rtems_task_variable_add(RTEMS_SELF,(void*)¤t_shell_env,free); + char *argv[RTEMS_SHELL_MAXIMUM_ARGUMENTS]; + + rtems_shell_initialize_command_set(); + + /* + * @todo chrisj + * Remove the use of task variables. Chnage to have a single + * allocation per shell and then set into a notepad register + * in the TCP. Provide a function to return the pointer. + * Task variables are a virus to embedded systems software. + */ + sc = rtems_task_variable_add(RTEMS_SELF,(void*)&rtems_current_shell_env,free); if (sc != RTEMS_SUCCESSFUL) { rtems_error(sc,"rtems_task_variable_add(current_shell_env):"); return FALSE; } - shell_env = - current_shell_env = shell_init_env( shell_env_arg ); + shell_env = + rtems_current_shell_env = rtems_shell_init_env( shell_env_arg ); setuid(0); setgid(0); @@ -401,7 +408,7 @@ rtems_boolean shell_shell_loop( setvbuf(stdout,NULL,_IONBF,0); /* Not buffered*/ } - shell_initialize_command_set(); + rtems_shell_initialize_command_set(); do { /* Set again root user and root filesystem, side effect of set_priv..*/ sc = rtems_libio_set_private_env(); @@ -409,8 +416,8 @@ rtems_boolean shell_shell_loop( rtems_error(sc,"rtems_libio_set_private_env():"); return FALSE; } - if (!shell_login(stdin,stdout)) { - cat_file(stdout,"/etc/motd"); + if (!rtems_shell_login(stdin,stdout)) { + rtems_shell_cat_file(stdout,"/etc/motd"); strcpy(last_cmd,""); strcpy(cmd,""); printf("\n" @@ -429,7 +436,7 @@ rtems_boolean shell_shell_loop( geteuid()?'$':'#' ); /* getcmd section */ - if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) { + if (!rtems_shell_scanline(cmd,sizeof(cmd),stdin,stdout)) { break; /*EOF*/ } @@ -456,8 +463,9 @@ rtems_boolean shell_shell_loop( * Run in a new shell task background. (unix &) * Resuming. A little bash. */ - if (!shell_make_args(cmd, &argc, argv, SHELL_MAXIMUM_ARGUMENTS)) { - shell_cmd = shell_lookup_cmd(argv[0]); + if (!rtems_shell_make_args(cmd, &argc, argv, + RTEMS_SHELL_MAXIMUM_ARGUMENTS)) { + shell_cmd = rtems_shell_lookup_cmd(argv[0]); if ( argv[0] == NULL ) { shell_env->errorlevel = -1; } else if ( shell_cmd == NULL ) { @@ -483,7 +491,7 @@ rtems_boolean shell_shell_loop( } /* ----------------------------------------------- */ -rtems_status_code shell_init ( +rtems_status_code rtems_shell_init ( char *task_name, uint32_t task_stacksize, rtems_task_priority task_priority, @@ -494,7 +502,7 @@ rtems_status_code shell_init ( { rtems_id task_id; rtems_status_code sc; - shell_env_t *shell_env; + rtems_shell_env_t *shell_env; rtems_name name; if ( task_name ) @@ -516,7 +524,7 @@ rtems_status_code shell_init ( return sc; } - shell_env = shell_init_env( NULL ); + shell_env = rtems_shell_init_env( NULL ); if ( !shell_env ) { rtems_error(sc,"allocating shell_env %s in shell_init()",task_name); return RTEMS_NO_MEMORY; @@ -527,5 +535,6 @@ rtems_status_code shell_init ( shell_env->exit_shell = FALSE; shell_env->forever = forever; - return rtems_task_start(task_id,shell_shell,(rtems_task_argument) shell_env); + return rtems_task_start(task_id,rtems_shell_shell, + (rtems_task_argument) shell_env); } diff --git a/cpukit/libmisc/shell/shell.h b/cpukit/libmisc/shell/shell.h index 19e1d97917..fbaf1165ac 100644 --- a/cpukit/libmisc/shell/shell.h +++ b/cpukit/libmisc/shell/shell.h @@ -11,69 +11,71 @@ * HOME: correo@fernando-ruiz.com * * Thanks at: - * Chris John + * Chris Johns * * $Id$ */ -#ifndef __SHELL_H__ -#define __SHELL_H__ +#ifndef __RTEMS_SHELL_H__ +#define __RTEMS_SHELL_H__ #include <rtems.h> #include <stdio.h> #include <termios.h> +#include <rtems/fs.h> +#include <rtems/libio.h> #ifdef __cplusplus extern "C" { #endif -typedef int (*shell_command_t)(int argc,char * argv[]); +typedef int (*rtems_shell_command_t)(int argc,char * argv[]); -struct shell_cmd_tt; -typedef struct shell_cmd_tt shell_cmd_t; +struct rtems_shell_cmd_tt; +typedef struct rtems_shell_cmd_tt rtems_shell_cmd_t; -struct shell_cmd_tt { - char *name; - char *usage; - char *topic; - shell_command_t command; - shell_cmd_t *alias; - shell_cmd_t *next; +struct rtems_shell_cmd_tt { + char *name; + char *usage; + char *topic; + rtems_shell_command_t command; + rtems_shell_cmd_t *alias; + rtems_shell_cmd_t *next; }; typedef struct { char *name; char *alias; -} shell_alias_t; +} rtems_shell_alias_t; -shell_cmd_t * shell_lookup_cmd(char * cmd); +rtems_shell_cmd_t * rtems_shell_lookup_cmd(char * cmd); -shell_cmd_t *shell_add_cmd_struct( - shell_cmd_t *shell_cmd +rtems_shell_cmd_t *rtems_shell_add_cmd_struct( + rtems_shell_cmd_t *shell_cmd ); -shell_cmd_t * shell_add_cmd( - char *cmd, - char *topic, - char *usage, - shell_command_t command +rtems_shell_cmd_t * rtems_shell_add_cmd( + char *cmd, + char *topic, + char *usage, + rtems_shell_command_t command ); -shell_cmd_t * shell_alias_cmd( +rtems_shell_cmd_t * rtems_shell_alias_cmd( char *cmd, char *alias ); -int shell_make_args( +int rtems_shell_make_args( char *commandLine, int *argc_p, char **argv_p, int max_args ); -int shell_scanline(char * line,int size,FILE * in,FILE * out) ; -void cat_file(FILE * out,char *name); -void write_file(char *name,char * content); +int rtems_shell_scanline(char * line,int size,FILE * in,FILE * out) ; +void rtems_shell_cat_file(FILE * out,char *name); +void rtems_shell_write_file(char *name,char * content); /** * Initialise the shell creating tasks to login and run the shell @@ -90,7 +92,7 @@ void write_file(char *name,char * content); * needs to adjust the termios for its use but it should assume the * settings are set by the user for things like baudrate etc. */ -rtems_status_code shell_init( +rtems_status_code rtems_shell_init( char *task_name, uint32_t task_stacksize, /*0 default*/ rtems_task_priority task_priority, @@ -103,7 +105,7 @@ rtems_status_code shell_init( * Things that are useful to external entities developing commands and plugging * them in. */ -int str2int(char * s); +int rtems_shell_str2int(char * s); typedef struct { rtems_name magic; /* 'S','E','N','V': Shell Environment */ @@ -115,14 +117,36 @@ typedef struct { int forever ; /* repeat login */ int errorlevel; uintptr_t mdump_addr; -} shell_env_t; +} rtems_shell_env_t; -rtems_boolean shell_shell_loop( - shell_env_t *shell_env +rtems_boolean rtems_shell_shell_loop( + rtems_shell_env_t *rtems_shell_env ); -extern shell_env_t global_shell_env; -extern shell_env_t *current_shell_env; +extern rtems_shell_env_t rtems_global_shell_env; +extern rtems_shell_env_t *rtems_current_shell_env; + +/* + * The types of file systems we can mount. We have them broken out + * out like this so they can be configured by shellconfig.h. The + * mount command needs special treatment due to some file systems + * being dependent on the network stack and some not. If we had + * all possible file systems being included it would force the + * networking stack into the applcation and this may not be + * required. + */ +struct rtems_shell_filesystems_tt; +typedef struct rtems_shell_filesystems_tt rtems_shell_filesystems_t; +typedef int (*rtems_shell_filesystems_mounter_t)(const char* driver, + const char* path, + rtems_shell_filesystems_t* fs, + rtems_filesystem_options_t options); +struct rtems_shell_filesystems_tt { + const char* name; + int driver_needed; + rtems_filesystem_operations_table* fs_ops; + rtems_shell_filesystems_mounter_t mounter; +}; #ifdef __cplusplus } diff --git a/cpukit/libmisc/shell/shell_cmdset.c b/cpukit/libmisc/shell/shell_cmdset.c index daade2bb03..a549d257d1 100644 --- a/cpukit/libmisc/shell/shell_cmdset.c +++ b/cpukit/libmisc/shell/shell_cmdset.c @@ -44,37 +44,37 @@ * */ -shell_cmd_t * shell_first_cmd; -shell_topic_t * shell_first_topic; +rtems_shell_cmd_t * rtems_shell_first_cmd; +rtems_shell_topic_t * rtems_shell_first_topic; /* * Find the topic from the set of topics registered. */ -shell_topic_t * shell_lookup_topic(char * topic) { - shell_topic_t * shell_topic; - shell_topic=shell_first_topic; +rtems_shell_topic_t * rtems_shell_lookup_topic(char * topic) { + rtems_shell_topic_t * shell_topic; + shell_topic=rtems_shell_first_topic; while (shell_topic) { if (!strcmp(shell_topic->topic,topic)) return shell_topic; shell_topic=shell_topic->next; } - return (shell_topic_t *) NULL; + return (rtems_shell_topic_t *) NULL; } /* * Add a new topic to the list of topics */ -shell_topic_t * shell_add_topic(char * topic) { - shell_topic_t * current,*aux; +rtems_shell_topic_t * rtems_shell_add_topic(char * topic) { + rtems_shell_topic_t * current,*aux; - if (!shell_first_topic) { - aux = malloc(sizeof(shell_topic_t)); + if (!rtems_shell_first_topic) { + aux = malloc(sizeof(rtems_shell_topic_t)); aux->topic = topic; - aux->next = (shell_topic_t*)NULL; - return shell_first_topic = aux; + aux->next = (rtems_shell_topic_t*)NULL; + return rtems_shell_first_topic = aux; } - current=shell_first_topic; + current=rtems_shell_first_topic; if (!strcmp(topic,current->topic)) return current; @@ -83,9 +83,9 @@ shell_topic_t * shell_add_topic(char * topic) { return current->next; current=current->next; } - aux = malloc(sizeof(shell_topic_t)); + aux = malloc(sizeof(rtems_shell_topic_t)); aux->topic = topic; - aux->next = (shell_topic_t*)NULL; + aux->next = (rtems_shell_topic_t*)NULL; current->next = aux; return aux; } @@ -93,41 +93,41 @@ shell_topic_t * shell_add_topic(char * topic) { /* * Find the command in the set */ -shell_cmd_t * shell_lookup_cmd(char * cmd) { - shell_cmd_t * shell_cmd; - shell_cmd=shell_first_cmd; +rtems_shell_cmd_t * rtems_shell_lookup_cmd(char * cmd) { + rtems_shell_cmd_t * shell_cmd; + shell_cmd=rtems_shell_first_cmd; while (shell_cmd) { if (!strcmp(shell_cmd->name,cmd)) return shell_cmd; shell_cmd=shell_cmd->next; }; - return (shell_cmd_t *) NULL; + return (rtems_shell_cmd_t *) NULL; } /* * Add a command structure to the set of known commands */ -shell_cmd_t *shell_add_cmd_struct( - shell_cmd_t *shell_cmd +rtems_shell_cmd_t *rtems_shell_add_cmd_struct( + rtems_shell_cmd_t *shell_cmd ) { - shell_cmd_t *shell_pvt; + rtems_shell_cmd_t *shell_pvt; - shell_pvt = shell_first_cmd; + shell_pvt = rtems_shell_first_cmd; while (shell_pvt) { if (strcmp(shell_pvt->name, shell_cmd->name) == 0) return NULL; shell_pvt = shell_pvt->next; } - if ( !shell_first_cmd ) { - shell_first_cmd = shell_cmd; + if ( !rtems_shell_first_cmd ) { + rtems_shell_first_cmd = shell_cmd; } else { - shell_pvt = shell_first_cmd; + shell_pvt = rtems_shell_first_cmd; while (shell_pvt->next) shell_pvt = shell_pvt->next; shell_pvt->next = shell_cmd; } - shell_add_topic( shell_cmd->topic ); + rtems_shell_add_topic( shell_cmd->topic ); return shell_cmd; } @@ -135,29 +135,29 @@ shell_cmd_t *shell_add_cmd_struct( * Add a command as a set of arguments to the set and * allocate the command structure on the fly. */ -shell_cmd_t * shell_add_cmd( - char *cmd, - char *topic, - char *usage, - shell_command_t command +rtems_shell_cmd_t * rtems_shell_add_cmd( + char *cmd, + char *topic, + char *usage, + rtems_shell_command_t command ) { - shell_cmd_t *shell_cmd; + rtems_shell_cmd_t *shell_cmd; if (!cmd) - return (shell_cmd_t *) NULL; + return (rtems_shell_cmd_t *) NULL; if (!command) - return (shell_cmd_t *) NULL; + return (rtems_shell_cmd_t *) NULL; - shell_cmd = (shell_cmd_t *) malloc(sizeof(shell_cmd_t)); + shell_cmd = (rtems_shell_cmd_t *) malloc(sizeof(rtems_shell_cmd_t)); shell_cmd->name = strdup( cmd ); shell_cmd->topic = strdup( topic ); shell_cmd->usage = strdup( usage ); shell_cmd->command = command; - shell_cmd->alias = (shell_cmd_t *) NULL; - shell_cmd->next = (shell_cmd_t *) NULL; + shell_cmd->alias = (rtems_shell_cmd_t *) NULL; + shell_cmd->next = (rtems_shell_cmd_t *) NULL; - if (shell_add_cmd_struct( shell_cmd ) == NULL) { + if (rtems_shell_add_cmd_struct( shell_cmd ) == NULL) { free( shell_cmd->usage ); free( shell_cmd->topic ); free( shell_cmd->name ); @@ -169,42 +169,42 @@ shell_cmd_t * shell_add_cmd( } -void shell_initialize_command_set(void) +void rtems_shell_initialize_command_set(void) { - shell_cmd_t **c; - shell_alias_t **a; + rtems_shell_cmd_t **c; + rtems_shell_alias_t **a; - for ( c = Shell_Initial_commands ; *c ; c++ ) { - shell_add_cmd_struct( *c ); + for ( c = rtems_Shell_Initial_commands ; *c ; c++ ) { + rtems_shell_add_cmd_struct( *c ); } - for ( a = Shell_Initial_aliases ; *a ; a++ ) { - shell_alias_cmd( (*a)->name, (*a)->alias ); + for ( a = rtems_Shell_Initial_aliases ; *a ; a++ ) { + rtems_shell_alias_cmd( (*a)->name, (*a)->alias ); } - shell_register_monitor_commands(); + rtems_shell_register_monitor_commands(); } /* ----------------------------------------------- * * you can make an alias for every command. * ----------------------------------------------- */ -shell_cmd_t *shell_alias_cmd( +rtems_shell_cmd_t *rtems_shell_alias_cmd( char *cmd, char *alias ) { - shell_cmd_t *shell_cmd, *shell_aux; + rtems_shell_cmd_t *shell_cmd, *shell_aux; - shell_aux = (shell_cmd_t *) NULL; + shell_aux = (rtems_shell_cmd_t *) NULL; if (alias) { - shell_aux = shell_lookup_cmd(alias); + shell_aux = rtems_shell_lookup_cmd(alias); if (shell_aux != NULL) { return NULL; } - shell_cmd = shell_lookup_cmd(cmd); + shell_cmd = rtems_shell_lookup_cmd(cmd); if (shell_cmd != NULL) { - shell_aux = shell_add_cmd( + shell_aux = rtems_shell_add_cmd( alias, shell_cmd->topic, shell_cmd->usage, diff --git a/cpukit/libmisc/shell/shell_makeargs.c b/cpukit/libmisc/shell/shell_makeargs.c index 216947b8c1..9359a634d3 100644 --- a/cpukit/libmisc/shell/shell_makeargs.c +++ b/cpukit/libmisc/shell/shell_makeargs.c @@ -17,7 +17,7 @@ #include <string.h> -int shell_make_args( +int rtems_shell_make_args( char *commandLine, int *argc_p, char **argv_p, diff --git a/cpukit/libmisc/shell/shellconfig.h b/cpukit/libmisc/shell/shellconfig.h index e692fdd57c..21d90f732c 100644 --- a/cpukit/libmisc/shell/shellconfig.h +++ b/cpukit/libmisc/shell/shellconfig.h @@ -19,47 +19,57 @@ /* * Externs for all command definition structures */ -extern shell_cmd_t Shell_HELP_Command; -extern shell_cmd_t Shell_ALIAS_Command; -extern shell_cmd_t Shell_LOGOFF_Command; - -extern shell_cmd_t Shell_MDUMP_Command; -extern shell_cmd_t Shell_WDUMP_Command; -extern shell_cmd_t Shell_MEDIT_Command; -extern shell_cmd_t Shell_MFILL_Command; -extern shell_cmd_t Shell_MMOVE_Command; - -extern shell_cmd_t Shell_DATE_Command; -extern shell_cmd_t Shell_ID_Command; -extern shell_cmd_t Shell_TTY_Command; -extern shell_cmd_t Shell_WHOAMI_Command; - -extern shell_cmd_t Shell_PWD_Command; -extern shell_cmd_t Shell_LS_Command; -extern shell_cmd_t Shell_CHDIR_Command; -extern shell_cmd_t Shell_MKDIR_Command; -extern shell_cmd_t Shell_RMDIR_Command; -extern shell_cmd_t Shell_CHROOT_Command; -extern shell_cmd_t Shell_CHMOD_Command; -extern shell_cmd_t Shell_CAT_Command; -extern shell_cmd_t Shell_RM_Command; -extern shell_cmd_t Shell_UMASK_Command; - -extern shell_cmd_t Shell_CPUUSE_Command; -extern shell_cmd_t Shell_STACKUSE_Command; - -extern shell_cmd_t Shell_MALLOC_DUMP_Command; - -extern shell_cmd_t *Shell_Initial_commands[]; +extern rtems_shell_cmd_t rtems_Shell_HELP_Command; +extern rtems_shell_cmd_t rtems_Shell_ALIAS_Command; +extern rtems_shell_cmd_t rtems_Shell_LOGOFF_Command; + +extern rtems_shell_cmd_t rtems_Shell_MDUMP_Command; +extern rtems_shell_cmd_t rtems_Shell_WDUMP_Command; +extern rtems_shell_cmd_t rtems_Shell_MEDIT_Command; +extern rtems_shell_cmd_t rtems_Shell_MFILL_Command; +extern rtems_shell_cmd_t rtems_Shell_MMOVE_Command; + +extern rtems_shell_cmd_t rtems_Shell_DATE_Command; +extern rtems_shell_cmd_t rtems_Shell_ID_Command; +extern rtems_shell_cmd_t rtems_Shell_TTY_Command; +extern rtems_shell_cmd_t rtems_Shell_WHOAMI_Command; + +extern rtems_shell_cmd_t rtems_Shell_PWD_Command; +extern rtems_shell_cmd_t rtems_Shell_LS_Command; +extern rtems_shell_cmd_t rtems_Shell_CHDIR_Command; +extern rtems_shell_cmd_t rtems_Shell_MKDIR_Command; +extern rtems_shell_cmd_t rtems_Shell_RMDIR_Command; +extern rtems_shell_cmd_t rtems_Shell_CHROOT_Command; +extern rtems_shell_cmd_t rtems_Shell_CHMOD_Command; +extern rtems_shell_cmd_t rtems_Shell_CAT_Command; +extern rtems_shell_cmd_t rtems_Shell_RM_Command; +extern rtems_shell_cmd_t rtems_Shell_UMASK_Command; +extern rtems_shell_cmd_t rtems_Shell_MOUNT_Command; + +extern rtems_shell_cmd_t rtems_Shell_CPUUSE_Command; +extern rtems_shell_cmd_t rtems_Shell_STACKUSE_Command; +extern rtems_shell_cmd_t rtems_Shell_MALLOC_DUMP_Command; + +extern rtems_shell_cmd_t *rtems_Shell_Initial_commands[]; + +/* + * Extern for alias commands + */ +extern rtems_shell_alias_t rtems_Shell_DIR_Alias; +extern rtems_shell_alias_t rtems_Shell_CD_Alias; +extern rtems_shell_alias_t rtems_Shell_EXIT_Alias; + +extern rtems_shell_alias_t *rtems_Shell_Initial_aliases[]; /* * Extern for alias commands */ -extern shell_alias_t Shell_DIR_Alias; -extern shell_alias_t Shell_CD_Alias; -extern shell_alias_t Shell_EXIT_Alias; +extern rtems_shell_filesystems_t rtems_Shell_Mount_MSDOS; +extern rtems_shell_filesystems_t rtems_Shell_Mount_TFTP; +extern rtems_shell_filesystems_t rtems_Shell_Mount_FTP; +extern rtems_shell_filesystems_t rtems_Shell_Mount_NFS; -extern shell_alias_t *Shell_Initial_aliases[]; +extern rtems_shell_filesystems_t *rtems_Shell_Mount_filesystems[]; /* * If we are configured to alias a command, then make sure the underlying @@ -69,33 +79,36 @@ extern shell_alias_t *Shell_Initial_aliases[]; #if !defined(CONFIGURE_SHELL_COMMANDS_ALL) #if defined(CONFIGURE_SHELL_COMMANDS_DIR) && \ !defined(CONFIGURE_SHELL_COMMANDS_LS) - #define CONFIGURE_SHELL_COMMANDS_LS + #define CONFIGURE_SHELL_COMMAND_LS #endif #if defined(CONFIGURE_SHELL_COMMANDS_CD) && \ !defined(CONFIGURE_SHELL_COMMANDS_CHDIR) - #define CONFIGURE_SHELL_COMMANDS_CHDIR + #define CONFIGURE_SHELL_COMMAND_CHDIR #endif #if defined(CONFIGURE_SHELL_COMMANDS_EXIT) && \ !defined(CONFIGURE_SHELL_COMMANDS_LOGOFF) - #define CONFIGURE_SHELL_COMMANDS_LOGOFF + #define CONFIGURE_SHELL_COMMAND_LOGOFF #endif #endif #if defined(CONFIGURE_SHELL_COMMANDS_INIT) - shell_alias_t *Shell_Initial_aliases[] = { - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ - defined(CONFIGURE_SHELL_COMMANDS_DIR) - &Shell_DIR_Alias, + rtems_shell_alias_t *rtems_Shell_Initial_aliases[] = { + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_DIR)) || \ + defined(CONFIGURE_SHELL_COMMAND_DIR) + &rtems_Shell_DIR_Alias, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ - defined(CONFIGURE_SHELL_COMMANDS_CD) - &Shell_CD_Alias, + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_CD)) || \ + defined(CONFIGURE_SHELL_COMMAND_CD) + &rtems_Shell_CD_Alias, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ - defined(CONFIGURE_SHELL_COMMANDS_EXIT) - &Shell_EXIT_Alias, + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_EXIT)) || \ + defined(CONFIGURE_SHELL_COMMAND_EXIT) + &rtems_Shell_EXIT_Alias, #endif /* @@ -107,123 +120,151 @@ extern shell_alias_t *Shell_Initial_aliases[]; NULL }; - shell_cmd_t *Shell_Initial_commands[] = { + rtems_shell_cmd_t *rtems_Shell_Initial_commands[] = { /* * General comamnds that should be present */ - &Shell_HELP_Command, - &Shell_ALIAS_Command, + &rtems_Shell_HELP_Command, + &rtems_Shell_ALIAS_Command, /* * Common commands that can be optional */ - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_DATE)) || \ defined(CONFIGURE_SHELL_COMMAND_DATE) - &Shell_DATE_Command, + &rtems_Shell_DATE_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_ID)) || \ defined(CONFIGURE_SHELL_COMMAND_ID) - &Shell_ID_Command, + &rtems_Shell_ID_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_TTY)) || \ defined(CONFIGURE_SHELL_COMMAND_TTY) - &Shell_TTY_Command, + &rtems_Shell_TTY_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_WHOAMI)) || \ defined(CONFIGURE_SHELL_COMMAND_WHOAMI) - &Shell_WHOAMI_Command, + &rtems_Shell_WHOAMI_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_LOGOFF)) || \ defined(CONFIGURE_SHELL_COMMAND_LOGOFF) - &Shell_LOGOFF_Command, + &rtems_Shell_LOGOFF_Command, #endif /* * Memory printing/modification family commands */ - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_MDUMP)) || \ defined(CONFIGURE_SHELL_COMMAND_MDUMP) - &Shell_MDUMP_Command, + &rtems_Shell_MDUMP_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_WDUMP)) || \ defined(CONFIGURE_SHELL_COMMAND_WDUMP) - &Shell_WDUMP_Command, + &rtems_Shell_WDUMP_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_MEDIT)) || \ defined(CONFIGURE_SHELL_COMMAND_MEDIT) - &Shell_MEDIT_Command, + &rtems_Shell_MEDIT_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_MFILL)) || \ defined(CONFIGURE_SHELL_COMMAND_MFILL) - &Shell_MFILL_Command, + &rtems_Shell_MFILL_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_MMOVE)) || \ defined(CONFIGURE_SHELL_COMMAND_MMOVE) - &Shell_MMOVE_Command, + &rtems_Shell_MMOVE_Command, #endif /* * File and directory commands */ - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_PWD)) || \ defined(CONFIGURE_SHELL_COMMAND_PWD) - &Shell_PWD_Command, + &rtems_Shell_PWD_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_LS)) || \ defined(CONFIGURE_SHELL_COMMAND_LS) - &Shell_LS_Command, + &rtems_Shell_LS_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_CHDIR)) || \ defined(CONFIGURE_SHELL_COMMAND_CHDIR) - &Shell_CHDIR_Command, + &rtems_Shell_CHDIR_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_MKDIR)) || \ defined(CONFIGURE_SHELL_COMMAND_MKDIR) - &Shell_MKDIR_Command, + &rtems_Shell_MKDIR_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_RMDIR)) || \ defined(CONFIGURE_SHELL_COMMAND_RMDIR) - &Shell_RMDIR_Command, + &rtems_Shell_RMDIR_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_CHROOT)) || \ defined(CONFIGURE_SHELL_COMMAND_CHROOT) - &Shell_CHROOT_Command, + &rtems_Shell_CHROOT_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_CHMOD)) || \ defined(CONFIGURE_SHELL_COMMAND_CHMOD) - &Shell_CHMOD_Command, + &rtems_Shell_CHMOD_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_CAT)) || \ defined(CONFIGURE_SHELL_COMMAND_CAT) - &Shell_CAT_Command, + &rtems_Shell_CAT_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_RM)) || \ defined(CONFIGURE_SHELL_COMMAND_RM) - &Shell_RM_Command, + &rtems_Shell_RM_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_UMASK)) || \ defined(CONFIGURE_SHELL_COMMAND_UMASK) - &Shell_UMASK_Command, + &rtems_Shell_UMASK_Command, + #endif + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_MOUNT)) || \ + defined(CONFIGURE_SHELL_COMMAND_MOUNT) + &rtems_Shell_MOUNT_Command, #endif /* * RTEMS Related commands */ - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_CPUUSE)) || \ defined(CONFIGURE_SHELL_COMMAND_CPUUSE) - &Shell_CPUUSE_Command, + &rtems_Shell_CPUUSE_Command, #endif - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_NO_COMMAND_STACKUSE)) || \ defined(CONFIGURE_SHELL_COMMAND_STACKUSE) - &Shell_STACKUSE_Command, + &rtems_Shell_STACKUSE_Command, #endif /* * Malloc family commands */ - #if defined(CONFIGURE_SHELL_COMMANDS_ALL) || \ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_COMMAND_MALLOC_DUMP)) || \ defined(CONFIGURE_SHELL_COMMAND_MALLOC_DUMP) - &Shell_MALLOC_DUMP_Command, + &rtems_Shell_MALLOC_DUMP_Command, #endif /* @@ -234,6 +275,32 @@ extern shell_alias_t *Shell_Initial_aliases[]; #endif NULL }; + + /* + * The mount command's support file system types. + */ + #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ + !defined(CONFIGURE_SHELL_COMMAND_MALLOC_DUMP)) || \ + defined(CONFIGURE_SHELL_COMMAND_MALLOC_DUMP) + rtems_shell_filesystems_t *rtems_Shell_Mount_filesystems[] = { + #if defined(CONFIGURE_SHELL_MOUNT_MSDOS) + &rtems_Shell_Mount_MSDOS, + #endif + #if RTEMS_NETWORKING + #if defined(CONFIGURE_SHELL_MOUNT_TFTP) + &rtems_Shell_Mount_TFTP, + #endif + #if defined(CONFIGURE_SHELL_MOUNT_FTP) + &rtems_Shell_Mount_FTP, + #endif + #if defined(CONFIGURE_SHELL_MOUNT_NFS) + &rtems_Shell_Mount_NFS, + #endif + #endif + NULL + }; + #endif + #endif #endif diff --git a/cpukit/libmisc/shell/str2int.c b/cpukit/libmisc/shell/str2int.c index 851e9224ad..a569772bb6 100644 --- a/cpukit/libmisc/shell/str2int.c +++ b/cpukit/libmisc/shell/str2int.c @@ -21,7 +21,7 @@ /* * str to int "0xaffe" "0b010010" "0123" "192939" */ -int str2int(char * s) { +int rtems_shell_str2int(char * s) { int sign=1; int base=10; int value=0; diff --git a/cpukit/libmisc/shell/write_file.c b/cpukit/libmisc/shell/write_file.c index 33f1d5ae02..e294ad99b6 100644 --- a/cpukit/libmisc/shell/write_file.c +++ b/cpukit/libmisc/shell/write_file.c @@ -22,7 +22,7 @@ #include <unistd.h> #include <string.h> -void write_file( +void rtems_shell_write_file( char *name, char * content ) diff --git a/cpukit/libnetworking/rtems/ftpfs.h b/cpukit/libnetworking/rtems/ftpfs.h index bc928a33f5..c2ac0e839a 100644 --- a/cpukit/libnetworking/rtems/ftpfs.h +++ b/cpukit/libnetworking/rtems/ftpfs.h @@ -27,9 +27,14 @@ extern "C" { #endif +#include <rtems/libio.h> + /* create mount point and mount ftp file system */ int rtems_bsdnet_initialize_ftp_filesystem () ; + /* FTP File sysem operations table. */ + extern rtems_filesystem_operations_table rtems_ftp_ops; + #ifdef __cplusplus } #endif diff --git a/cpukit/libnetworking/rtems/tftp.h b/cpukit/libnetworking/rtems/tftp.h index 0813d80431..b6a1bb5e8f 100644 --- a/cpukit/libnetworking/rtems/tftp.h +++ b/cpukit/libnetworking/rtems/tftp.h @@ -30,12 +30,20 @@ extern "C" { #endif +#include <rtems/libio.h> + /* * Filesystem initialization routine */ int rtems_bsdnet_initialize_tftp_filesystem( void ); +/* + * TFTP file system operations table. + */ + +extern rtems_filesystem_operations_table rtems_tftp_ops; + #ifdef __cplusplus } #endif |