diff options
| author | charlown <[email protected]> | 2021-09-02 22:39:34 +0800 |
|---|---|---|
| committer | charlown <[email protected]> | 2021-09-02 22:39:34 +0800 |
| commit | 8abbe89cee0099f3ec727de53baf20f7945434e9 (patch) | |
| tree | a9d8b24c6f6bcb927963757846c21d9926797c43 /components | |
| parent | 2e74dd8e2d641f581ef733a050392d161d3643d0 (diff) | |
| parent | dca7dcb42a44249abbe6c36ce2a69355e60d1f79 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'components')
| -rw-r--r-- | components/dfs/include/dfs.h | 27 | ||||
| -rw-r--r-- | components/dfs/include/dfs_posix.h | 8 | ||||
| -rw-r--r-- | components/finsh/Kconfig | 102 | ||||
| -rw-r--r-- | components/finsh/SConscript | 6 | ||||
| -rw-r--r-- | components/finsh/msh.c | 22 | ||||
| -rw-r--r-- | components/libc/compilers/common/dirent.h | 23 | ||||
| -rw-r--r-- | components/net/lwip-2.1.2/src/api/sockets.c | 2 |
7 files changed, 95 insertions, 95 deletions
diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h index 80dc433787..0fd8c2dccc 100644 --- a/components/dfs/include/dfs.h +++ b/components/dfs/include/dfs.h @@ -15,17 +15,20 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> - -#include <time.h> -#include <rtthread.h> +#include <dirent.h> +#include <sys/time.h> #include <rtdevice.h> +#ifdef __cplusplus +extern "C" { +#endif + #ifndef DFS_FILESYSTEMS_MAX -#define DFS_FILESYSTEMS_MAX 2 +#define DFS_FILESYSTEMS_MAX 4 #endif #ifndef DFS_FD_MAX -#define DFS_FD_MAX 4 +#define DFS_FD_MAX 16 #endif /* @@ -36,7 +39,7 @@ #endif #ifndef DFS_PATH_MAX -#define DFS_PATH_MAX 256 +#define DFS_PATH_MAX DIRENT_NAME_MAX #endif #ifndef SECTOR_SIZE @@ -63,10 +66,6 @@ #define DFS_F_EOF 0x04000000 #define DFS_F_ERR 0x08000000 -#ifdef __cplusplus -extern "C" { -#endif - struct statfs { size_t f_bsize; /* block size */ @@ -74,14 +73,6 @@ struct statfs size_t f_bfree; /* free blocks in file system */ }; -struct dirent -{ - uint8_t d_type; /* The type of the file */ - uint8_t d_namlen; /* The length of the not including the terminating null file name */ - uint16_t d_reclen; /* length of this record */ - char d_name[DFS_PATH_MAX]; /* The null-terminated file name */ -}; - struct dfs_fdtable { uint32_t maxfd; diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index 0475460d95..ec7cdc9de4 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -21,14 +21,6 @@ extern "C" { #endif -typedef struct -{ - int fd; /* directory file */ - char buf[512]; - int num; - int cur; -} DIR; - /* directory api*/ int mkdir(const char *path, mode_t mode); DIR *opendir(const char *name); diff --git a/components/finsh/Kconfig b/components/finsh/Kconfig index 637b1a30c1..cf4e673c75 100644 --- a/components/finsh/Kconfig +++ b/components/finsh/Kconfig @@ -11,61 +11,69 @@ config RT_USING_MSH if RT_USING_MSH -config FINSH_THREAD_NAME - string "The msh thread name" - default "tshell" -config FINSH_USING_HISTORY - bool "Enable command history feature" - default y -if FINSH_USING_HISTORY -config FINSH_HISTORY_LINES - int "The command history line number" - default 5 -endif + config FINSH_THREAD_NAME + string "The msh thread name" + default "tshell" -config FINSH_USING_SYMTAB - bool "Using symbol table for commands" - default y + config FINSH_THREAD_PRIORITY + int "The priority level value of thread" + default 20 -config FINSH_USING_DESCRIPTION - bool "Keeping description in symbol table" - default y + config FINSH_THREAD_STACK_SIZE + int "The stack size for thread" + default 4096 -config FINSH_ECHO_DISABLE_DEFAULT - bool "Disable the echo mode in default" - default n - -config FINSH_THREAD_PRIORITY - int "The priority level value of thread" - default 20 + config FINSH_USING_HISTORY + bool "Enable command history feature" + default y -config FINSH_THREAD_STACK_SIZE - int "The stack size for thread" - default 4096 + if FINSH_USING_HISTORY + config FINSH_HISTORY_LINES + int "The command history line number" + default 5 + endif -config FINSH_CMD_SIZE - int "The command line size for shell" - default 80 + config FINSH_USING_SYMTAB + bool "Using symbol table for commands" + default y -config FINSH_USING_AUTH - bool "shell support authentication" - default n + config FINSH_CMD_SIZE + int "The command line size for shell" + default 80 -if FINSH_USING_AUTH -config FINSH_DEFAULT_PASSWORD - string "The default password for shell authentication" - default "rtthread" -config FINSH_PASSWORD_MIN - int "The password min length" - default 6 -config FINSH_PASSWORD_MAX - int "The password max length" - default RT_NAME_MAX -endif + config MSH_USING_BUILT_IN_COMMANDS + bool "Enable built-in commands, such as list_thread" + default y + + config FINSH_USING_DESCRIPTION + bool "Keeping description in symbol table" + default y + + config FINSH_ECHO_DISABLE_DEFAULT + bool "Disable the echo mode in default" + default n + + config FINSH_USING_AUTH + bool "shell support authentication" + default n + + if FINSH_USING_AUTH + config FINSH_DEFAULT_PASSWORD + string "The default password for shell authentication" + default "rtthread" + + config FINSH_PASSWORD_MIN + int "The password min length" + default 6 + + config FINSH_PASSWORD_MAX + int "The password max length" + default RT_NAME_MAX + endif -config FINSH_ARG_MAX - int "The number of arguments for a shell command" - default 10 + config FINSH_ARG_MAX + int "The number of arguments for a shell command" + default 10 endif diff --git a/components/finsh/SConscript b/components/finsh/SConscript index 1a6d7c8fc7..28fe02bac5 100644 --- a/components/finsh/SConscript +++ b/components/finsh/SConscript @@ -3,15 +3,17 @@ from building import * cwd = GetCurrentDir() src = Split(''' shell.c -cmd.c msh.c ''') +if GetDepend('MSH_USING_BUILT_IN_COMMANDS'): + src += ['cmd.c'] + if GetDepend('RT_USING_DFS'): src += ['msh_file.c'] CPPPATH = [cwd] -group = DefineGroup('msh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH) +group = DefineGroup('Finsh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH) Return('group') diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 899a6567b1..86985c561c 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -54,6 +54,7 @@ int msh_help(int argc, char **argv) } MSH_CMD_EXPORT_ALIAS(msh_help, help, RT - Thread shell help.); +#ifdef MSH_USING_BUILT_IN_COMMANDS int cmd_ps(int argc, char **argv) { extern long list_thread(void); @@ -77,13 +78,14 @@ int cmd_free(int argc, char **argv) #ifdef RT_USING_MEMHEAP_AS_HEAP list_memheap(); -#else +#else /* RT_USING_MEMHEAP_AS_HEAP */ list_mem(); #endif return 0; } MSH_CMD_EXPORT_ALIAS(cmd_free, free, Show the memory usage in the system.); -#endif +#endif /* RT_USING_HEAP */ +#endif /* MSH_USING_BUILT_IN_COMMANDS */ static int msh_split(char *cmd, rt_size_t length, char *argv[FINSH_ARG_MAX]) { @@ -270,7 +272,7 @@ int system(const char *command) return ret; } RTM_EXPORT(system); -#endif +#endif /* defined(RT_USING_MODULE) && defined(RT_USING_DFS) */ static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp) { @@ -339,7 +341,7 @@ static int _msh_exec_lwp(char *cmd, rt_size_t length) return 0; } -#endif +#endif /* defined(RT_USING_LWP) && defined(RT_USING_DFS) */ int msh_exec(char *cmd, rt_size_t length) { @@ -376,15 +378,15 @@ int msh_exec(char *cmd, rt_size_t length) { return 0; } -#endif +#endif /* RT_USING_MODULE */ #ifdef RT_USING_LWP if (_msh_exec_lwp(cmd, length) == 0) { return 0; } -#endif -#endif +#endif /* RT_USING_LWP */ +#endif /* RT_USING_DFS */ /* truncate the cmd at the first space. */ { @@ -534,7 +536,7 @@ void msh_auto_complete_path(char *path) closedir(dir); rt_free(full_path); } -#endif +#endif /* RT_USING_DFS */ void msh_auto_complete(char *prefix) { @@ -575,9 +577,9 @@ void msh_auto_complete(char *prefix) { msh_auto_complete_path(ptr); } -#endif +#endif /* RT_USING_MODULE */ } -#endif +#endif /* RT_USING_DFS */ /* checks in internal command */ { diff --git a/components/libc/compilers/common/dirent.h b/components/libc/compilers/common/dirent.h index bfba586093..a6353fd6f8 100644 --- a/components/libc/compilers/common/dirent.h +++ b/components/libc/compilers/common/dirent.h @@ -6,10 +6,14 @@ * Change Logs: * Date Author Notes */ -#ifndef __RTT_DIRENT_H__ -#define __RTT_DIRENT_H__ +#ifndef __DIRENT_H__ +#define __DIRENT_H__ -#include <rtthread.h> +#include <rtdef.h> + +#ifdef __cplusplus +extern "C" { +#endif /* * dirent.h - format of directory entries @@ -26,27 +30,28 @@ #define DT_REG 0x01 #define DT_DIR 0x02 -#ifdef __cplusplus -extern "C" { -#endif - #ifndef HAVE_DIR_STRUCTURE +#define HAVE_DIR_STRUCTURE typedef struct { int fd; /* directory file */ char buf[512]; int num; int cur; -} DIR; +}DIR; #endif #ifndef HAVE_DIRENT_STRUCTURE +#define HAVE_DIRENT_STRUCTURE + +#define DIRENT_NAME_MAX 256 + struct dirent { rt_uint8_t d_type; /* The type of the file */ rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */ rt_uint16_t d_reclen; /* length of this record */ - char d_name[256]; /* The null-terminated file name */ + char d_name[DIRENT_NAME_MAX]; /* The null-terminated file name */ }; #endif diff --git a/components/net/lwip-2.1.2/src/api/sockets.c b/components/net/lwip-2.1.2/src/api/sockets.c index 4fea5b3727..70dae165fb 100644 --- a/components/net/lwip-2.1.2/src/api/sockets.c +++ b/components/net/lwip-2.1.2/src/api/sockets.c @@ -710,7 +710,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen) err = netconn_peer(newconn, &naddr, &port); if (err != ERR_OK) { LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err)); - netconn_delete(newconn); + //netconn_delete(newconn); free_socket(nsock, 1); sock_set_errno(sock, err_to_errno(err)); done_socket(sock); |
