Add the NSH df command

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5007 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-08-04 00:37:25 +00:00
parent aa8c93baab
commit 2545e9bc4b
6 changed files with 196 additions and 96 deletions
+2
View File
@@ -268,3 +268,5 @@
* apps/nshlib/nsh_mntcmds.c: Separated mount-related commands out of * apps/nshlib/nsh_mntcmds.c: Separated mount-related commands out of
nsh_fscmds.c. Extended to the mount command so that if no arguments nsh_fscmds.c. Extended to the mount command so that if no arguments
are provided, then the current mountpoints are enumerated. are provided, then the current mountpoints are enumerated.
* apps/nshlib/nsh_mntcmds.c: Add an NSH df command to list the
properties of mounted file systems.
+30 -12
View File
@@ -308,6 +308,22 @@ o dd if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]
brw-rw-rw- 0 ram0 brw-rw-rw- 0 ram0
nsh> dd if=/dev/ram0 of=/dev/null nsh> dd if=/dev/ram0 of=/dev/null
o df
Show the state of each mounted volume
Example:
nsh> mount
/etc type romfs
/tmp type vfat
nsh> df
Block Number
Size Blocks Used Available Mounted on
64 6 6 0 /etc
512 985 2 983 /tmp
nsh>
o echo [<string|$name> [<string|$name>...]] o echo [<string|$name> [<string|$name>...]]
Copy the sequence of strings and expanded environment variables to Copy the sequence of strings and expanded environment variables to
@@ -808,6 +824,7 @@ Command Dependencies on Configuration Settings
cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0
cp CONFIG_NFILE_DESCRIPTORS > 0 cp CONFIG_NFILE_DESCRIPTORS > 0
dd CONFIG_NFILE_DESCRIPTORS > 0 dd CONFIG_NFILE_DESCRIPTORS > 0
df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3)
echo -- echo --
exec -- exec --
exit -- exit --
@@ -858,18 +875,19 @@ settings. All of these settings make the configuration of NSH potentially compl
also allow it to squeeze into very small memory footprints. also allow it to squeeze into very small memory footprints.
CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP, CONFIG_NSH_DISABLE_CAT, CONFIG_NSH_DISABLE_CD, CONFIG_NSH_DISABLE_CP,
CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_ECHO, CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_DD, CONFIG_NSH_DISABLE_DF, CONFIG_NSH_DISABLE_ECHO,
CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE, CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_EXEC, CONFIG_NSH_DISABLE_EXIT, CONFIG_NSH_DISABLE_FREE,
CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_GET, CONFIG_NSH_DISABLE_HELP, CONFIG_NSH_DISABLE_IFCONFIG,
CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS, CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_KILL, CONFIG_NSH_DISABLE_LOSETUP, CONFIG_NSH_DISABLE_LS,
CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS, CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MB, CONFIG_NSH_DISABLE_MKDIR, CONFIG_NSH_DISABLE_MKFATFS,
CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH, CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MKFIFO, CONFIG_NSH_DISABLE_MKRD, CONFIG_NSH_DISABLE_MH,
CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_MOUNT, CONFIG_NSH_DISABLE_MW, CONFIG_NSH_DISABLE_MV,
CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS, CONFIG_NSH_DISABLE_PING,
CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_PUT, CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM,
CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_RMDIR, CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH,
CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT,
CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET, CONFIG_NSH_DISABLE_XD CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET,
CONFIG_NSH_DISABLE_XD
NSH-Specific Configuration Settings NSH-Specific Configuration Settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+3
View File
@@ -508,6 +508,9 @@ void nsh_usbtrace(void);
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 # endif
# ifdef CONFIG_FS_READABLE # ifdef CONFIG_FS_READABLE
# ifndef CONFIG_NSH_DISABLE_DF
int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif
# ifndef CONFIG_NSH_DISABLE_MOUNT # ifndef CONFIG_NSH_DISABLE_MOUNT
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
# endif # endif
+48 -16
View File
@@ -76,12 +76,34 @@
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: df_handler
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
static int df_handler(FAR const char *mountpoint,
FAR struct statfs *statbuf, FAR void *arg)
{
FAR struct nsh_vtbl_s *vtbl = (FAR struct nsh_vtbl_s *)arg;
DEBUGASSERT(mountpoint && statbuf && vtbl);
nsh_output(vtbl, "%6ld %8ld %8ld %8ld %s\n",
statbuf->f_bsize, statbuf->f_blocks,
statbuf->f_blocks - statbuf->f_bavail, statbuf->f_bavail,
mountpoint);
return OK;
}
#endif
/**************************************************************************** /****************************************************************************
* Name: mount_handler * Name: mount_handler
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
#ifndef CONFIG_NSH_DISABLE_MOUNT defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
static int mount_handler(FAR const char *mountpoint, static int mount_handler(FAR const char *mountpoint,
FAR struct statfs *statbuf, FAR void *arg) FAR struct statfs *statbuf, FAR void *arg)
{ {
@@ -133,31 +155,44 @@ static int mount_handler(FAR const char *mountpoint,
return OK; return OK;
} }
#endif #endif
#endif
/**************************************************************************** /****************************************************************************
* Name: mount_show * Name: mount_show
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
#ifndef CONFIG_NSH_DISABLE_MOUNT defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
static inline int mount_show(FAR struct nsh_vtbl_s *vtbl, FAR const char *progname) static inline int mount_show(FAR struct nsh_vtbl_s *vtbl, FAR const char *progname)
{ {
return foreach_mountpoint(mount_handler, (FAR void *)vtbl); return foreach_mountpoint(mount_handler, (FAR void *)vtbl);
} }
#endif #endif
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: cmd_df
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_DF)
int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, " Block Number\n");
nsh_output(vtbl, " Size Blocks Used Available Mounted on\n");
return foreach_mountpoint(df_handler, (FAR void *)vtbl);
}
#endif
/**************************************************************************** /****************************************************************************
* Name: cmd_mount * Name: cmd_mount
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
#ifndef CONFIG_NSH_DISABLE_MOUNT defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT)
int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *source; char *source;
@@ -247,15 +282,13 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret; return ret;
} }
#endif #endif
#endif
/**************************************************************************** /****************************************************************************
* Name: cmd_nfsmount * Name: cmd_nfsmount
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && \ #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_NET) && defined(CONFIG_NFS) defined(CONFIG_NET) && defined(CONFIG_NFS) && !defined(CONFIG_NSH_DISABLE_NFSMOUNT)
#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)
{ {
struct nfs_args data; struct nfs_args data;
@@ -354,14 +387,13 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ret; return ret;
} }
#endif #endif
#endif
/**************************************************************************** /****************************************************************************
* Name: cmd_umount * Name: cmd_umount
****************************************************************************/ ****************************************************************************/
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
#ifndef CONFIG_NSH_DISABLE_UMOUNT defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_UMOUNT)
int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
char *fullpath = nsh_getfullpath(vtbl, argv[1]); char *fullpath = nsh_getfullpath(vtbl, argv[1]);
@@ -378,7 +410,7 @@ int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
} }
nsh_freefullpath(fullpath); nsh_freefullpath(fullpath);
} }
return ret; return ret;
} }
#endif #endif
#endif
+9 -4
View File
@@ -163,13 +163,18 @@ static const struct cmdmap_s g_cmdmap[] =
{ "date", cmd_date, 1, 3, "[-s \"MMM DD HH:MM:SS YYYY\"]" }, { "date", cmd_date, 1, 3, "[-s \"MMM DD HH:MM:SS YYYY\"]" },
#endif #endif
#if CONFIG_NFILE_DESCRIPTORS > 0 #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>]" }, { "dd", cmd_dd, 3, 6, "if=<infile> of=<outfile> [bs=<sectsize>] [count=<sectors>] [skip=<sectors>]" },
# endif # endif
# if defined(CONFIG_SYSLOG) && defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
#if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \
defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_DF)
{ "df", cmd_df, 1, 1, NULL },
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SYSLOG) && \
defined(CONFIG_RAMLOG_SYSLOG) && !defined(CONFIG_NSH_DISABLE_DMESG)
{ "dmesg", cmd_dmesg, 1, 1, NULL }, { "dmesg", cmd_dmesg, 1, 1, NULL },
# endif
#endif #endif
#ifndef CONFIG_NSH_DISABLE_ECHO #ifndef CONFIG_NSH_DISABLE_ECHO
+104 -64
View File
@@ -119,193 +119,199 @@
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdecho">2.7 Echo Strings and Variables (echo)</a> <a href="#cmddf">2.7 Show volume status (df)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdexec">2.8 Execute User Code (exec)</a> <a href="#cmdecho">2.8 Echo Strings and Variables (echo)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdexit">2.9 Exit NSH (exit)</a> <a href="#cmdexec">2.9 Execute User Code (exec)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdfree">2.10 Show Memory Manager Status (free)</a> <a href="#cmdexit">2.10 Exit NSH (exit)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdget">2.11 Get File Via TFTP (get)</a> <a href="#cmdfree">2.11 Show Memory Manager Status (free)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdhelp">2.12 Show Usage Command Usage (help)</a> <a href="#cmdget">2.12 Get File Via TFTP (get)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdifconfig">2.13 Show Network Configuration (ifconfig)</a> <a href="#cmdhelp">2.13 Show Usage Command Usage (help)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdkill">2.14 Send a signal to a task (kill)</a> <a href="#cmdifconfig">2.14 Show Network Configuration (ifconfig)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdlosetup">2.15 Setup/teardown the Loop Device (losetup)</a> <a href="#cmdkill">2.15 Send a signal to a task (kill)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdls">2.16 List Directory Contents (ls)</a> <a href="#cmdlosetup">2.16 Setup/teardown the Loop Device (losetup)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmbhw">2.17 Access Memory (mb, mh, and mw)</a> <a href="#cmdls">2.17 List Directory Contents (ls)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdps">2.18 Show Current Tasks and Threads (ps)</a> <a href="#cmdmbhw">2.18 Access Memory (mb, mh, and mw)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkdir">2.19 Create a Directory (mkdir)</a> <a href="#cmdps">2.19 Show Current Tasks and Threads (ps)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkfatfs">2.20 Create a FAT Filesystem (mkfatfs)</a> <a href="#cmdmkdir">2.20 Create a Directory (mkdir)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkfifo">2.21 Create a FIFO (mkfifo)</a> <a href="#cmdmkfatfs">2.21 Create a FAT Filesystem (mkfatfs)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkrd">2.22 Create a RAMDISK (mkrd)</a> <a href="#cmdmkfifo">2.22 Create a FIFO (mkfifo)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmount">2.23 Mount a File System (mount)</a> <a href="#cmdmkrd">2.23 Create a RAMDISK (mkrd)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmv">2.24 Rename a File (mv)</a> <a href="#cmdmount">2.24 Mount a File System (mount)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdnfsmount">2.25 Mount an NFS file system (nfsmount)</a> <a href="#cmdmv">2.25 Rename a File (mv)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdping">2.26 Check Network Peer (ping)</a> <a href="#cmdnfsmount">2.26 Mount an NFS file system (nfsmount)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdput">2.27 Send File Via TFTP (put)</a> <a href="#cmdping">2.27 Check Network Peer (ping)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdpwd">2.28 Show Current Working Directory (pwd)</a> <a href="#cmdput">2.28 Send File Via TFTP (put)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdrm">2.29 Remove a File (rm)</a> <a href="#cmdpwd">2.29 Show Current Working Directory (pwd)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdrmdir">2.30 Remove a Directory (rmdir)</a> <a href="#cmdrm">2.30 Remove a File (rm)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdset">2.31 Set an Environment Variable (set)</a> <a href="#cmdrmdir">2.31 Remove a Directory (rmdir)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdsh">2.32 Execute an NSH Script (sh)</a> <a href="#cmdset">2.32 Set an Environment Variable (set)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdsleep">2.33 Wait for Seconds (sleep)</a> <a href="#cmdsh">2.33 Execute an NSH Script (sh)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdunmount">2.34 Unmount a File System (umount)</a> <a href="#cmdsleep">2.34 Wait for Seconds (sleep)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdunset">2.35 Unset an Environment Variable (unset)</a> <a href="#cmdunmount">2.35 Unmount a File System (umount)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdusleep">2.36 Wait for Microseconds (usleep)</a> <a href="#cmdunset">2.36 Unset an Environment Variable (unset)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdwget">2.37 Get File Via HTTP (wget)</a> <a href="#cmdusleep">2.37 Wait for Microseconds (usleep)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdxd">2.38 Hexadecimal Dump (xd)</a> <a href="#cmdwget">2.38 Get File Via HTTP (wget)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdxd">2.39 Hexadecimal Dump (xd)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -872,7 +878,35 @@ nsh&gt; dd if=/dev/ram0 of=/dev/null
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdecho"><h2>2.7 Echo Strings and Variables (echo)</h2></a> <a name="cmddf"><h2>2.7 Show Volument Status (df)</h2></a>
</td>
</tr>
</table>
<p><b>Command Syntax:</b></p>
<ul><pre>
df
</pre></ul>
<p>
<b>Synopsis</b>.
Show the state of each mounted volume.
As an example:
</p>
<ul><pre>
nsh> mount
/etc type romfs
/tmp type vfat
nsh> df
Block Number
Size Blocks Used Available Mounted on
64 6 6 0 /etc
512 985 2 983 /tmp
nsh>
</pre></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdecho"><h2>2.8 Echo Strings and Variables (echo)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -890,7 +924,7 @@ echo [&lt;string|$name&gt; [&lt;string|$name&gt;...]]
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdexec"><h2>2.8 Execute User Code (exec)</h2></a> <a name="cmdexec"><h2>2.9 Execute User Code (exec)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -909,7 +943,7 @@ exec &lt;hex-address&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdexit"><h2>2.9 Exit NSH (exit)</h2></a> <a name="cmdexit"><h2>2.10 Exit NSH (exit)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -928,7 +962,7 @@ exit
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdfree"><h2>2.10 Show Memory Manager Status (free)</h2></a> <a name="cmdfree"><h2>2.11 Show Memory Manager Status (free)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -970,7 +1004,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdget"><h2>2.11 Get File Via TFTP (get)</h2></a> <a name="cmdget"><h2>2.12 Get File Via TFTP (get)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1005,7 +1039,7 @@ get [-b|-n] [-f &lt;local-path&gt;] -h &lt;ip-address&gt; &lt;remote-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdhelp"><h2>2.12 Show Usage Command Usage (help)</h2></a> <a name="cmdhelp"><h2>2.13 Show Usage Command Usage (help)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1022,7 +1056,7 @@ help
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdifconfig"><h2>2.13 Show Network Configuration (ifconfig)</h2></a> <a name="cmdifconfig"><h2>2.14 Show Network Configuration (ifconfig)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1073,7 +1107,7 @@ ifconfig nic_name ip_address
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdkill"><h2>2.14 Send a signal to a task (kill)</h2></a> <a name="cmdkill"><h2>2.15 Send a signal to a task (kill)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1114,7 +1148,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdlosetup"><h2>2.15 Setup/teardown the Loop Device (losetup)</h2></a> <a name="cmdlosetup"><h2>2.16 Setup/teardown the Loop Device (losetup)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1167,7 +1201,7 @@ losetup d &lt;dev-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdls"><h2>2.16 List Directory Contents (ls)</h2></a> <a name="cmdls"><h2>2.17 List Directory Contents (ls)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1204,7 +1238,7 @@ ls [-lRs] &lt;dir-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmbhw"><h2>2.17 Access Memory (mb, mh, and mw)</h2></a> <a name="cmdmbhw"><h2>2.18 Access Memory (mb, mh, and mw)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1258,7 +1292,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdps"><h2>2.18 Show Current Tasks and Threads (ps)</h2></a> <a name="cmdps"><h2>2.19 Show Current Tasks and Threads (ps)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1284,7 +1318,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkdir"><h2>2.19 Create a Directory (mkdir)</h2></a> <a name="cmdmkdir"><h2>2.20 Create a Directory (mkdir)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1319,7 +1353,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkfatfs"><h2>2.20 Create a FAT Filesystem (mkfatfs)</h2></a> <a name="cmdmkfatfs"><h2>2.21 Create a FAT Filesystem (mkfatfs)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1339,7 +1373,7 @@ mkfatfs &lt;path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkfifo"><h2>2.21 Create a FIFO (mkfifo)</h2></a> <a name="cmdmkfifo"><h2>2.22 Create a FIFO (mkfifo)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1377,7 +1411,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkrd"><h2>2.22 Create a RAMDISK (mkrd)</h2></a> <a name="cmdmkrd"><h2>2.23 Create a RAMDISK (mkrd)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1428,7 +1462,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmount"><h2>2.23 Mount a File System (mount)</h2></a> <a name="cmdmount"><h2>2.24 Mount a File System (mount)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1507,7 +1541,7 @@ nsh> mount
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmv"><h2>2.24 Rename a File (mv)</h2></a> <a name="cmdmv"><h2>2.25 Rename a File (mv)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1525,7 +1559,7 @@ mv &lt;old-path&gt; &lt;new-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdnfsmount"><h2>2.25 Mount an NFS file system (nfsmount)</h2></a> <a name="cmdnfsmount"><h2>2.26 Mount an NFS file system (nfsmount)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1544,7 +1578,7 @@ nfsmount &lt;server-address&gt; &lt;mount-point&gt; &lt;remote-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdping"><h2>2.26 Check Network Peer (ping)</h2></a> <a name="cmdping"><h2>2.27 Check Network Peer (ping)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1577,7 +1611,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdput"><h2>2.27 Send File Via TFTP (put)</h2></a> <a name="cmdput"><h2>2.28 Send File Via TFTP (put)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1612,7 +1646,7 @@ put [-b|-n] [-f &lt;remote-path&gt;] -h &lt;ip-address&gt; &lt;local-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdpwd"><h2>2.28 Show Current Working Directory (pwd)</h2></a> <a name="cmdpwd"><h2>2.29 Show Current Working Directory (pwd)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1642,7 +1676,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdrm"><h2>2.29 Remove a File (rm)</h2></a> <a name="cmdrm"><h2>2.30 Remove a File (rm)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1676,7 +1710,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdrmdir"><h2>2.30 Remove a Directory (rmdir)</h2></a> <a name="cmdrmdir"><h2>2.31 Remove a Directory (rmdir)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1711,7 +1745,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdset"><h2>2.31 Set an Environment Variable (set)</h2></a> <a name="cmdset"><h2>2.32 Set an Environment Variable (set)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1737,7 +1771,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdsh"><h2>2.32 Execute an NSH Script (sh)</h2></a> <a name="cmdsh"><h2>2.33 Execute an NSH Script (sh)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1755,7 +1789,7 @@ sh &lt;script-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdsleep"><h2>2.33 Wait for Seconds (sleep)</h2></a> <a name="cmdsleep"><h2>2.34 Wait for Seconds (sleep)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1772,7 +1806,7 @@ sleep &lt;sec&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdunmount"><h2>2.34 Unmount a File System (umount)</h2></a> <a name="cmdunmount"><h2>2.35 Unmount a File System (umount)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1802,7 +1836,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdunset"><h2>2.35 Unset an Environment Variable (unset)</h2></a> <a name="cmdunset"><h2>2.36 Unset an Environment Variable (unset)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1828,7 +1862,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdusleep"><h2>2.36 Wait for Microseconds (usleep)</h2></a> <a name="cmdusleep"><h2>2.37 Wait for Microseconds (usleep)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1872,7 +1906,7 @@ wget [-o &lt;local-path&gt;] &lt;url&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdxd"><h2>2.37 Hexadecimal dump (xd)</h2></a> <a name="cmdxd"><h2>2.38 Hexadecimal dump (xd)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@@ -1965,6 +1999,11 @@ nsh>
<td><code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td> <td><code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
<td><code>CONFIG_NSH_DISABLE_DD</code></td> <td><code>CONFIG_NSH_DISABLE_DD</code></td>
</tr> </tr>
<tr>
<td><b><code>df</code></b></td>
<td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0 &amp;&amp; <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
<td><code>CONFIG_NSH_DISABLE_DF</code></td>
</tr>
<tr> <tr>
<td><b><code>echo</code></b></td> <td><b><code>echo</code></b></td>
<td><br></td> <td><br></td>
@@ -2647,9 +2686,10 @@ nsh>
<li><a href="#currentwd">Current working directory</a></li> <li><a href="#currentwd">Current working directory</a></li>
<li><a href="#cmddate"><code>date</code></a></li> <li><a href="#cmddate"><code>date</code></a></li>
<li><a href="#cmddd"><code>dd</code></a></li> <li><a href="#cmddd"><code>dd</code></a></li>
<li><a href="#cmdecho"><code>echo</code></a></li> <li><a href="#cmddf"><code>df</code></a></li>
</ul></td> </ul></td>
<td></ul> <td></ul>
<li><a href="#cmdecho"><code>echo</code></a></li>
<li><a href="#environvars">Environment Variables</a></li> <li><a href="#environvars">Environment Variables</a></li>
<li><a href="#startupscript"><code>/etc/init.d/rcS</code></a> <li><a href="#startupscript"><code>/etc/init.d/rcS</code></a>
<li><a href="#cmdexec"><code>exec</code></a></li> <li><a href="#cmdexec"><code>exec</code></a></li>