Added mkfatfs command to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@811 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
2cee73f956
commit
75ec13c73e
@ -393,3 +393,6 @@
|
||||
basic mkfatfs functionality for FAT12.
|
||||
|
||||
0.3.13 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Added mkfatfs command to NSH
|
||||
|
||||
|
@ -1028,6 +1028,8 @@ buildroot-0.1.0 2007-03-09 <spudmonkey@racsa.co.cr>
|
||||
<pre><ul>
|
||||
nuttx-0.3.13 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Added mkfatfs command to NSH
|
||||
|
||||
pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
buildroot-0.1.1 2008-xx-xx <spudmonkey@racsa.co.cr>
|
||||
|
@ -129,6 +129,7 @@ extern void cmd_ls(FAR void *handle, int argc, char **argv);
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
extern void cmd_mkdir(FAR void *handle, int argc, char **argv);
|
||||
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
|
||||
extern void cmd_mkfatfs(FAR void *handle, int argc, char **argv);
|
||||
extern void cmd_mount(FAR void *handle, int argc, char **argv);
|
||||
#endif
|
||||
#endif
|
||||
|
@ -43,11 +43,12 @@
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# include <sys/stat.h>
|
||||
# include <fcntl.h>
|
||||
# if !defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
|
||||
# include <sys/mount.h>
|
||||
# include <nuttx/mkfatfs.h>
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
|
||||
# include <sys/mount.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -633,6 +634,22 @@ void cmd_mkdir(FAR void *handle, int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_mkfatfs
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_FAT)
|
||||
void cmd_mkfatfs(FAR void *handle, int argc, char **argv)
|
||||
{
|
||||
struct fat_format_s fmt = FAT_FORMAT_INITIALIZER;
|
||||
int result = mkfatfs(argv[1], &fmt);
|
||||
if ( result < 0)
|
||||
{
|
||||
nsh_output(handle, g_fmtcmdfailed, argv[0], "mkfatfs", NSH_ERRNO);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmd_mount
|
||||
****************************************************************************/
|
||||
|
@ -81,44 +81,45 @@ static const char delim[] = " \t\n";
|
||||
static const struct cmdmap_s g_cmdmap[] =
|
||||
{
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "cat", cmd_cat, 2, 2, "<path>" },
|
||||
{ "cp", cmd_cp, 3, 3, "<source-path> <dest-path>" },
|
||||
{ "cat", cmd_cat, 2, 2, "<path>" },
|
||||
{ "cp", cmd_cp, 3, 3, "<source-path> <dest-path>" },
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string|$name> [<string|$name>...]]" },
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string|$name> [<string|$name>...]]" },
|
||||
#else
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string> [<string>...]]" },
|
||||
{ "echo", cmd_echo, 0, NSH_MAX_ARGUMENTS, "[<string> [<string>...]]" },
|
||||
#endif
|
||||
{ "exec", cmd_exec, 2, 3, "<hex-address>" },
|
||||
{ "exit", cmd_exit, 1, 1, NULL },
|
||||
{ "help", cmd_help, 1, 1, NULL },
|
||||
{ "exec", cmd_exec, 2, 3, "<hex-address>" },
|
||||
{ "exit", cmd_exit, 1, 1, NULL },
|
||||
{ "help", cmd_help, 1, 1, NULL },
|
||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
{ "ifconfig", cmd_ifconfig, 1, 1, NULL },
|
||||
#endif
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "ls", cmd_ls, 2, 5, "[-lRs] <dir-path>" },
|
||||
{ "ls", cmd_ls, 2, 5, "[-lRs] <dir-path>" },
|
||||
#endif
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||
{ "mkdir", cmd_mkdir, 2, 2, "<path>" },
|
||||
#ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
|
||||
{ "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" },
|
||||
{ "mkfatfs", cmd_mkfatfs, 2, 2, "<path>" },
|
||||
{ "mount", cmd_mount, 4, 5, "-t <fstype> <block-device> <dir-path>" },
|
||||
#endif
|
||||
#endif
|
||||
{ "ps", cmd_ps, 1, 1, NULL },
|
||||
{ "ps", cmd_ps, 1, 1, NULL },
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
{ "set", cmd_set, 3, 3, "<name> <value>" },
|
||||
{ "set", cmd_set, 3, 3, "<name> <value>" },
|
||||
#endif
|
||||
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0
|
||||
{ "rm", cmd_rm, 2, 2, "<file-path>" },
|
||||
{ "rmdir", cmd_rmdir, 2, 2, "<dir-path>" },
|
||||
{ "rm", cmd_rm, 2, 2, "<file-path>" },
|
||||
{ "rmdir", cmd_rmdir, 2, 2, "<dir-path>" },
|
||||
# ifdef CONFIG_FS_FAT /* Need at least one filesytem in configuration */
|
||||
{ "umount", cmd_umount, 2, 2, "<dir-path>" },
|
||||
{ "umount", cmd_umount, 2, 2, "<dir-path>" },
|
||||
#endif
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_ENVIRON
|
||||
{ "unset", cmd_unset, 2, 2, "<name>" },
|
||||
{ "unset", cmd_unset, 2, 2, "<name>" },
|
||||
#endif
|
||||
{ NULL, NULL, 1, 1, NULL }
|
||||
{ NULL, NULL, 1, 1, NULL }
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user