unlink/rm can now be used on nodes in the pseudo-filesystem. There is new configuration option to suppress these costly and mostly useless operations on the pseudo-filesystem
This commit is contained in:
parent
da0235e8e6
commit
2bc6d67866
@ -831,6 +831,12 @@
|
||||
* apps/nshlib: 'mkdir' can now be used in the pseudo-filesystem. Hence,
|
||||
the command needs to be available even if there are no write-able
|
||||
filesystem enabled (2014-2-19).
|
||||
* apps/nshlib: 'rename' can now be used in the pseudo-filesystem. Hence,
|
||||
* apps/nshlib: 'mv' can now be used in the pseudo-filesystem. Hence,
|
||||
the 'mv' command needs to be available even if there are no write-able
|
||||
filesystem enabled (2014-2-19).
|
||||
* apps/nshlib: 'rm' can now be used to remove nodes frm the pseudo-
|
||||
filesystem. Hence, the 'rm' command needs to be available even if there
|
||||
are no write-able filesystem enabled (2014-2-20).
|
||||
* CONFIG_DISABLE_PSEUDOFS_OPERATIONS: This new configuration setting
|
||||
basically backs out the recent changes to mv, rm, mkdir, and rmdir
|
||||
(2014-2-20).
|
||||
|
@ -304,6 +304,7 @@ config NSH_DISABLE_SEMICOLON
|
||||
config NSH_CMDPARMS
|
||||
bool "Enable commands as parameters"
|
||||
default n
|
||||
depends on !DISABLE_MOUNTPOINT
|
||||
---help---
|
||||
If selected, then the output from commands, from file applications, and
|
||||
from NSH built-in commands can be used as arguments to other
|
||||
@ -316,7 +317,7 @@ config NSH_CMDPARMS
|
||||
environment variable BAR. The value of the environment variable FOO
|
||||
is then set output of myprogram on stdout.
|
||||
|
||||
Because this feature commits significant resourse, it is disabled by
|
||||
Because this feature commits significant resources, it is disabled by
|
||||
default.
|
||||
|
||||
config NSH_TMPDIR
|
||||
|
@ -972,19 +972,19 @@ Command Dependencies on Configuration Settings
|
||||
ls CONFIG_NFILE_DESCRIPTORS > 0
|
||||
md5 CONFIG_NETUTILS_CODECS && CONFIG_CODECS_HASH_MD5
|
||||
mb,mh,mw ---
|
||||
mkdir CONFIG_NFILE_DESCRIPTORS > 0
|
||||
mkdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
|
||||
mkfatfs !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT
|
||||
mkfifo CONFIG_NFILE_DESCRIPTORS > 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_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
|
||||
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
|
||||
ping CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING && !CONFIG_DISABLE_CLOCK && !CONFIG_DISABLE_SIGNALS
|
||||
ps --
|
||||
put CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1,2)
|
||||
pwd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
rm !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4)
|
||||
rmdir CONFIG_NFILE_DESCRIPTORS > 0
|
||||
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)
|
||||
set !CONFIG_DISABLE_ENVIRON
|
||||
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
|
||||
sleep !CONFIG_DISABLE_SIGNALS
|
||||
|
49
nshlib/nsh.h
49
nshlib/nsh.h
@ -75,6 +75,27 @@
|
||||
# undef CONFIG_NSH_CMDPARMS
|
||||
#endif
|
||||
|
||||
/* rmdir, mkdir, rm, and mv are only available if mountpoints are enabled
|
||||
* AND there is a writeable file system OR if these operations on the
|
||||
* pseudo-filesystem are not disabled.
|
||||
*/
|
||||
|
||||
#undef NSH_HAVE_WRITABLE_MOUNTPOINT
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
|
||||
CONFIG_NFILE_STREAMS > 0
|
||||
# define NSH_HAVE_WRITABLE_MOUNTPOINT 1
|
||||
#endif
|
||||
|
||||
#undef NSH_HAVE_PSEUDOFS_OPERATIONS
|
||||
#if !defined(CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_STREAMS > 0
|
||||
# define NSH_HAVE_PSEUDOFS_OPERATIONS 1
|
||||
#endif
|
||||
|
||||
#undef NSH_HAVE_DIROPTS
|
||||
#if defined(NSH_HAVE_WRITABLE_MOUNTPOINT) || defined(NSH_HAVE_PSEUDOFS_OPERATIONS)
|
||||
# define NSH_HAVE_DIROPTS 1
|
||||
#endif
|
||||
|
||||
/* If CONFIG_NSH_CMDPARMS is selected, then the path to a directory to
|
||||
* hold temporary files must be provided.
|
||||
*/
|
||||
@ -717,15 +738,6 @@ void nsh_usbtrace(void);
|
||||
# ifndef CONFIG_NSH_DISABLE_LS
|
||||
int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
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);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_RMDIR
|
||||
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# if defined(CONFIG_SYSLOG) && defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
|
||||
int cmd_dmesg(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
@ -734,6 +746,22 @@ void nsh_usbtrace(void);
|
||||
int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
# endif
|
||||
# endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */
|
||||
|
||||
# ifdef NSH_HAVE_DIROPTS
|
||||
# ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
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);
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_DISABLE_RM
|
||||
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);
|
||||
# endif
|
||||
# endif /* CONFIG_NFILE_STREAMS && NSH_HAVE_DIROPTS */
|
||||
|
||||
# ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
# ifndef CONFIG_NSH_DISABLE_LOSETUP
|
||||
int cmd_losetup(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
@ -755,9 +783,6 @@ void nsh_usbtrace(void);
|
||||
# ifndef CONFIG_NSH_DISABLE_MKRD
|
||||
int cmd_mkrd(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);
|
||||
# endif
|
||||
# endif /* CONFIG_FS_WRITABLE */
|
||||
# endif /* CONFIG_FS_READABLE */
|
||||
# ifdef CONFIG_FS_FAT
|
||||
|
@ -252,7 +252,7 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
# ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||
# endif
|
||||
@ -270,7 +270,7 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifdef NSH_HAVE_WRITABLE_MOUNTPOINT
|
||||
# ifndef CONFIG_NSH_DISABLE_MKRD
|
||||
{ "mkrd", cmd_mkrd, 2, 6, "[-m <minor>] [-s <sector-size>] <nsectors>" },
|
||||
# endif
|
||||
@ -300,7 +300,7 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
# ifndef CONFIG_NSH_DISABLE_MV
|
||||
{ "mv", cmd_mv, 3, 3, "<old-path> <new-path>" },
|
||||
# endif
|
||||
@ -340,13 +340,13 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
# ifndef CONFIG_NSH_DISABLE_RM
|
||||
{ "rm", cmd_rm, 2, 2, "<file-path>" },
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
# ifndef CONFIG_NSH_DISABLE_RMDIR
|
||||
{ "rmdir", cmd_rmdir, 2, 2, "<dir-path>" },
|
||||
# endif
|
||||
|
@ -995,7 +995,7 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_mkdir
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
#ifndef CONFIG_NSH_DISABLE_MKDIR
|
||||
int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
@ -1136,7 +1136,7 @@ int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_mkrd
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifdef NSH_HAVE_WRITABLE_MOUNTPOINT
|
||||
#ifndef CONFIG_NSH_DISABLE_MKRD
|
||||
int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
@ -1298,7 +1298,7 @@ int cmd_mksmartfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_mv
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
#ifndef CONFIG_NSH_DISABLE_MV
|
||||
int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
@ -1342,7 +1342,7 @@ int cmd_mv(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_rm
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE)
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
#ifndef CONFIG_NSH_DISABLE_RM
|
||||
int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
@ -1369,7 +1369,7 @@ int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
* Name: cmd_rmdir
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#ifdef NSH_HAVE_DIROPTS
|
||||
#ifndef CONFIG_NSH_DISABLE_RMDIR
|
||||
int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user