diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-02-20 18:14:02 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-02-20 18:14:02 -0600 |
commit | fd56877c0a3a22fa5218dfa3df2799c914e17162 (patch) | |
tree | 5e191d2f3628c5fa8963e4539a3a2502c56af583 | |
parent | 0d7693fca4ccbf8a4093194f0876c1baf6173956 (diff) | |
download | nuttx-fd56877c0a3a22fa5218dfa3df2799c914e17162.tar.gz nuttx-fd56877c0a3a22fa5218dfa3df2799c914e17162.tar.bz2 nuttx-fd56877c0a3a22fa5218dfa3df2799c914e17162.zip |
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
-rw-r--r-- | apps/ChangeLog.txt | 10 | ||||
-rw-r--r-- | apps/nshlib/Kconfig | 5 | ||||
-rw-r--r-- | apps/nshlib/README.txt | 12 | ||||
-rw-r--r-- | apps/nshlib/nsh.h | 49 | ||||
-rw-r--r-- | apps/nshlib/nsh_command.c | 14 | ||||
-rw-r--r-- | apps/nshlib/nsh_fscmds.c | 10 | ||||
-rw-r--r-- | apps/nshlib/nsh_parse.c | 2 | ||||
-rw-r--r-- | nuttx/ChangeLog | 9 | ||||
-rw-r--r-- | nuttx/Documentation/NfsHowto.html | 6 | ||||
-rw-r--r-- | nuttx/Documentation/NuttShell.html | 58 | ||||
-rw-r--r-- | nuttx/arch/arm/src/samd/sam_spi.c | 2 | ||||
-rw-r--r-- | nuttx/fs/Kconfig | 10 | ||||
-rw-r--r-- | nuttx/fs/Makefile | 5 | ||||
-rw-r--r-- | nuttx/fs/fs_mkdir.c | 34 | ||||
-rw-r--r-- | nuttx/fs/fs_rename.c | 31 | ||||
-rw-r--r-- | nuttx/fs/fs_rmdir.c | 28 | ||||
-rw-r--r-- | nuttx/fs/fs_unlink.c | 107 |
17 files changed, 297 insertions, 95 deletions
diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index cd58a46c7..be52ac6b4 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -798,7 +798,7 @@ (2014-1-17). * apps/nshlib/Kconfig, README.txt, nsh.h, nsh_command.c, and nsh_script.c: Add an option to conditionally compile out support for - loop and for if-then-else-fi sequence (2014-1-17). + loop and for if-then-else-fi sequence (2014-1-17). * apps/nshlib/nsh.h, nsh_command.c, and nsh_parse.c: Add a break command that can be executed with a loop to terminate the loop immediately (2014-1-17). @@ -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). diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 1a9de1068..4167b9e4d 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -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 @@ -464,7 +465,7 @@ config NSH_ROMFSDEVNO int "ROMFS block device minor number" default 0 ---help--- - This is the minor number of the ROMFS block device. The default is + This is the minor number of the ROMFS block device. The default is '0' corresponding to /dev/ram0. config NSH_ROMFSSECTSIZE diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt index 6e112846f..b7a01beb9 100644 --- a/apps/nshlib/README.txt +++ b/apps/nshlib/README.txt @@ -307,7 +307,7 @@ o break until loop, between the do and done tokens. Outside of a loop, break command does nothing. If the break command is executed within the body of a loop, the loop will immediately terminate and execution will - continue with the next command immediately following the done token. + continue with the next command immediately following the done token. o cat <path> [<path> [<path> ...]] @@ -955,7 +955,7 @@ Command Dependencies on Configuration Settings cd !CONFIG_DISABLE_ENVIRON && CONFIG_NFILE_DESCRIPTORS > 0 cp CONFIG_NFILE_DESCRIPTORS > 0 dd CONFIG_NFILE_DESCRIPTORS > 0 - delrout CONFIG_NET && CONFIG_NET_ROUTE + delrout CONFIG_NET && CONFIG_NET_ROUTE df !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE (see note 3) echo -- exec -- @@ -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 diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index 223799b41..059513e77 100644 --- a/apps/nshlib/nsh.h +++ b/apps/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. */ @@ -661,7 +682,7 @@ void nsh_usbtrace(void); #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_LOOPS) int cmd_break(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -#endif +#endif #ifndef CONFIG_NSH_DISABLE_ECHO int cmd_echo(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif @@ -717,23 +738,30 @@ void nsh_usbtrace(void); # ifndef CONFIG_NSH_DISABLE_LS int cmd_ls(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 +# if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) +# ifndef CONFIG_NSH_DISABLE_SH + 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 -# 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 -# if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) -# ifndef CONFIG_NSH_DISABLE_SH - int cmd_sh(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); -# endif -# endif /* CONFIG_NFILE_STREAMS && !CONFIG_NSH_DISABLESCRIPT */ +# 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 diff --git a/apps/nshlib/nsh_command.c b/apps/nshlib/nsh_command.c index a52a91d4a..2c043aa5c 100644 --- a/apps/nshlib/nsh_command.c +++ b/apps/nshlib/nsh_command.c @@ -121,7 +121,7 @@ static const struct cmdmap_s g_cmdmap[] = #if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_LOOPS) { "break", cmd_break, 1, 1, NULL }, -#endif +#endif #if CONFIG_NFILE_DESCRIPTORS > 0 # ifndef CONFIG_NSH_DISABLE_CAT @@ -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 +#endif -#if CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef NSH_HAVE_DIROPTS # ifndef CONFIG_NSH_DISABLE_RMDIR { "rmdir", cmd_rmdir, 2, 2, "<dir-path>" }, # endif diff --git a/apps/nshlib/nsh_fscmds.c b/apps/nshlib/nsh_fscmds.c index c56be9497..778d2d584 100644 --- a/apps/nshlib/nsh_fscmds.c +++ b/apps/nshlib/nsh_fscmds.c @@ -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) { diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index 45e3b8508..a83fbe79f 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -2298,4 +2298,4 @@ int cmd_break(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return OK; } -#endif +#endif diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 1227cad0d..ab2b470c7 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -6089,7 +6089,7 @@ * arch/arm/src/lpc31xx/lpc31_ehci.c: Add USB host trace support (2013-11-19). * configs/olimex-lpc-h3131/include/board.h, src/lpc31_boot.c, - lpc31_leds.c, lpc31_usbhost.c, and lpc_h3131.h: Add GPIO + lpc31_leds.c, lpc31_usbhost.c, and lpc_h3131.h: Add GPIO support for LED1/2 and for USB power enable and overcurrent detection (2013-11-19). * configs/olimex-lpc-h3131/nsh/defconfig: Drop loops-per-msec @@ -6267,7 +6267,7 @@ README.txt, and src/stm32_highpri.c: This is the initial framework for a test of the high priority, nested interrupt logic. Still incomplete and does not yet run (2013-12-22). - * arch/arm/src/armv7-m/ram_vectors.h and up_ramvec_initialize.c: + * arch/arm/src/armv7-m/ram_vectors.h and up_ramvec_initialize.c: Correct alignment of the RAM vector table (2013-12-22). * Kconfig: Support configuration of interrupt controller debug output (2013-12-22). @@ -6630,4 +6630,9 @@ but untested (2014-2-20). * configs/olimex-lpc1766stck/ftpc: Configuration convert to use the kconfig-frontends tools by Alan Carvalho de Assis (2014-2-20). + * fs/fs_mkdir.c: 'unlink' can now be used to remove things from the + pseudo-filesystem. A new configuration option as been added: + CONFIG_DISABLE_PSEUDOFS_OPERATIONS that effectively can be set + back out these recent changes in rmdir, mkdir, unlink, and rename + for operations on the pseudo-filesystem (2014-2-20). diff --git a/nuttx/Documentation/NfsHowto.html b/nuttx/Documentation/NfsHowto.html index 3eb986bb6..ed5e6793b 100644 --- a/nuttx/Documentation/NfsHowto.html +++ b/nuttx/Documentation/NfsHowto.html @@ -302,7 +302,7 @@ This is a test # sudo mkdir /export </pre></ul> <p> - It is important that <code>/export</code> directory allow access to everyone (777 permissions) as we will be accessing the NFS share from the client with no authentication. + It is important that <code>/export</code> directory allow access to everyone (777 permissions) as we will be accessing the NFS share from the client with no authentication. </p> <ul><pre> # sudo chmod 777 /export @@ -327,7 +327,7 @@ directory machine1(option11,option12) In our case we are using all the default options except for the <code>ro</code> that we replaced with <code>rw</code> so that our client will have read and write access to the directory that we are exporting. </p> </p> - After we do all the require configurations, we are ready to start the server with the next command: + After we do all the require configurations, we are ready to start the server with the next command: </p> <ul><pre> # sudo /etc/init.d/nfs-kernel-server start @@ -337,7 +337,7 @@ directory machine1(option11,option12) or run command exportfs. </p> <ul><pre> -# sudo /etc/init.d/nfs-kernel-server start +# sudo /etc/init.d/nfs-kernel-server start </pre></ul> <p>Or</p> <ul><pre> diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 4130294cc..0f90e7610 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1> - <p>Last Updated: February 19, 2014</p> + <p>Last Updated: February 20, 2014</p> </td> </tr> </table> @@ -1301,7 +1301,7 @@ nsh> df Size Blocks Used Available Mounted on 64 6 6 0 /etc 512 985 2 983 /tmp -nsh> +nsh> </pre></ul> <p> If <code>CONFIG_NSH_CMDOPT_DF_H</code> is defined in the NuttX configuration, then the <code>df</code> will also support an option <code>-h</code> which may be used to show the volume information in <i>human readable</i> format. @@ -1653,7 +1653,7 @@ losetup [-o <offset>] [-r] <dev-path> <file-path> <b>Synopsis</b>. Setup the loop device at <dev-path> to access the file at <file-path> as a block device. In the following example a 256K file is created (<code>dd</code>) and <code>losetup</code> is - used to make the file accessible as a block device. + used to make the file accessible as a block device. A FAT file system is created (<code>mkfatfs</code>) and mounted (<code>mount</code>). Files can then be managed on the loop-mounted file. <ul><pre> @@ -2488,7 +2488,7 @@ nsh> <p> The availability of the above commands depends upon features that - may or may not be enabled in the NuttX configuration file. The + may or may not be enabled in the NuttX configuration file. The following <a href="#cmddependencies">table</a> indicates the dependency of each command on NuttX configuration settings. General configuration settings are discussed in the <a href="NuttxPortingGuide.html">NuttX Porting Guide.</a> @@ -2664,7 +2664,7 @@ nsh> </tr> <tr> <td><b><code>mkdir</code></b></td> - <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td> + <td>(((!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code>) && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0)<sup>4</sup></td> <td><code>CONFIG_NSH_DISABLE_MKDIR</code></td> </tr> <tr> @@ -2689,7 +2689,7 @@ nsh> </tr> <tr> <td><b><code>mv</code></b></td> - <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>3</sup></td> + <td>(((!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code>) && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0)<sup>4</sup></td> <td><code>CONFIG_NSH_DISABLE_MV</code></td> </tr> <tr> @@ -2722,12 +2722,12 @@ nsh> </tr> <tr> <td><b><code>rm</code></b></td> - <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0 && <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td> + <td>(((!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code>) && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0)<sup>4</sup></td> <td><code>CONFIG_NSH_DISABLE_RM</code></td> </tr> <tr> <td><b><code>rmdir</code></b></td> - <td><code>CONFIG_NFILE_DESCRIPTORS</code> > 0</td> + <td>(((!<code>CONFIG_DISABLE_MOUNTPOINT</code> && <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code>) && <code>CONFIG_NFILE_DESCRIPTORS</code> > 0)<sup>4</sup></td> <td><code>CONFIG_NSH_DISABLE_RMDIR</code></td> </tr> <tr> @@ -3007,7 +3007,7 @@ set FOOBAR ABC_${FOO}_${BAR} <li> <code>CONFIG_NSH_USBCONSOLE</code>. If defined, then the an arbitrary USB device may be used to as the NSH console. - In this case, <code>CONFIG_NSH_CONDEV</code> must be defined to indicate which USB device to use as the console. + In this case, <code>CONFIG_NSH_CONDEV</code> must be defined to indicate which USB device to use as the console. The advantage of using a device other that /dev/console is that normal debug output can not use /dev/console while NSH uses <code>CONFIG_NSH_USBCONDEV</code>. <p> <code>CONFIG_NSH_USBCONDEV</code>. @@ -3365,7 +3365,7 @@ set FOOBAR ABC_${FOO}_${BAR} <h3>4.1.1 NSH Initialization sequence</h3> <p> - The NSH start-up sequence is very simple. + The NSH start-up sequence is very simple. As an example, the code at <code>apps/examples/nsh/nsh_main.c</code> illustrates how to start NSH. It simple does the following: </p> @@ -3469,7 +3469,7 @@ mount -t vfat /dev/ram1 /tmp </p> <li> <p> - Mount the FAT filesystem at a configured mountpoint, <code>/tmp</code>. + Mount the FAT filesystem at a configured mountpoint, <code>/tmp</code>. </p> </ul> <p> @@ -3502,7 +3502,7 @@ mount -t vfat /dev/ram1 /tmp <b>Overview.</b> NSH supports a variety of commands as part of the NSH program. All of the NSH commands are listed in the NSH documentation <a href="#cmdoverview">above</a>. - Not all of these commands may be available at any time, however. + Not all of these commands may be available at any time, however. Many commands depend upon certain NuttX configuration options. You can enter the help command at the NSH prompt to see the commands actual available: </p> @@ -3619,7 +3619,7 @@ struct cmdmap_s <p> <b>Overview.</b> In addition to these commands that are a part of NSH, external programs can also be executed as NSH commands. - These external programs are called "Built-In" Applications for historic reasons. + These external programs are called "Built-In" Applications for historic reasons. That terminology is somewhat confusing because the actual NSH commands as described above are truly "built-into" NSH whereas these applications are really external to NuttX. </p> <p> @@ -3716,7 +3716,7 @@ Builtin Apps: The NuttX build occurs in several phases as different build targets are executed: (1) <i>context</i> when the configuration is established, (2) <i>depend </i>when target dependencies are generated, and - (3) <i>default</i> (<code>all</code>) when the normal compilation and link operations are performed. + (3) <i>default</i> (<code>all</code>) when the normal compilation and link operations are performed. Built-in application information is collected during the make <i>context</i> build phase. </p> @@ -3912,7 +3912,7 @@ CONFIGURED_APPS += examples/hello <li> <p> You replace the sample code at <code>apps/examples/nsh/nsh_main.c</code> with whatever start-up logic that you want. - NSH is a library at <code>apps/nshlib</code>. + NSH is a library at <code>apps/nshlib</code>. <code>apps.examplex/nsh</code> is just a tiny, example start-up function (<code>CONFIG_USER_ENTRYPOINT</code>()) that that runs immediately and illustrates how to start NSH If you want something else to run immediately then you can write your write your own custom <code>CONFIG_USER_ENTRYPOINT</code>() function and then start other tasks from your custom <code>CONFIG_USER_ENTRYPOINT</code>(). </p> @@ -3938,7 +3938,7 @@ CONFIGURED_APPS += examples/hello NSH supports options to provide a start up script for NSH. The start-up script contains any command support by NSH (i.e., that you see when you enter 'nsh> help'). In general this capability is enabled with <code>CONFIG_NSH_ROMFSETC=y</code>, but has several other related configuration options as described with the <a href="#nshconfiguration">NSH-specific configuration settings</a> paragraph. - This capability also depends on: + This capability also depends on: </p> <ul> @@ -3962,26 +3962,26 @@ CONFIGURED_APPS += examples/hello <p> <b>Default Start-Up Behavior</b>. The implementation that is provided is intended to provide great flexibility for the use of Start-Up files. - This paragraph will discuss the general behavior when all of the configuration options are set to the default values. + This paragraph will discuss the general behavior when all of the configuration options are set to the default values. </p> <p> - In this default case, enabling <code>CONFIG_NSH_ROMFSETC</code> will cause NSH to behave as follows at NSH start-up time: + In this default case, enabling <code>CONFIG_NSH_ROMFSETC</code> will cause NSH to behave as follows at NSH start-up time: </p> <ul> <li> <p> - NSH will create a read-only RAM disk (a ROM disk), containing a tiny ROMFS filesystem containing the following: + NSH will create a read-only RAM disk (a ROM disk), containing a tiny ROMFS filesystem containing the following: </p> <ul><pre> `--init.d/ `-- rcS </pre></ul> <p> - Where <code>rcS</code> is the NSH start-up script. + Where <code>rcS</code> is the NSH start-up script. </p> <li> <p> - NSH will then mount the ROMFS filesystem at <code>/etc</code>, resulting in: + NSH will then mount the ROMFS filesystem at <code>/etc</code>, resulting in: </p> <ul><pre> |--dev/ @@ -3992,7 +3992,7 @@ CONFIGURED_APPS += examples/hello </pre></ul> <li> <p> - By default, the contents of <code>rcS</code> script are: + By default, the contents of <code>rcS</code> script are: </p> <ul><pre> # Create a RAMDISK and mount it at /tmp @@ -4004,7 +4004,7 @@ mount -t vfat /dev/ram1 /tmp <li> <p> NSH will execute the script at <code>/etc/init.d/rcS</code> at start-up (before the first NSH prompt). - After execution of the script, the root FS will look like: + After execution of the script, the root FS will look like: </p> <ul><pre> |--dev/ @@ -4048,7 +4048,7 @@ mount -t vfat /dev/ram1 /tmp <p> <b>Modifying the ROMFS Image</b>. The contents of the <code>/etc</code> directory are retained in the file <code>apps/nshlib/nsh_romfsimg.h</code> OR, if <code>CONFIG_NSH_ARCHROMFS</code> is defined, <code>include/arch/board/rcs.template</code>. - In order to modify the start-up behavior, there are three things to study: + In order to modify the start-up behavior, there are three things to study: </p> <ol> @@ -4062,15 +4062,15 @@ mount -t vfat /dev/ram1 /tmp <b><code>tools/mkromfsimg.sh</code> Script</b>. The script <code>tools/mkromfsimg.sh</code> creates <code>nsh_romfsimg.h</code>. It is not automatically executed. - If you want to change the configuration settings associated with creating and mounting the <code>/tmp</code> directory, then it will be necessary to re-generate this header file using the <code>tools/mkromfsimg.sh</code> script. + If you want to change the configuration settings associated with creating and mounting the <code>/tmp</code> directory, then it will be necessary to re-generate this header file using the <code>tools/mkromfsimg.sh</code> script. </p> <p> - The behavior of this script depends upon several things: + The behavior of this script depends upon several things: </p> <ol> <li> <p> - The configuration settings then installed configuration. + The configuration settings then installed configuration. </p> <li> <p> @@ -4089,7 +4089,7 @@ mount -t vfat /dev/ram1 /tmp <li> <p> <code><b>rcS.template</b></code>. - The file <code>apps/nshlib/rcS.template</code> contains the general form of the <code>rcS</code> file; configured values are plugged into this template file to produce the final <code>rcS</code> file. + The file <code>apps/nshlib/rcS.template</code> contains the general form of the <code>rcS</code> file; configured values are plugged into this template file to produce the final <code>rcS</code> file. </p> </ol> @@ -4273,7 +4273,7 @@ mount -t vfat /dev/ram1 /tmp <li><a href="#custonshlib">NSH library (<code>nshlib</code>)</a></li> <li><a href="#nshlibrary">NSH library (<code>nshlib</code>)</a></li> <li><a href="#custonshlib"><code>nsh_archinitialize()</code></a></li> - <li><a href="#custonshlib"><code>nsh_consolemain()</code></a></li> + <li><a href="#custonshlib"><code>nsh_consolemain()</code></a></li> <li><a href="#custonshlib"><code>nsh_initialize()</code></a></li> <li><a href="#custonshlib"><code>nsh_main()</code></a></li> <li><a href="#custinit"><code>nsh_main.c</code></a></li> diff --git a/nuttx/arch/arm/src/samd/sam_spi.c b/nuttx/arch/arm/src/samd/sam_spi.c index 46ea0f467..9c9bf522a 100644 --- a/nuttx/arch/arm/src/samd/sam_spi.c +++ b/nuttx/arch/arm/src/samd/sam_spi.c @@ -1550,7 +1550,7 @@ struct spi_dev_s *up_spiinitialize(int port) (void)spi_setfrequency((struct spi_dev_s *)priv, 400000); - /* Set MSB first data order and the configured pad mux setting, + /* Set MSB first data order and the configured pad mux setting, * Note that SPI mode 0 is assumed initially (CPOL=0 and CPHA=0). */ diff --git a/nuttx/fs/Kconfig b/nuttx/fs/Kconfig index b7f3f059d..defeba011 100644 --- a/nuttx/fs/Kconfig +++ b/nuttx/fs/Kconfig @@ -9,6 +9,16 @@ config DISABLE_MOUNTPOINT bool "Disable support for mount points" default n +config DISABLE_PSEUDOFS_OPERATIONS + bool "Disable pseudo-filesytem operations" + default n + ---help--- + Disable certain operations on pseudo-file systems include mkdir, + rmdir, unlink, and rename. These are necessary for the logical + completeness of the illusion created by the pseudo-filesystem. + However, in practical embedded system, they are seldom needed and + you can save a little FLASH space by disabling the capability. + config FS_READABLE bool default n diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile index 05a27d7eb..3acfe606d 100644 --- a/nuttx/fs/Makefile +++ b/nuttx/fs/Makefile @@ -65,7 +65,7 @@ CSRCS += fs_close.c fs_closedir.c fs_dup.c fs_dup2.c fs_fcntl.c CSRCS += fs_filedup.c fs_filedup2.c fs_ioctl.c fs_lseek.c fs_mkdir.c CSRCS += fs_open.c fs_opendir.c fs_poll.c fs_read.c fs_readdir.c CSRCS += fs_rename.c fs_rewinddir.c fs_rmdir.c fs_seekdir.c fs_stat.c -CSRCS += fs_statfs.c fs_select.c fs_write.c +CSRCS += fs_statfs.c fs_select.c fs_unlink.c fs_write.c CSRCS += fs_files.c fs_foreachinode.c fs_inode.c fs_inodeaddref.c CSRCS += fs_inodebasename.c fs_inodefind.c fs_inoderelease.c @@ -104,8 +104,7 @@ endif ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) -CSRCS += fs_fsync.c fs_mount.c fs_umount.c fs_unlink.c -CSRCS += fs_foreachmountpoint.c +CSRCS += fs_fsync.c fs_mount.c fs_umount.c fs_foreachmountpoint.c include fat/Make.defs include romfs/Make.defs diff --git a/nuttx/fs/fs_mkdir.c b/nuttx/fs/fs_mkdir.c index 2cf20afe2..74d5e04f6 100644 --- a/nuttx/fs/fs_mkdir.c +++ b/nuttx/fs/fs_mkdir.c @@ -46,9 +46,27 @@ #include "fs_internal.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ +#undef FS_HAVE_WRITABLE_MOUNTPOINT +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_WRITABLE_MOUNTPOINT 1 +#endif + +#undef FS_HAVE_PSEUDOFS_OPERATIONS +#if !defined(CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_PSEUDOFS_OPERATIONS 1 +#endif + +#undef FS_HAVE_MKDIR +#if defined(FS_HAVE_WRITABLE_MOUNTPOINT) || defined(FS_HAVE_PSEUDOFS_OPERATIONS) +# define FS_HAVE_MKDIR 1 +#endif + +#ifdef FS_HAVE_MKDIR + /**************************************************************************** * Private Variables ****************************************************************************/ @@ -113,7 +131,7 @@ int mkdir(const char *pathname, mode_t mode) } } else - { + { errcode = ENOSYS; goto errout_with_inode; } @@ -125,10 +143,11 @@ int mkdir(const char *pathname, mode_t mode) /* But mountpoints are not supported in this configuration */ errcode = EEXIST; - goto errout_with_inode; + goto errout_with_inode; #endif } +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS /* No inode exists that contains this path. Create a new inode in the * pseudo-filesystem at this location. */ @@ -147,6 +166,13 @@ int mkdir(const char *pathname, mode_t mode) goto errout; } } +#else + else + { + errcode = ENXIO; + goto errout; + } +#endif /* Directory successfully created */ @@ -158,3 +184,5 @@ int mkdir(const char *pathname, mode_t mode) set_errno(errcode); return ERROR; } + +#endif /* FS_HAVE_MKDIR */ diff --git a/nuttx/fs/fs_rename.c b/nuttx/fs/fs_rename.c index 405d25cc2..38da25b97 100644 --- a/nuttx/fs/fs_rename.c +++ b/nuttx/fs/fs_rename.c @@ -49,6 +49,24 @@ * Pre-processor Definitions ****************************************************************************/ +#undef FS_HAVE_WRITABLE_MOUNTPOINT +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_WRITABLE_MOUNTPOINT 1 +#endif + +#undef FS_HAVE_PSEUDOFS_OPERATIONS +#if !defined(CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_PSEUDOFS_OPERATIONS 1 +#endif + +#undef FS_HAVE_RENAME +#if defined(FS_HAVE_WRITABLE_MOUNTPOINT) || defined(FS_HAVE_PSEUDOFS_OPERATIONS) +# define FS_HAVE_RENAME 1 +#endif + +#ifdef FS_HAVE_RENAME + /**************************************************************************** * Private Variables ****************************************************************************/ @@ -75,9 +93,9 @@ int rename(FAR const char *oldpath, FAR const char *newpath) { FAR struct inode *oldinode; + FAR struct inode *newinode; const char *oldrelpath = NULL; #ifndef CONFIG_DISABLE_MOUNTPOINT - FAR struct inode *newinode; const char *newrelpath = NULL; #endif int errcode; @@ -144,7 +162,7 @@ int rename(FAR const char *oldpath, FAR const char *newpath) } } else - { + { errcode = ENOSYS; goto errout_with_newinode; } @@ -155,6 +173,7 @@ int rename(FAR const char *oldpath, FAR const char *newpath) } else #endif +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS { /* Create a new, empty inode at the destination location */ @@ -210,6 +229,12 @@ int rename(FAR const char *oldpath, FAR const char *newpath) oldinode->i_child = NULL; inode_semgive(); } +#else + { + errcode = ENXIO; + goto errout; + } +#endif /* Successfully renamed */ @@ -226,3 +251,5 @@ int rename(FAR const char *oldpath, FAR const char *newpath) set_errno(errcode); return ERROR; } + +#endif /* FS_HAVE_RENAME */ diff --git a/nuttx/fs/fs_rmdir.c b/nuttx/fs/fs_rmdir.c index 9c863d8c4..14f325009 100644 --- a/nuttx/fs/fs_rmdir.c +++ b/nuttx/fs/fs_rmdir.c @@ -49,6 +49,24 @@ * Pre-processor Definitions ****************************************************************************/ +#undef FS_HAVE_WRITABLE_MOUNTPOINT +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_WRITABLE_MOUNTPOINT 1 +#endif + +#undef FS_HAVE_PSEUDOFS_OPERATIONS +#if !defined(CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_PSEUDOFS_OPERATIONS 1 +#endif + +#undef FS_HAVE_RMDIR +#if defined(FS_HAVE_WRITABLE_MOUNTPOINT) || defined(FS_HAVE_PSEUDOFS_OPERATIONS) +# define FS_HAVE_RMDIR 1 +#endif + +#ifdef FS_HAVE_RMDIR + /**************************************************************************** * Private Variables ****************************************************************************/ @@ -118,7 +136,8 @@ int rmdir(FAR const char *pathname) else #endif - /* If this is a "dangling" pseudo-file node (i.e., it has no operations) +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS + /* If this is a "dangling" pseudo-directory node (i.e., it has no operations) * then rmdir should remove the node. */ @@ -154,9 +173,15 @@ int rmdir(FAR const char *pathname) } else { + errcode = ENOTDIR; + goto errout_with_inode; + } +#else + { errcode = ENXIO; goto errout_with_inode; } +#endif /* Successfully removed the directory */ @@ -170,3 +195,4 @@ errout: return ERROR; } +#endif /* FS_HAVE_RMDIR */ diff --git a/nuttx/fs/fs_unlink.c b/nuttx/fs/fs_unlink.c index f57bd33b5..c17bed713 100644 --- a/nuttx/fs/fs_unlink.c +++ b/nuttx/fs/fs_unlink.c @@ -49,6 +49,24 @@ * Pre-processor Definitions ****************************************************************************/ +#undef FS_HAVE_WRITABLE_MOUNTPOINT +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \ + CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_WRITABLE_MOUNTPOINT 1 +#endif + +#undef FS_HAVE_PSEUDOFS_OPERATIONS +#if !defined(CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_STREAMS > 0 +# define FS_HAVE_PSEUDOFS_OPERATIONS 1 +#endif + +#undef FS_HAVE_UNLINK +#if defined(FS_HAVE_WRITABLE_MOUNTPOINT) || defined(FS_HAVE_PSEUDOFS_OPERATIONS) +# define FS_HAVE_UNLINK 1 +#endif + +#ifdef FS_HAVE_UNLINK + /**************************************************************************** * Private Variables ****************************************************************************/ @@ -76,6 +94,7 @@ int unlink(FAR const char *pathname) { FAR struct inode *inode; const char *relpath = NULL; + int errcode; int ret; /* Get an inode for this file */ @@ -83,38 +102,93 @@ int unlink(FAR const char *pathname) inode = inode_find(pathname, &relpath); if (!inode) { - /* There is no mountpoint that includes in this path */ + /* There is no inode that includes in this path */ - ret = ENOENT; + errcode = ENOENT; goto errout; } - /* Verify that the inode is a valid mountpoint. */ +#ifndef CONFIG_DISABLE_MOUNTPOINT + /* Check if the inode is a valid mountpoint. */ - if (!INODE_IS_MOUNTPT(inode) || !inode->u.i_mops) + if (INODE_IS_MOUNTPT(inode) && inode->u.i_mops) { - ret = ENXIO; - goto errout_with_inode; + /* Perform the unlink operation using the relative path at the + * mountpoint. + */ + + if (inode->u.i_mops->unlink) + { + ret = inode->u.i_mops->unlink(inode, relpath); + if (ret < 0) + { + errcode = -ret; + goto errout_with_inode; + } + } + else + { + errcode = ENOSYS; + goto errout_with_inode; + } } + else +#endif - /* Perform the unlink operation using the relative path - * at the mountpoint. +#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS + /* If this is a "dangling" pseudo-file node (i.e., it has operations) then rm + * should remove the node. */ - if (inode->u.i_mops->unlink) + if (inode->u.i_ops) { - ret = inode->u.i_mops->unlink(inode, relpath); - if (ret < 0) + /* If this is a pseudo-file node (i.e., it has no operations) + * then rmdir should remove the node. + */ + + if (inode->u.i_ops) { - ret = -ret; + inode_semtake(); + + /* Refuse to unlink the inode if it has children. I.e., if it is + * functioning as a directory and the directory is not empty. + */ + + if (inode->i_child != NULL) + { + errcode = ENOTEMPTY; + inode_semgive(); + goto errout_with_inode; + } + + /* Remove the old inode. Because we hold a reference count on the + * inode, it will not be deleted now. It will be deleted when all + * of the references to to the inode have been released (perhaps + * when inode_release() is called below). inode_remove() will + * return -EBUSY to indicate that the inode was not deleted now. + */ + + ret = inode_remove(pathname); + inode_semgive(); + + if (ret < 0 && ret != -EBUSY) + { + errcode = -ret; + goto errout_with_inode; + } + } + else + { + errcode = EISDIR; goto errout_with_inode; } } - else - { - ret = ENOSYS; +#else + { + errcode = ENXIO; goto errout_with_inode; } +#endif /* Successfully unlinked */ @@ -124,7 +198,8 @@ int unlink(FAR const char *pathname) errout_with_inode: inode_release(inode); errout: - set_errno(ret); + set_errno(errcode); return ERROR; } +#endif /* FS_HAVE_UNLINK */ |