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 /nuttx/fs/fs_rmdir.c | |
parent | 0d7693fca4ccbf8a4093194f0876c1baf6173956 (diff) | |
download | px4-nuttx-fd56877c0a3a22fa5218dfa3df2799c914e17162.tar.gz px4-nuttx-fd56877c0a3a22fa5218dfa3df2799c914e17162.tar.bz2 px4-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
Diffstat (limited to 'nuttx/fs/fs_rmdir.c')
-rw-r--r-- | nuttx/fs/fs_rmdir.c | 28 |
1 files changed, 27 insertions, 1 deletions
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 */ |