The file system can no longer be disabled. Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS==0

This commit is contained in:
Gregory Nutt 2019-02-11 13:10:10 -06:00
parent 43e79ac329
commit 9db029e318
35 changed files with 297 additions and 489 deletions

View File

@ -1254,7 +1254,6 @@ examples/poll
stdin, and a TCP/IP socket. In order to build this test, you must the
following selected in your NuttX configuration file:
CONFIG_NFILE_DESCRIPTORS - Defined to be greater than 0
CONFIG_DISABLE_POLL - NOT defined
In order to use the TCP/IP select test, you have also the following
@ -1863,7 +1862,7 @@ examples/unionfs
nuttx/fs/unionfs/README.txt. Dependencies:
CONFIG_DISABLE_MOUNTPOINT - Mountpoint support must not be disabled
CONFIG_NFILE_DESCRIPTORS < 4 - Some file descriptors must be allocated
CONFIG_NFILE_DESCRIPTORS > 4 - Some file descriptors must be allocated
CONFIG_FS_ROMFS - ROMFS support is required
CONFIG_FS_UNIONFS - Union File System support is required

View File

@ -50,14 +50,11 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Check configuration. This is not all of the configuration settings that
* are required -- only the more obvious.
*/
#if CONFIG_NFILE_DESCRIPTORS < 1
# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file"
#endif
#ifndef CONFIG_FS_ROMFS
# error "You must select CONFIG_FS_ROMFS in your configuration file"
#endif

View File

@ -75,10 +75,6 @@
* are required -- only the more obvious.
*/
#if CONFIG_NFILE_DESCRIPTORS < 1
# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file"
#endif
#ifdef CONFIG_BINFMT_DISABLE
# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!"
#endif

View File

@ -66,8 +66,8 @@
* see the output in context.
*/
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \
CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER)
#if CONFIG_NFILE_STREAMS > 0 && CONFIG_STDIO_BUFFER_SIZE > 0 && \
!defined(CONFIG_STDIO_LINEBUFFER)
# define FFLUSH() fflush(stdout)
#else
# define FFLUSH()

View File

@ -66,10 +66,6 @@
# error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)"
#endif
#ifndef CONFIG_NFILE_DESCRIPTORS
# error "CONFIG_NFILE_DESCRIPTORS > 0 needed"
#endif
/* Provide some default values for other configuration settings */
#ifndef CONFIG_EXAMPLES_HIDKBD_DEVNAME

View File

@ -71,10 +71,6 @@
* are required -- only the more obvious.
*/
#if CONFIG_NFILE_DESCRIPTORS < 1
# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file"
#endif
#ifndef CONFIG_MODULE
# error "You must select CONFIG_MODULE in your configuration file"
#endif

View File

@ -65,10 +65,6 @@
* are required -- only the more obvious.
*/
#if CONFIG_NFILE_DESCRIPTORS < 1
# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file"
#endif
#ifdef CONFIG_BINFMT_DISABLE
# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!"
#endif

View File

@ -65,10 +65,6 @@
* are required -- only the more obvious.
*/
#if CONFIG_NFILE_DESCRIPTORS < 1
# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file"
#endif
#ifdef CONFIG_BINFMT_DISABLE
# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!"
#endif

View File

@ -81,10 +81,6 @@
* are required -- only the more obvious.
*/
#if CONFIG_NFILE_DESCRIPTORS < 1
# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file"
#endif
#ifdef CONFIG_BINFMT_DISABLE
# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file"
#endif

View File

@ -197,9 +197,7 @@ int webserver_main(int argc, char *argv[])
{
sleep(3);
printf("webserver_main: Still running\n");
#if CONFIG_NFILE_DESCRIPTORS > 0
fflush(stdout);
#endif
}
return 0;

View File

@ -65,10 +65,6 @@
# error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)"
#endif
#ifndef CONFIG_NFILE_DESCRIPTORS
# error "CONFIG_NFILE_DESCRIPTORS > 0 needed"
#endif
/* Provide some default values for other configuration settings */
#ifndef CONFIG_EXAMPLES_XBC_DEVNAME

View File

@ -36,23 +36,21 @@
* Included Files
****************************************************************************/
# include <nuttx/config.h>
#include <nuttx/config.h>
#if CONFIG_NFILE_DESCRIPTORS > 0
# include <sys/stat.h>
# include <sys/ioctl.h>
# include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
# if !defined(CONFIG_DISABLE_MOUNTPOINT)
# ifdef CONFIG_FS_SMARTFS
# include "fsutils/mksmartfs.h"
# include <nuttx/fs/ioctl.h>
# include <nuttx/fs/smart.h>
# endif
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT)
# ifdef CONFIG_FS_SMARTFS
# include "fsutils/mksmartfs.h"
# include <nuttx/fs/ioctl.h>
# include <nuttx/fs/smart.h>
# endif
#endif
# include <unistd.h>
#include <unistd.h>
/****************************************************************************
* Pre-processor Definitions

View File

@ -88,16 +88,12 @@ extern "C"
int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary,
tftp_callback_t cb, FAR void *ctx);
int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary,
tftp_callback_t cb, FAR void *ctx);
#if CONFIG_NFILE_DESCRIPTORS > 0
int tftpget(FAR const char *remote, FAR const char *local, in_addr_t addr,
bool binary);
int tftpput(FAR const char *local, FAR const char *remote, in_addr_t addr,
bool binary);
#endif
#undef EXTERN
#ifdef __cplusplus

View File

@ -38,9 +38,7 @@
# TFTP Client Library
ifeq ($(CONFIG_NET_UDP),y)
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
CSRCS += tftpc_get.c tftpc_put.c tftpc_packets.c
endif
endif
include $(APPDIR)/Application.mk

View File

@ -297,7 +297,6 @@ errout:
return result;
}
#if CONFIG_NFILE_DESCRIPTORS > 0
/****************************************************************************
* Name: tftp_write
****************************************************************************/
@ -375,4 +374,4 @@ errout:
}
#endif
#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 */
#endif /* CONFIG_NET && CONFIG_NET_UDP */

View File

