diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-08-10 18:42:55 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-08-10 18:42:55 +0000 |
commit | b519cf020d830ad425ff6c7e3f2f807ed0268600 (patch) | |
tree | 13630c679ff68959563d05a08dd2333119f725eb /nuttx/examples/nsh/nsh_fscmds.c | |
parent | 8c4ab8a0633559af64ea6a7fa966c7b608c48c1d (diff) | |
download | px4-nuttx-b519cf020d830ad425ff6c7e3f2f807ed0268600.tar.gz px4-nuttx-b519cf020d830ad425ff6c7e3f2f807ed0268600.tar.bz2 px4-nuttx-b519cf020d830ad425ff6c7e3f2f807ed0268600.zip |
Added mkfatfs command to NSH
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@811 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh/nsh_fscmds.c')
-rw-r--r-- | nuttx/examples/nsh/nsh_fscmds.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/nuttx/examples/nsh/nsh_fscmds.c b/nuttx/examples/nsh/nsh_fscmds.c index 84c36b8fd..a1f8c2ee5 100644 --- a/nuttx/examples/nsh/nsh_fscmds.c +++ b/nuttx/examples/nsh/nsh_fscmds.c @@ -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> @@ -634,6 +635,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 ****************************************************************************/ |