diff options
Diffstat (limited to 'nuttx/examples')
-rw-r--r-- | nuttx/examples/mount/mount.h | 3 | ||||
-rw-r--r-- | nuttx/examples/mount/ramdisk.c | 2 | ||||
-rw-r--r-- | nuttx/examples/nsh/README.txt | 28 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh.h | 16 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_fscmds.c | 26 | ||||
-rw-r--r-- | nuttx/examples/nsh/nsh_main.c | 18 |
6 files changed, 52 insertions, 41 deletions
diff --git a/nuttx/examples/mount/mount.h b/nuttx/examples/mount/mount.h index 5a2ab61cd..68a03674d 100644 --- a/nuttx/examples/mount/mount.h +++ b/nuttx/examples/mount/mount.h @@ -49,6 +49,9 @@ /* Configure the test */ #if defined(CONFIG_EXAMPLES_MOUNT_DEVNAME) +# if !defined(CONFIG_FS_WRITABLE) +# error "Writable filesystem required in this configuration" +# endif # undef CONFIG_EXAMPLES_MOUNT_NSECTORS # undef CONFIG_EXAMPLES_MOUNT_SECTORSIZE # undef CONFIG_EXAMPLES_MOUNT_RAMDEVNO diff --git a/nuttx/examples/mount/ramdisk.c b/nuttx/examples/mount/ramdisk.c index 905c56492..ca3846053 100644 --- a/nuttx/examples/mount/ramdisk.c +++ b/nuttx/examples/mount/ramdisk.c @@ -112,7 +112,7 @@ int create_ramdisk(void) /* Register a RAMDISK device to manage this RAM image */ - ret = rd_register(CONFIG_EXAMPLES_MOUNT_RAMDEVNO, + ret = ramdisk_register(CONFIG_EXAMPLES_MOUNT_RAMDEVNO, pbuffer, CONFIG_EXAMPLES_MOUNT_NSECTORS, CONFIG_EXAMPLES_MOUNT_SECTORSIZE, diff --git a/nuttx/examples/nsh/README.txt b/nuttx/examples/nsh/README.txt index 69187f1a3..31ec155cd 100644 --- a/nuttx/examples/nsh/README.txt +++ b/nuttx/examples/nsh/README.txt @@ -589,36 +589,42 @@ Command Dependencies on Configuration Settings echo -- exec -- exit -- - get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558* + get CONFIG_NET && CONFIG_NET_UDP && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NET_BUFSIZE >= 558 (see note 1) help -- ifconfig CONFIG_NET ls CONFIG_NFILE_DESCRIPTORS > 0 mb,mh,mw --- mem --- - mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 + mkdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) 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_FAT - mount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT + 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) 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* + 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 - rmdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 + rm !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) + rmdir !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_WRITABLE (see note 4) set !CONFIG_DISABLE_ENVIRON sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT sleep !CONFIG_DISABLE_SIGNALS test !CONFIG_EXAMPLES_NSH_DISABLESCRIPT - umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_FAT + umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE unset !CONFIG_DISABLE_ENVIRON usleep !CONFIG_DISABLE_SIGNALS xd --- * NOTES: - - Because of hardware padding, the actual required size may be larger. - - Special TFTP server start-up optionss will probably be required to permit - creation of file for the correct operation of the put command. + 1. Because of hardware padding, the actual required for put and get + operations size may be larger. + 2. Special TFTP server start-up optionss will probably be required to permit + creation of file for the correct operation of the put command. + 3. CONFIG_FS_READABLE is not a user configuration but is set automatically + if any readable filesystem is selected. At present, this is either CONFIG_FS_FAT + and CONFIG_FS_ROMFS. + 4. CONFIG_FS_WRITABLE is not a user configuration but is set automatically + if any writable filesystem is selected. At present, this is only CONFIG_FS_FAT. NSH-Specific Configuration Settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h index d8d18a72a..e35084ead 100644 --- a/nuttx/examples/nsh/nsh.h +++ b/nuttx/examples/nsh/nsh.h @@ -288,15 +288,19 @@ extern int cmd_lbracket(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif /* CONFIG_NFILE_STREAMS && !CONFIG_EXAMPLES_NSH_DISABLESCRIPT */ # ifndef CONFIG_DISABLE_MOUNTPOINT - extern int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_mkfifo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); - extern int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); - extern int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); - extern int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# ifdef CONFIG_FS_FAT - extern int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# ifdef CONFIG_FS_READABLE extern int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); extern int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# ifdef CONFIG_FS_WRITABLE + extern int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + extern int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + extern int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); + extern int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +# endif /* CONFIG_FS_WRITABLE */ +# endif /* CONFIG_FS_READABLE */ +# ifdef CONFIG_FS_FAT + extern int cmd_mkfatfs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); # endif /* CONFIG_FS_FAT */ # endif /* !CONFIG_DISABLE_MOUNTPOINT */ # if !defined(CONFIG_DISABLE_ENVIRON) diff --git a/nuttx/examples/nsh/nsh_fscmds.c b/nuttx/examples/nsh/nsh_fscmds.c index 43ef483a6..d38d9b720 100644 --- a/nuttx/examples/nsh/nsh_fscmds.c +++ b/nuttx/examples/nsh/nsh_fscmds.c @@ -44,11 +44,13 @@ # include <sys/stat.h> # include <fcntl.h> # if !defined(CONFIG_DISABLE_MOUNTPOINT) -# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +# ifdef CONFIG_FS_READABLE /* Need at least one filesytem in configuration */ # include <sys/mount.h> +# include <nuttx/ramdisk.h> +# endif +# ifdef CONFIG_FS_FAT # include <nuttx/mkfatfs.h> # endif -# include <nuttx/ramdisk.h> #endif #endif @@ -711,7 +713,7 @@ int cmd_ls(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_mkdir ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) int cmd_mkdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { char *fullpath = nsh_getfullpath(vtbl, argv[1]); @@ -781,7 +783,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 +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { const char *fmt; @@ -860,10 +862,10 @@ int cmd_mkrd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) /* Then register the ramdisk */ - ret = rd_register(minor, buffer, nsectors, sectsize, TRUE); + ret = ramdisk_register(minor, buffer, nsectors, sectsize, TRUE); if (ret < 0) { - nsh_output(vtbl, g_fmtcmdfailed, argv[0], "rd_register", NSH_ERRNO_OF(-ret)); + nsh_output(vtbl, g_fmtcmdfailed, argv[0], "ramdisk_register", NSH_ERRNO_OF(-ret)); free(buffer); return ERROR; } @@ -879,8 +881,7 @@ errout_with_fmt: * Name: cmd_mount ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { char *source; @@ -953,13 +954,12 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ret; } #endif -#endif /**************************************************************************** * Name: cmd_rm ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { char *fullpath = nsh_getfullpath(vtbl, argv[1]); @@ -982,7 +982,7 @@ int cmd_rm(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_rmdir ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { char *fullpath = nsh_getfullpath(vtbl, argv[1]); @@ -1070,8 +1070,7 @@ int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: cmd_umount ****************************************************************************/ -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { char *fullpath = nsh_getfullpath(vtbl, argv[1]); @@ -1091,4 +1090,3 @@ int cmd_umount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ret; } #endif -#endif diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index 68de85285..c893d2902 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -157,20 +157,22 @@ static const struct cmdmap_s g_cmdmap[] = #endif { "mb", cmd_mb, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, { "mem", cmd_mem, 1, 1, NULL }, -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) { "mkdir", cmd_mkdir, 2, 2, "<path>" }, -#ifdef CONFIG_FS_FAT +#endif +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_FAT) { "mkfatfs", cmd_mkfatfs, 2, 2, "<path>" }, #endif +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 { "mkfifo", cmd_mkfifo, 2, 2, "<path>" }, +#endif +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) { "mkrd", cmd_mkrd, 2, 6, "[-m <minor>] [-s <sector-size>] <nsectors>" }, #endif { "mh", cmd_mh, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) { "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" }, #endif -#endif { "mw", cmd_mw, 2, 3, "<hex-address>[=<hex-value>][ <hex-byte-count>]" }, { "ps", cmd_ps, 1, 1, NULL }, #if defined(CONFIG_NET) && defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \ @@ -183,7 +185,7 @@ static const struct cmdmap_s g_cmdmap[] = #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) { "pwd", cmd_pwd, 1, 1, NULL }, #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_WRITABLE) { "rm", cmd_rm, 2, 2, "<file-path>" }, { "rmdir", cmd_rmdir, 2, 2, "<dir-path>" }, #endif @@ -199,10 +201,8 @@ static const struct cmdmap_s g_cmdmap[] = #ifndef CONFIG_EXAMPLES_NSH_DISABLESCRIPT { "test", cmd_test, 3, NSH_MAX_ARGUMENTS, "<expression>" }, #endif -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 -# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */ +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) { "umount", cmd_umount, 2, 2, "<dir-path>" }, -# endif #endif #ifndef CONFIG_DISABLE_ENVIRON { "unset", cmd_unset, 2, 2, "<name>" }, |