diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-02-14 20:07:19 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-02-14 21:34:42 +0100 |
commit | f78549221be6d9142263b70e246ec6adf1d58ba9 (patch) | |
tree | 5a155d27479100c2f096a587b18328136a47c1a6 /cpukit/libfs/src/imfs/imfs_dir.c | |
parent | lpc1768_mbed_ahb_ram_eth-testsuite.tcfg: Add ftp01 (diff) | |
download | rtems-f78549221be6d9142263b70e246ec6adf1d58ba9.tar.bz2 |
IMFS: Add CONFIGURE_IMFS_DISABLE_READDIR
Diffstat (limited to 'cpukit/libfs/src/imfs/imfs_dir.c')
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_dir.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_dir.c b/cpukit/libfs/src/imfs/imfs_dir.c new file mode 100644 index 0000000000..2aefc936b4 --- /dev/null +++ b/cpukit/libfs/src/imfs/imfs_dir.c @@ -0,0 +1,52 @@ +/** + * @file + * + * @ingroup IMFS + */ + +/* + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include "imfs.h" + +IMFS_jnode_t *IMFS_node_initialize_directory( + IMFS_jnode_t *node, + void *arg +) +{ + IMFS_directory_t *dir = (IMFS_directory_t *) node; + + rtems_chain_initialize_empty( &dir->Entries ); + + return node; +} + +static bool IMFS_is_mount_point( const IMFS_directory_t *dir ) +{ + return dir->mt_fs != NULL; +} + +IMFS_jnode_t *IMFS_node_remove_directory( IMFS_jnode_t *node ) +{ + IMFS_directory_t *dir = (IMFS_directory_t *) node; + + if ( !rtems_chain_is_empty( &dir->Entries ) ) { + errno = ENOTEMPTY; + dir = NULL; + } else if ( IMFS_is_mount_point( dir ) ) { + errno = EBUSY; + dir = NULL; + } + + return &dir->Node; +} |