@ -57,15 +57,7 @@
#include "tftpc_internal.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#if defined(CONFIG_NET) && defined(CONFIG_NET_UDP)
/****************************************************************************
* Private Functions
@ -328,4 +320,5 @@ ssize_t tftp_sendto(int sd, const void *buf, size_t len, struct sockaddr_in *to)
}
}
#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS */
#endif /* CONFIG_NET && CONFIG_NET_UDP */

View File

@ -424,7 +424,6 @@ errout:
return result;
}
#if CONFIG_NFILE_DESCRIPTORS > 0
/****************************************************************************
* Name: tftp_read
****************************************************************************/
@ -522,4 +521,4 @@ errout:
}
#endif
#endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 */
#endif /* CONFIG_NET && CONFIG_NET_UDP */

View File

@ -53,9 +53,7 @@ CSRCS += nsh_login.c
endif
endif
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
CSRCS += nsh_fsutils.c
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
CSRCS += nsh_builtin.c

View File

@ -1420,72 +1420,72 @@ Command Dependencies on Configuration Settings
base64enc CONFIG_NETUTILS_CODECS && CONFIG_CODECS_BASE64
basename --
break !CONFIG_NSH_DISABLESCRIPT && !CONFIG_NSH_DISABLE_LOOPS
cat CONFIG_NFILE_DESCRIPTORS > 0
cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
cp CONFIG_NFILE_DESCRIPTORS > 0
dd CONFIG_NFILE_DESCRIPTORS > 0
cat --
cd !CONFIG_DISABLE_ENVIRON
cp --
dd --
delroute CONFIG_NET && CONFIG_NET_ROUTE
df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3)
df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_READABLE (see note 3)
dirname --
echo --
env -- CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON
env -- CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON
exec --
exit --
export CONFIG_NSH_VARS && !CONFIG_DISABLE_ENVIRON
free --
get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && MTU >= 558 (see note 1)
get CONFIG_NET && CONFIG_NET_UDP && MTU >= 558 (see note 1)
help --
hexdump CONFIG_NFILE_DESCRIPTORS > 0
hexdump --
ifconfig CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET
ifdown CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET
ifup CONFIG_NET && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_NET
insmod CONFIG_MODULE
irqinfo CONFIG_FS_PROCFS && CONFIG_SCHED_IRQMONITOR
kill !CONFIG_DISABLE_SIGNALS
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_DEV_LOOP
ln CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PSEUDOFS_SOFTLINK
ls CONFIG_NFILE_DESCRIPTORS > 0
losetup !CONFIG_DISABLE_MOUNTPOINT && CONFIG_DEV_LOOP
ln CONFIG_PSEUDOFS_SOFTLINK
ls --
lsmod CONFIG_MODULE && CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_MODULE
md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5
mb,mh,mw ---
mkdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FSUTILS_MKFATFS
mkfifo CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PIPES && CONFIG_DEV_FIFO_SIZE > 0
mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3)
mv (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0) (see note 4)
nfsmount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET && CONFIG_NFS
mkdir (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FSUTILS_MKFATFS
mkfifo CONFIG_PIPES && CONFIG_DEV_FIFO_SIZE > 0
mkrd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE (see note 4)
mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_READABLE (see note 3)
mv (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS (see note 4)
nfsmount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NET && CONFIG_NFS
nslookup CONFIG_LIBC_NETDB && CONFIG_NETDB_DNSCLIENT
password !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD
password !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD
poweroff CONFIG_BOARDCTL_POWEROFF
ps CONFIG_FS_PROCFS && !CONFIG_FS_PROCFS_EXCLUDE_PROC
put CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && MTU >= 558 (see note 1,2)
pwd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
readlink CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_PSEUDOFS_SOFTLINK
put CONFIG_NET && CONFIG_NET_UDP && MTU >= 558 (see note 1,2)
pwd !CONFIG_DISABLE_ENVIRON
readlink CONFIG_PSEUDOFS_SOFTLINK
reboot CONFIG_BOARDCTL_RESET
rm (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
rmdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
rm (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS
rmdir (!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS
rmmod CONFIG_MODULE
route CONFIG_FS_PROCFS && CONFIG_FS_PROCFS_EXCLUDE_NET &&
!CONFIG_FS_PROCFS_EXCLUDE_ROUTE && CONFIG_NET_ROUTE &&
!CONFIG_NSH_DISABLE_ROUTE && (CONFIG_NET_IPv4 || CONFIG_NET_IPv6)
set CONFIG_NSH_VARS || !CONFIG_DISABLE_ENVIRON
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
sh CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
shutdown CONFIG_BOARDCTL_POWEROFF || CONFIG_BOARDCTL_RESET
sleep !CONFIG_DISABLE_SIGNALS
test !CONFIG_NSH_DISABLESCRIPT
telnetd CONFIG_NSH_TELNET && !CONFIG_NSH_DISABLE_TELNETD
time ---
truncate !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
truncate !CONFIG_DISABLE_MOUNTPOINT
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_READABLE
uname !CONFIG_NSH_DISABLE_UNAME
unset CONFIG_NSH_VARS || !CONFIG_DISABLE_ENVIRON
urldecode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
urlencode CONFIG_NETUTILS_CODECS && CONFIG_CODECS_URLCODE
useradd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD
userdel !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD
useradd !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD
userdel !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD
usleep !CONFIG_DISABLE_SIGNALS
get CONFIG_NET && CONFIG_NET_TCP && CONFIG_NFILE_DESCRIPTORS > 0
get CONFIG_NET && CONFIG_NET_TCP
xd ---
* NOTES:

View File

@ -557,7 +557,7 @@
/* Stubs used when working directory is not supported */
#if CONFIG_NFILE_DESCRIPTORS <= 0 || defined(CONFIG_DISABLE_ENVIRON)
#ifdef CONFIG_DISABLE_ENVIRON
# define nsh_getfullpath(v,p) ((FAR char*)(p))
# define nsh_freefullpath(p)
#endif
@ -569,10 +569,6 @@
#define NSH_HAVE_IOBUFFER 1
#if CONFIG_NFILE_DESCRIPTORS <= 0
# undef NSH_HAVE_IOBUFFER
#endif
/* The I/O buffer is needed for the ls, cp, and ps commands. It is also
* needed if the platform supplied MOTD is configured.
*/
@ -681,13 +677,6 @@
#define NSH_HAVE_TRIMDIR 1
#define NSH_HAVE_TRIMSPACES 1
#if CONFIG_NFILE_DESCRIPTORS <= 0
# undef NSH_HAVE_CATFILE
# undef NSH_HAVE_READFILE
# undef NSH_HAVE_FOREACH_DIRENTRY
# undef NSH_HAVE_TRIMDIR
#endif
#if !defined(CONFIG_FS_PROCFS) || defined(CONFIG_DISABLE_ENVIRON) || \
defined(CONFIG_FS_PROCFS_EXCLUDE_ENVIRON) || !defined(NSH_HAVE_CATFILE)
# undef CONFIG_NSH_DISABLE_ENV
@ -936,7 +925,7 @@ int nsh_usbconsole(void);
# define nsh_usbconsole() (-ENOSYS)
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path);
#ifdef CONFIG_NSH_ROMFSETC
int nsh_initscript(FAR struct nsh_vtbl_s *vtbl);
@ -969,11 +958,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline);
****************************************************************************/
#ifdef CONFIG_NSH_CONSOLE_LOGIN
# if CONFIG_NFILE_DESCRIPTORS > 0
int nsh_login(FAR struct console_stdio_s *pstate);
# else
int nsh_stdlogin(FAR struct console_stdio_s *pstate);
# endif
#endif
#ifdef CONFIG_NSH_TELNET_LOGIN
@ -994,7 +979,7 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
FAR char **argv, FAR const char *redirfile, int oflags);
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
/* Working directory support */
FAR const char *nsh_getcwd(void);
@ -1041,7 +1026,7 @@ void nsh_usbtrace(void);
int cmd_exec(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_EXPORT
int cmd_export(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_export(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_MB
int cmd_mb(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
@ -1086,235 +1071,234 @@ int cmd_irqinfo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_date(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_CAT
int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#ifndef CONFIG_NSH_DISABLE_CAT
int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_CP
int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_CMP
int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_DD
int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_LS
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SH
int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_CP
int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_CMP
int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_DD
int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_HEXDUMP
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_LS
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SH
int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */
#endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */
# ifdef NSH_HAVE_DIROPTS
#ifdef NSH_HAVE_DIROPTS
# ifndef CONFIG_NSH_DISABLE_MKDIR
int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_MV
int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_RM
int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_RMDIR
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_NFILE_STREAMS && NSH_HAVE_DIROPTS */
# endif /* NSH_HAVE_DIROPTS */
# ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP)
int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART)
int cmd_losmart(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP)
int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART)
int cmd_losmart(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \
!defined(CONFIG_NSH_DISABLE_MKFIFO)
int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifdef CONFIG_FS_READABLE
# ifdef NSH_HAVE_CATFILE
# ifndef CONFIG_NSH_DISABLE_DF
int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_MOUNT
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# ifndef CONFIG_NSH_DISABLE_UMOUNT
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifdef CONFIG_FS_WRITABLE
# ifndef CONFIG_NSH_DISABLE_MKRD
int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_FS_WRITABLE */
# endif /* CONFIG_FS_READABLE */
# ifdef CONFIG_FSUTILS_MKFATFS
# ifndef CONFIG_NSH_DISABLE_MKFATFS
int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifdef CONFIG_FS_READABLE
# ifdef NSH_HAVE_CATFILE
# ifndef CONFIG_NSH_DISABLE_DF
int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_MOUNT
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# ifndef CONFIG_NSH_DISABLE_UMOUNT
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifdef CONFIG_FS_WRITABLE
# ifndef CONFIG_NSH_DISABLE_MKRD
int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_FS_WRITABLE */
# endif /* CONFIG_FS_READABLE */
# ifdef CONFIG_FSUTILS_MKFATFS
# ifndef CONFIG_NSH_DISABLE_MKFATFS
int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_FSUTILS_MKFATFS */
# if defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS)
# ifndef CONFIG_NSH_DISABLE_MKSMARTFS
int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_FS_SMARTFS */
# ifndef CONFIG_NSH_DISABLE_TRUNCATE
int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_NSH_LOGIN_PASSWD) && defined(CONFIG_FS_WRITABLE) && \
# endif /* CONFIG_FSUTILS_MKFATFS */
# if defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS)
# ifndef CONFIG_NSH_DISABLE_MKSMARTFS
int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* CONFIG_FS_SMARTFS */
# ifndef CONFIG_NSH_DISABLE_TRUNCATE
int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_NSH_LOGIN_PASSWD) && defined(CONFIG_FS_WRITABLE) && \
!defined(CONFIG_FSUTILS_PASSWD_READONLY)
# ifndef CONFIG_NSH_DISABLE_USERADD
int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_USERDEL
int cmd_userdel(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_PASSWD
int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# endif /* !CONFIG_DISABLE_MOUNTPOINT */
# if !defined(CONFIG_DISABLE_ENVIRON)
# ifndef CONFIG_NSH_DISABLE_CD
int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_PWD
int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif /* !CONFIG_DISABLE_MOUNTPOINT */
#endif /* CONFIG_NFILE_DESCRIPTORS */
# ifndef CONFIG_NSH_DISABLE_USERADD
int cmd_useradd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_USERDEL
int cmd_userdel(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_PASSWD
int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
#if !defined(CONFIG_DISABLE_ENVIRON)
# ifndef CONFIG_NSH_DISABLE_CD
int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_PWD
int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
#endif /* !CONFIG_DISABLE_MOUNTPOINT */
#ifndef CONFIG_NSH_DISABLE_ENV
int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_NET)
# if defined(CONFIG_NET_ARP) && !defined(CONFIG_NSH_DISABLE_ARP)
int cmd_arp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_arp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_NET_ROUTE) && !defined(CONFIG_NSH_DISABLE_ADDROUTE)
int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_NET_ROUTE) && !defined(CONFIG_NSH_DISABLE_DELROUTE)
int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
# ifdef CONFIG_NET_UDP
# ifndef CONFIG_NSH_DISABLE_GET
int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_IFUPDOWN
int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_ifup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_ifdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FS_READABLE) && defined(CONFIG_NFS)
# if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \
defined(CONFIG_NFS)
# ifndef CONFIG_NSH_DISABLE_NFSMOUNT
int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
# ifdef CONFIG_NET_UDP
# ifndef CONFIG_NSH_DISABLE_PUT
int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
# ifdef CONFIG_NET_TCP
# ifndef CONFIG_NSH_DISABLE_WGET
int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
# ifndef CONFIG_NSH_DISABLE_ROUTE
int cmd_route(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_route(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# if defined(CONFIG_NSH_TELNET)
# ifndef CONFIG_NSH_DISABLE_TELNETD
int cmd_telnetd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_telnetd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# endif
#endif /* CONFIG_NET */
#if defined(CONFIG_LIBC_NETDB) && defined(CONFIG_NETDB_DNSCLIENT) && \
!defined(CONFIG_NSH_DISABLE_NSLOOKUP)
int cmd_nslookup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_nslookup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_POWEROFF)
int cmd_poweroff(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_poweroff(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if defined(CONFIG_BOARDCTL_RESET) && !defined(CONFIG_NSH_DISABLE_REBOOT)
int cmd_reboot(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_reboot(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#if (defined(CONFIG_BOARDCTL_POWEROFF) || defined(CONFIG_BOARDCTL_RESET)) && \
!defined(CONFIG_NSH_DISABLE_SHUTDOWN)
int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_UNAME
int cmd_uname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_uname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_SET
int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_NSH_DISABLE_UNSET
int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_unset(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
#endif
#ifndef CONFIG_DISABLE_SIGNALS
# ifndef CONFIG_NSH_DISABLE_KILL
int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_kill(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_SLEEP
int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_sleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_USLEEP
int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_usleep(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
#endif /* CONFIG_DISABLE_SIGNALS */
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_BASE64)
# ifndef CONFIG_NSH_DISABLE_BASE64DEC
int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_BASE64ENC
int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
#endif
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_HASH_MD5)
# ifndef CONFIG_NSH_DISABLE_MD5
int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
#endif
#if defined(CONFIG_NETUTILS_CODECS) && defined(CONFIG_CODECS_URLCODE)
# ifndef CONFIG_NSH_DISABLE_URLDECODE
int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_URLENCODE
int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
#endif

View File

@ -133,21 +133,22 @@ static const struct cmdmap_s g_cmdmap[] =
{ "break", cmd_break, 1, 1, NULL },
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_CAT
#ifndef CONFIG_NSH_DISABLE_CAT
{ "cat", cmd_cat, 2, CONFIG_NSH_MAXARGUMENTS, "<path> [<path> [<path> ...]]" },
# endif
#endif
#ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_CD
{ "cd", cmd_cd, 1, 2, "[<dir-path>|-|~|..]" },
# endif
#endif
# ifndef CONFIG_NSH_DISABLE_CP
#ifndef CONFIG_NSH_DISABLE_CP
{ "cp", cmd_cp, 3, 3, "<source-path> <dest-path>" },
# endif
# ifndef CONFIG_NSH_DISABLE_CMP
#endif
#ifndef CONFIG_NSH_DISABLE_CMP
{ "cmp", cmd_cmp, 3, 3, "<path1> <path2>" },
# endif
#endif
#ifndef CONFIG_NSH_DISABLE_DIRNAME
@ -158,7 +159,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "date", cmd_date, 1, 3, "[-s \"MMM DD HH:MM:SS YYYY\"]" },
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_DD)
#ifndef CONFIG_NSH_DISABLE_DD
{ "dd", cmd_dd, 3, 6, "if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]" },
# endif
@ -166,8 +167,8 @@ static const struct cmdmap_s g_cmdmap[] =
{ "delroute", cmd_delroute, 2, 3, "<target> [<netmask>]" },
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_DF)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \
!defined(CONFIG_NSH_DISABLE_DF)
#ifdef NSH_HAVE_CATFILE
#if defined(HAVE_DF_HUMANREADBLE) && defined(HAVE_DF_BLOCKOUTPUT)
{ "df", cmd_df, 1, 2, "[-h]" },
@ -177,8 +178,7 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_RAMLOG_SYSLOG) && \
!defined(CONFIG_NSH_DISABLE_DMESG)
#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
{ "dmesg", cmd_dmesg, 1, 1, NULL },
#endif
@ -214,7 +214,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "free", cmd_free, 1, 1, NULL },
#endif
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
# ifndef CONFIG_NSH_DISABLE_GET
{ "get", cmd_get, 4, 7, "[-b|-n] [-f <local-path>] -h <ip-address> <remote-path>" },
# endif
@ -228,7 +228,6 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
#ifndef CONFIG_NSH_CMDOPT_HEXDUMP
{ "hexdump", cmd_hexdump, 2, 2, "<file or device>" },
@ -236,7 +235,6 @@ static const struct cmdmap_s g_cmdmap[] =
{ "hexdump", cmd_hexdump, 2, 4, "<file or device> [skip=<bytes>] [count=<bytes>]" },
#endif
#endif
#endif
#ifdef CONFIG_NET
# ifndef CONFIG_NSH_DISABLE_IFCONFIG
@ -262,28 +260,24 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP)
{ "losetup", cmd_losetup, 3, 6, "[-d <dev-path>] | [[-o <offset>] [-r] <dev-path> <file-path>]" },
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART)
{ "losmart", cmd_losmart, 2, 11, "[-d <dev-path>] | [[-m <minor>] [-o <offset>] [-e <erase-size>] [-s <sect-size>] [-r] <file-path>]" },
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
# if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
#if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
{ "ln", cmd_ln, 3, 4, "[-s] <target> <link>" },
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
# ifndef CONFIG_NSH_DISABLE_LS
#ifndef CONFIG_NSH_DISABLE_LS
{ "ls", cmd_ls, 1, 5, "[-lRs] <dir-path>" },
# endif
#endif
#if defined(CONFIG_MODULE) && !defined(CONFIG_NSH_DISABLE_MODCMDS)
@ -308,14 +302,13 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FSUTILS_MKFATFS)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FSUTILS_MKFATFS)
# ifndef CONFIG_NSH_DISABLE_MKFATFS
{ "mkfatfs", cmd_mkfatfs, 2, 6, "[-F <fatsize>] [-r <rootdirentries>] <block-driver>" },
# endif
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \
!defined(CONFIG_NSH_DISABLE_MKFIFO)
{ "mkfifo", cmd_mkfifo, 2, 2, "<path>" },
@ -328,8 +321,8 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_SMARTFS) && \
defined(CONFIG_FSUTILS_MKSMARTFS)
# ifndef CONFIG_NSH_DISABLE_MKSMARTFS
# ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS
{ "mksmartfs", cmd_mksmartfs, 2, 6, "[-s <sector-size>] [-f] <path> [<num-root-directories>]" },
@ -343,7 +336,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "mh", cmd_mh, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE)
#ifndef CONFIG_NSH_DISABLE_MOUNT
#if defined(NSH_HAVE_CATFILE) && defined(HAVE_MOUNT_LIST)
{ "mount", cmd_mount, 1, 7, "[-t <fstype> [-o <options>] [<block-device>] <mount-point>]" },
@ -363,8 +356,8 @@ static const struct cmdmap_s g_cmdmap[] =
{ "mw", cmd_mw, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" },
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_NET) && defined(CONFIG_NFS)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET) && \
defined(CONFIG_NFS)
# ifndef CONFIG_NSH_DISABLE_NFSMOUNT
{ "nfsmount", cmd_nfsmount, 4, 4, "<server-address> <mount-point> <remote-path>" },
# endif
@ -375,8 +368,8 @@ static const struct cmdmap_s g_cmdmap[] =
{ "nslookup", cmd_nslookup, 2, 2, "<host-name>" },
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FS_WRITABLE) && defined(CONFIG_NSH_LOGIN_PASSWD) && \
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
defined(CONFIG_NSH_LOGIN_PASSWD) && \
!defined(CONFIG_FSUTILS_PASSWD_READONLY)
# ifndef CONFIG_NSH_DISABLE_PASSWD
{ "passwd", cmd_passwd, 3, 3, "<username> <password>" },
@ -399,22 +392,20 @@ static const struct cmdmap_s g_cmdmap[] =
{ "ps", cmd_ps, 1, 1, NULL },
#endif
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
# ifndef CONFIG_NSH_DISABLE_PUT
{ "put", cmd_put, 4, 7, "[-b|-n] [-f <remote-path>] -h <ip-address> <local-path>" },
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
# ifndef CONFIG_NSH_DISABLE_PWD
{ "pwd", cmd_pwd, 1, 1, NULL },
# endif
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
# if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
{ "readlink", cmd_readlink, 2, 2, "<link>" },
# endif
#endif
#if defined(CONFIG_BOARDCTL_RESET) && !defined(CONFIG_NSH_DISABLE_REBOOT)
@ -467,7 +458,7 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#endif /* CONFIG_NSH_DISABLE_SET */
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SH
{ "sh", cmd_sh, 2, 2, "<script-path>" },
# endif
@ -509,7 +500,7 @@ static const struct cmdmap_s g_cmdmap[] =
{ "true", cmd_true, 1, 1, NULL },
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOINT
# ifndef CONFIG_NSH_DISABLE_TRUNCATE
{ "truncate", cmd_truncate, 4, 4, "-s <length> <file-path>" },
# endif
@ -523,7 +514,7 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE)
# ifndef CONFIG_NSH_DISABLE_UMOUNT
{ "umount", cmd_umount, 2, 2, "<dir-path>" },
# endif
@ -542,8 +533,8 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FS_WRITABLE) && defined(CONFIG_NSH_LOGIN_PASSWD) && \
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
defined(CONFIG_NSH_LOGIN_PASSWD) && \
!defined(CONFIG_FSUTILS_PASSWD_READONLY)
# ifndef CONFIG_NSH_DISABLE_USERADD
{ "useradd", cmd_useradd, 3, 3, "<username> <password>" },
@ -559,7 +550,7 @@ static const struct cmdmap_s g_cmdmap[] =
# endif
#endif
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_TCP
# ifndef CONFIG_NSH_DISABLE_WGET
{ "wget", cmd_wget, 2, 4, "[-o <local-path>] <url>" },
# endif

