From f78549221be6d9142263b70e246ec6adf1d58ba9 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sat, 14 Feb 2015 20:07:19 +0100 Subject: IMFS: Add CONFIGURE_IMFS_DISABLE_READDIR --- cpukit/libfs/src/imfs/imfs_dir.c | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 cpukit/libfs/src/imfs/imfs_dir.c (limited to 'cpukit/libfs/src/imfs/imfs_dir.c') 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; +} -- cgit v1.2.3