View File

@ -82,14 +82,10 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl,
FAR const char *fmt, ...);
static FAR char *nsh_consolelinebuffer(FAR struct nsh_vtbl_s *vtbl);
#if CONFIG_NFILE_DESCRIPTORS > 0
static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd,
FAR uint8_t *save);
static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl,
FAR uint8_t *save);
#endif
static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl, int exitstatus)
noreturn_function;
@ -101,7 +97,6 @@ static void nsh_consoleexit(FAR struct nsh_vtbl_s *vtbl, int exitstatus)
* Name: nsh_openifnotopen
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static int nsh_openifnotopen(struct console_stdio_s *pstate)
{
/* The stream is open in a lazy fashion. This is done because the file
@ -126,7 +121,6 @@ static int nsh_openifnotopen(struct console_stdio_s *pstate)
return 0;
}
#endif
/****************************************************************************
* Name: nsh_closeifnotclosed
@ -177,7 +171,6 @@ static void nsh_closeifnotclosed(struct console_stdio_s *pstate)
static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
FAR const void *buffer, size_t nbytes)
{
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
ssize_t ret;
@ -205,12 +198,6 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
fflush(pstate->cn_outstream);
return ret;
#else
/* REVISIT: buffer may not be NUL-terminated */
printf("%s", buffer);
return nbytes;
#endif
}
/****************************************************************************
@ -224,7 +211,6 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
FAR const char *fmt, ...)
{
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
va_list ap;
int ret;
@ -244,31 +230,6 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
va_end(ap);
return ret;
#else
va_list ap;
char *str;
/* Use vasprintf() to allocate a buffer and fill it with the formatted
* data
*/
va_start(ap, fmt);
str = NULL;
(void)vasprintf(&str, fmt, ap);
/* Was a string allocated? */
if (str)
{
/* Yes.. Print then free the allocated string */
printf("%s", str);
free(str);
}
va_end(ap);
return 0;
#endif
}
/****************************************************************************
@ -282,7 +243,6 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl,
FAR const char *fmt, ...)
{
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
va_list ap;
int ret;
@ -302,31 +262,6 @@ static int nsh_erroroutput(FAR struct nsh_vtbl_s *vtbl,
va_end(ap);
return ret;
#else
va_list ap;
char *str;
/* Use vasprintf() to allocate a buffer and fill it with the formatted
* data
*/
va_start(ap, fmt);
str = NULL;
(void)vasprintf(&str, fmt, ap);
/* Was a string allocated? */
if (str)
{
/* Yes.. Print then free the allocated string */
printf("%s", str);
free(str);
}
va_end(ap);
return 0;
#endif
}
/****************************************************************************
@ -371,7 +306,6 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
{
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Close the output stream */
nsh_closeifnotclosed(pstate);
@ -381,7 +315,6 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
#ifdef CONFIG_NSH_ALTCONDEV
(void)fclose(pstate->cn_constream);
#endif
#endif
#ifdef CONFIG_NSH_VARS
/* Free any NSH variables */
@ -427,7 +360,6 @@ static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl)
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd,
FAR uint8_t *save)
{
@ -473,7 +405,6 @@ static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd,
pstate->cn_outfd = fd;
pstate->cn_outstream = NULL;
}
#endif
/****************************************************************************
* Name: nsh_consoleundirect
@ -483,8 +414,8 @@ static void nsh_consoleredirect(FAR struct nsh_vtbl_s *vtbl, int fd,
*
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save)
static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl,
FAR uint8_t *save)
{
FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
FAR struct serialsave_s *ssave = (FAR struct serialsave_s *)save;
@ -495,7 +426,6 @@ static void nsh_consoleundirect(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save)
pstate->cn_errstream = ssave->cn_errstream;
pstate->cn_outstream = ssave->cn_outstream;
}
#endif
/****************************************************************************
* Name: nsh_consoleexit

View File

@ -127,10 +127,8 @@ struct nsh_vtbl_s
int (*error)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
int (*output)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
#if CONFIG_NFILE_DESCRIPTORS > 0
void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
void (*undirect)(FAR struct nsh_vtbl_s *vtbl, FAR uint8_t *save);
#endif
void (*exit)(FAR struct nsh_vtbl_s *vtbl, int exitstatus) noreturn_function;
#ifdef NSH_HAVE_IOBUFFER

View File

@ -46,10 +46,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#if CONFIG_NFILE_DESCRIPTORS > 0
# include <fcntl.h>
#endif
#include <fcntl.h>
#include "nsh.h"
#include "nsh_console.h"
@ -368,7 +365,6 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
* Name: cmd_hexdump, hex dump of files
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_NSH_DISABLE_HEXDUMP
int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
{
@ -500,7 +496,6 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
return ret;
}
#endif
#endif
/****************************************************************************
* Name: cmd_irqinfo

View File

@ -55,7 +55,7 @@
#include "nsh.h"
#include "nsh_console.h"
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_DD)
#ifndef CONFIG_NSH_DISABLE_DD
/****************************************************************************
* Pre-processor Definitions
@ -404,4 +404,4 @@ errout_with_paths:
return ret;
}
#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_NSH_DISABLE_DD */
#endif /* !CONFIG_NSH_DISABLE_DD */

View File

@ -54,7 +54,7 @@
* Private Data
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
static const char g_pwd[] = "PWD";
#ifndef CONFIG_NSH_DISABLE_CD
static const char g_oldpwd[] = "OLDPWD";
@ -70,7 +70,7 @@ static const char g_home[] = CONFIG_LIB_HOMEDIR;
* Name: nsh_getwd
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
static inline FAR const char *nsh_getwd(const char *wd)
{
const char *val;
@ -147,7 +147,7 @@ static int nsh_dumpvar(FAR struct nsh_vtbl_s *vtbl, FAR void *arg,
* Name: nsh_getwd
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
FAR const char *nsh_getcwd(void)
{
return nsh_getwd(g_pwd);
@ -158,7 +158,7 @@ FAR const char *nsh_getcwd(void)
* Name: nsh_getfullpath
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
FAR char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl,
FAR const char *relpath)
{
@ -198,7 +198,7 @@ FAR char *nsh_getfullpath(FAR struct nsh_vtbl_s *vtbl,
* Name: nsh_freefullpath
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
void nsh_freefullpath(FAR char *fullpath)
{
if (fullpath)
@ -212,7 +212,7 @@ void nsh_freefullpath(FAR char *fullpath)
* Name: cmd_cd
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
#ifndef CONFIG_NSH_DISABLE_CD
int cmd_cd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -323,7 +323,7 @@ int cmd_env(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_pwd
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)
#ifndef CONFIG_DISABLE_ENVIRON
#ifndef CONFIG_NSH_DISABLE_PWD
int cmd_pwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{

View File

@ -44,34 +44,32 @@
#include <stdint.h>
#include <stdbool.h>
#if CONFIG_NFILE_DESCRIPTORS > 0
# include <sys/stat.h>
# include <fcntl.h>
# if !defined(CONFIG_DISABLE_MOUNTPOINT)
# ifdef CONFIG_FS_READABLE /* Need at least one filesytem in configuration */
# include <sys/mount.h>
# include <nuttx/drivers/ramdisk.h>
# endif
# ifdef CONFIG_DEV_LOOP
# include <sys/ioctl.h>
# include <nuttx/fs/loop.h>
# endif
# ifdef CONFIG_FS_SMARTFS
# include "fsutils/mksmartfs.h"
# endif
# ifdef CONFIG_SMART_DEV_LOOP
# include <sys/ioctl.h>
# include <nuttx/fs/smart.h>
# endif
# ifdef CONFIG_NFS
# include <sys/socket.h>
# include <netinet/in.h>
# include <nuttx/fs/nfs.h>
# endif
# ifdef CONFIG_RAMLOG_SYSLOG
# include <nuttx/syslog/ramlog.h>
# endif
#endif
#include <sys/stat.h>
#include <fcntl.h>
#if !defined(CONFIG_DISABLE_MOUNTPOINT)
# ifdef CONFIG_FS_READABLE /* Need at least one filesytem in configuration */
# include <sys/mount.h>
# include <nuttx/drivers/ramdisk.h>
# endif
# ifdef CONFIG_DEV_LOOP
# include <sys/ioctl.h>
# include <nuttx/fs/loop.h>
# endif
# ifdef CONFIG_FS_SMARTFS
# include "fsutils/mksmartfs.h"
# endif
# ifdef CONFIG_SMART_DEV_LOOP
# include <sys/ioctl.h>
# include <nuttx/fs/smart.h>
# endif
# ifdef CONFIG_NFS
# include <sys/socket.h>
# include <netinet/in.h>
# include <nuttx/fs/nfs.h>
# endif
# ifdef CONFIG_RAMLOG_SYSLOG
# include <nuttx/syslog/ramlog.h>
# endif
#endif
#include <stdio.h>
@ -107,8 +105,7 @@
* Name: nsh_getdirpath
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && \
(!defined(CONFIG_NSH_DISABLE_LS) || !defined(CONFIG_NSH_DISABLE_CP))
#if !defined(CONFIG_NSH_DISABLE_LS) || !defined(CONFIG_NSH_DISABLE_CP)
static char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
FAR const char *path, FAR const char *file)
{
@ -143,7 +140,7 @@ static inline int ls_specialdir(const char *dir)
* Name: ls_handler
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_LS)
#if !defined(CONFIG_NSH_DISABLE_LS)
static int ls_handler(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
FAR struct dirent *entryp, FAR void *pvarg)
{
@ -353,7 +350,7 @@ static int ls_handler(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
* Name: ls_recursive
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_NSH_DISABLE_LS)
#if !defined(CONFIG_NSH_DISABLE_LS)
static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath,
struct dirent *entryp, void *pvarg)
{
@ -388,7 +385,7 @@ static int ls_recursive(FAR struct nsh_vtbl_s *vtbl, const char *dirpath,
return ret;
}
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 && !CONFIG_NSH_DISABLE_LS */
#endif /* !CONFIG_NSH_DISABLE_LS */
/****************************************************************************
* Public Functions
@ -458,7 +455,6 @@ int cmd_dirname(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_cat
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_NSH_DISABLE_CAT
int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -493,14 +489,12 @@ int cmd_cat(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret;
}
#endif
#endif
/****************************************************************************
* Name: cmd_dmesg
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_RAMLOG_SYSLOG) && \
!defined(CONFIG_NSH_DISABLE_DMESG)
#if defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
return nsh_catfile(vtbl, argv[0], CONFIG_SYSLOG_DEVPATH);
@ -511,7 +505,6 @@ int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_cp
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_NSH_DISABLE_CP
int cmd_cp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -689,13 +682,12 @@ errout:
return ret;
}
#endif
#endif
/****************************************************************************
* Name: cmd_losetup
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSETUP)
int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -849,7 +841,7 @@ errout_with_paths:
* Name: cmd_losmart
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)
#ifndef CONFIG_DISABLE_MOUNTPOINT
# if defined(CONFIG_SMART_DEV_LOOP) && !defined(CONFIG_NSH_DISABLE_LOSMART)
int cmd_losmart(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1016,8 +1008,7 @@ errout_with_paths:
* Name: cmd_ln
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
# if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
#if !defined(CONFIG_NSH_DISABLE_LN) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR char *linkpath;
@ -1076,13 +1067,11 @@ errout_with_nomemory:
return ERROR;
}
#endif
#endif
/****************************************************************************
* Name: cmd_ls
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_NSH_DISABLE_LS
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1203,7 +1192,6 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret;
}
#endif
#endif
/****************************************************************************
* Name: cmd_mkdir
@ -1236,8 +1224,7 @@ int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_mkfatfs
****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FSUTILS_MKFATFS)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FSUTILS_MKFATFS)
#ifndef CONFIG_NSH_DISABLE_MKFATFS
int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1333,8 +1320,7 @@ int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_mkfifo
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
# if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \
#if defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0 && \
!defined(CONFIG_NSH_DISABLE_MKFIFO)
int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1355,7 +1341,6 @@ int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret;
}
#endif /* CONFIG_PIPES && CONFIG_DEV_FIFO_SIZE > 0 && !CONFIG_NSH_DISABLE_MKFIFO */
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
/****************************************************************************
* Name: cmd_mkrd
@ -1473,8 +1458,8 @@ errout_with_fmt:
* Name: cmd_mksmartfs
****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FS_SMARTFS) && defined(CONFIG_FSUTILS_MKSMARTFS)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_SMARTFS) && \
defined(CONFIG_FSUTILS_MKSMARTFS)
#ifndef CONFIG_NSH_DISABLE_MKSMARTFS
int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1612,8 +1597,7 @@ errout_with_oldpath:
* Name: cmd_readlink
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
# if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
#if !defined(CONFIG_NSH_DISABLE_READLINK) && defined(CONFIG_PSEUDOFS_SOFTLINKS)
int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR char *fullpath;
@ -1642,7 +1626,6 @@ int cmd_readlink(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return OK;
}
#endif
#endif
/****************************************************************************
* Name: cmd_rm
@ -1702,7 +1685,7 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_sh
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
#ifndef CONFIG_NSH_DISABLE_SH
int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1715,7 +1698,6 @@ int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_cmp
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_NSH_DISABLE_CMP
int cmd_cmp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1821,13 +1803,12 @@ errout:
return ret;
}
#endif
#endif
/****************************************************************************
* Name: cmd_truncate
****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
#ifndef CONFIG_DISABLE_MOUNTPOINT
#ifndef CONFIG_NSH_DISABLE_TRUNCATE
int cmd_truncate(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{

View File

@ -66,8 +66,8 @@
* Name: cmd_df
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_DF)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \
!defined(CONFIG_NSH_DISABLE_DF)
#ifdef NSH_HAVE_CATFILE
int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -97,8 +97,8 @@ int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_mount
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \
!defined(CONFIG_NSH_DISABLE_MOUNT)
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
FAR const char *source;
@ -249,8 +249,8 @@ errout:
* Name: cmd_nfsmount
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_NET) && defined(CONFIG_NFS) && !defined(CONFIG_NSH_DISABLE_NFSMOUNT)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET) && \
defined(CONFIG_NFS) && !defined(CONFIG_NSH_DISABLE_NFSMOUNT)
int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
struct nfs_args data;
@ -354,8 +354,8 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_umount
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_UMOUNT)
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE) && \
!defined(CONFIG_NSH_DISABLE_UMOUNT)
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
char *fullpath = nsh_getfullpath(vtbl, argv[1]);

View File

@ -89,14 +89,14 @@
# include "netutils/netlib.h"
#endif
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
# include "netutils/netlib.h"
# if !defined(CONFIG_NSH_DISABLE_GET) || !defined(CONFIG_NSH_DISABLE_PUT)
# include "netutils/tftp.h"
# endif
#endif
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifidef CONFIG_NET_TCP
# ifndef CONFIG_NSH_DISABLE_WGET
# include "netutils/webclient.h"
# endif
@ -151,7 +151,7 @@ typedef struct pktradio_addr_s mac_addr_t;
#endif
#endif
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
struct tftpc_args_s
{
bool binary; /* true:binary ("octet") false:text ("netascii") */
@ -212,7 +212,7 @@ static int ifconfig_callback(FAR struct nsh_vtbl_s *vtbl, FAR char *devname)
* Name: tftpc_parseargs
****************************************************************************/
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
int tftpc_parseargs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv,
struct tftpc_args_s *args)
{
@ -349,7 +349,7 @@ errout:
* Name: wget_callback
****************************************************************************/
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_TCP
#ifndef CONFIG_NSH_DISABLE_WGET
static void wget_callback(FAR char **buffer, int offset, int datend,
FAR int *buflen, FAR void *arg)
@ -457,7 +457,7 @@ static inline void nsh_sethwaddr(FAR const char *ifname, FAR mac_addr_t *macaddr
* Name: cmd_get
****************************************************************************/
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
#ifndef CONFIG_NSH_DISABLE_GET
int cmd_get(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1159,7 +1159,7 @@ errout_invalid:
* Name: cmd_put
****************************************************************************/
#if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_UDP
#ifndef CONFIG_NSH_DISABLE_PUT
int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
@ -1201,7 +1201,7 @@ int cmd_put(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* Name: cmd_wget
****************************************************************************/
#if defined(CONFIG_NET_TCP) && CONFIG_NFILE_DESCRIPTORS > 0
#ifdef CONFIG_NET_TCP
#ifndef CONFIG_NSH_DISABLE_WGET
int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{

View File

@ -44,8 +44,8 @@
#include "nsh.h"
#include "nsh_console.h"
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \
defined(CONFIG_FS_WRITABLE) && defined(CONFIG_NSH_LOGIN_PASSWD) && \
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
defined(CONFIG_NSH_LOGIN_PASSWD) && \
!defined(CONFIG_FSUTILS_PASSWD_READONLY)
/****************************************************************************
@ -115,6 +115,5 @@ int cmd_passwd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
}
#endif /* !CONFIG_NSH_DISABLE_USERADD */
#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 &&
* CONFIG_FS_WRITABLE && CONFIG_NSH_LOGIN_PASSWD &&
* !CONFIG_FSUTILS_PASSWD_READONLY */
#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE &&
* CONFIG_NSH_LOGIN_PASSWD && !CONFIG_FSUTILS_PASSWD_READONLY */

View File

@ -42,8 +42,7 @@
#include "nsh.h"
#include "nsh_console.h"
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \
!defined(CONFIG_NSH_DISABLESCRIPT)
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
/****************************************************************************
* Public Functions
@ -213,4 +212,4 @@ int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl)
#endif
#endif /* CONFIG_NSH_ROMFSETC */
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT */
#endif /* CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT */

View File

@ -244,12 +244,7 @@ static int nsh_task(void)
* is wrong.
*/
#if CONFIG_NFILE_DESCRIPTORS > 0
fprintf(stderr, "ERROR: nsh_consolemain() returned: %d\n", ret);
#else
printf("ERROR: nsh_consolemain() returned: %d\n", ret);
#endif
exitval = 1;
#endif

View File

@ -47,8 +47,6 @@
* Private Data
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static FAR char buffer[1024];
/****************************************************************************
@ -91,4 +89,3 @@ int dev_null(void)
return 0;
}
#endif /*CONFIG_NFILE_DESCRIPTORS */

View File

@ -97,8 +97,8 @@
# define CONFIG_STDIO_BUFFER_SIZE 0
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \
CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER)
#if CONFIG_NFILE_STREAMS > 0 && CONFIG_STDIO_BUFFER_SIZE > 0 && \
!defined(CONFIG_STDIO_LINEBUFFER)
# define FFLUSH() fflush(stdout)
#else
# define FFLUSH()

View File

@ -75,10 +75,8 @@ static const char arg2[] = "Arg2";
static const char arg3[] = "Arg3";
static const char arg4[] = "Arg4";
#if CONFIG_NFILE_DESCRIPTORS > 0
static const char write_data1[] = "stdio_test: write fd=1\n";
static const char write_data2[] = "stdio_test: write fd=2\n";
#endif
#ifdef SDCC
/* I am not yet certain why SDCC does not like the following
@ -323,13 +321,11 @@ static int user_main(int argc, char *argv[])
check_test_memory_usage();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Checkout /dev/null */
printf("\nuser_main: /dev/null test\n");
dev_null();
check_test_memory_usage();
#endif
#ifdef CONFIG_TESTING_OSTEST_AIO
/* Check asynchronous I/O */
@ -577,14 +573,10 @@ static void stdio_test(void)
{
/* Verify that we can communicate */
#if CONFIG_NFILE_DESCRIPTORS > 0
write(1, write_data1, sizeof(write_data1)-1);
#endif
printf("stdio_test: Standard I/O Check: printf\n");
#if CONFIG_NFILE_DESCRIPTORS > 1
write(2, write_data2, sizeof(write_data2)-1);
#endif
#if CONFIG_NFILE_STREAMS > 0
fprintf(stderr, "stdio_test: Standard I/O Check: fprintf to stderr\n");
#endif