Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/ChangeLog	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -1,2 +1,14 @@
+2010-07-01	Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+	* libcsupport/include/rtems/libio_.h: Removed
+	rtems_filesystem_mount_table_control.
+	* libcsupport/include/rtems/libio.h, libcsupport/src/mount-mgr.c,
+	libcsupport/src/mount.c libcsupport/src/statvfs.c,
+	libcsupport/src/unmount.c, libmisc/shell/main_mount.c: Documentation.
+	Removed rtems_filesystem_mounts_first() and
+	rtems_filesystem_mounts_next().  Added
+	rtems_filesystem_mount_iterate().  Changed return type of
+	rtems_filesystem_iterate().  Removed rtems_filesystem_nodes_equal().
+
 2010-07-01	Sebastian Huber <sebastian.huber@embedded-brains.de>
 
Index: cpukit/libcsupport/include/rtems/libio.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio.h	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libcsupport/include/rtems/libio.h	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -1040,44 +1040,4 @@
 
 /**
- * @brief File system table entry.
- */
-typedef struct rtems_filesystem_table_t {
-  const char                    *type;
-  rtems_filesystem_fsmount_me_t  mount_h;
-} rtems_filesystem_table_t;
-
-/**
- * @brief Static table of file systems.
- *
- * Externally defined by confdefs.h or the user.
- */
-extern const rtems_filesystem_table_t rtems_filesystem_table [];
-
-/**
- * @brief Per file system table entry routine type.
- *
- * @see rtems_filesystem_iterate().
- *
- * @retval true Continue the iteration.
- * @retval false Stop the iteration.
- */
-typedef bool (*rtems_per_filesystem_routine)(
-  const rtems_filesystem_table_t *entry,
-  void *arg
-);
-
-/**
- * @brief Iterates over the file system table.
- *
- * For each file system table entry the @a routine will be called with the
- * table entry and the @a routine_arg parameter.
- */
-void
-rtems_filesystem_iterate(
-  rtems_per_filesystem_routine routine,
-  void *routine_arg
-);
-
-/**
  * @brief Gets the mount handler for the file system @a type.
  *
@@ -1087,33 +1047,4 @@
 rtems_filesystem_fsmount_me_t
 rtems_filesystem_get_mount_handler(
-  const char *type
-);
-
-/*
- * Get the first entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t*
-rtems_filesystem_mounts_first( void );
-
-/*
- * Get the next entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t*
-rtems_filesystem_mounts_next( rtems_filesystem_mount_table_entry_t *entry );
-
-/*
- * Register a file system.
- */
-int
-rtems_filesystem_register(
-  const char                    *type,
-  rtems_filesystem_fsmount_me_t  mount_h
-);
-
-/*
- * Unregister a file system.
- */
-int
-rtems_filesystem_unregister(
   const char *type
 );
@@ -1146,65 +1077,4 @@
 
 /**
- * @brief Mount table entry.
- */
-struct rtems_filesystem_mount_table_entry_tt {
-  rtems_chain_node                       Node;
-  rtems_filesystem_location_info_t       mt_point_node;
-  rtems_filesystem_location_info_t       mt_fs_root;
-  int                                    options;
-  void                                  *fs_info;
-
-  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
-
-  /*
-   * The target or mount point of the file system.
-   */
-  const char                            *target;
-
-  /*
-   * The type of filesystem or the name of the filesystem.
-   */
-  const char                            *type;
-
-  /*
-   *  When someone adds a mounted filesystem on a real device,
-   *  this will need to be used.
-   *
-   *  The lower layers can manage how this is managed. Leave as a
-   *  string.
-   */
-  char                                  *dev;
-};
-
-/**
- * @brief The pathconf setting for a file system.
- */
-#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
-
-/**
- * @brief The type of file system. Its name.
- */
-#define rtems_filesystem_type(_mte) ((_mte)->type)
-
-/**
- * @brief The mount point of a file system.
- */
-#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
-
-/**
- * @brief The device entry of a file system.
- */
-#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
-
-/**
- * @brief File systems options.
- */
-typedef enum {
-  RTEMS_FILESYSTEM_READ_ONLY,
-  RTEMS_FILESYSTEM_READ_WRITE,
-  RTEMS_FILESYSTEM_BAD_OPTIONS
-} rtems_filesystem_options_t;
-
-/**
  * @brief An open file data structure.
  *
@@ -1395,4 +1265,44 @@
  (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm ))
 
+/*
+ *  Prototypes for filesystem
+ */
+
+void rtems_filesystem_initialize( void );
+
+typedef void (*rtems_libio_init_functions_t)(void);
+extern  rtems_libio_init_functions_t rtems_libio_init_helper;
+
+void    open_dev_console(void);
+
+typedef void (*rtems_libio_supp_functions_t)(void);
+extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
+
+typedef void (*rtems_fs_init_functions_t)(void);
+extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
+
+/**
+ * @brief Creates a directory and all its parent directories according to
+ * @a path.
+ *
+ * The @a mode value selects the access permissions of the directory.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured.  The @c errno indicates the error.
+ */
+extern int rtems_mkdir(const char *path, mode_t mode);
+
+/** @} */
+
+/**
+ * @defgroup FileSystemTypesAndMount File System Types and Mount
+ *
+ * @ingroup LibIO
+ *
+ * @brief File system types and mount.
+ *
+ * @{
+ */
+
 /**
  * @name File System Types
@@ -1412,14 +1322,130 @@
 /** @} */
 
-/*
- *  Prototypes for filesystem
- */
-
-void rtems_filesystem_initialize( void );
-
+/**
+ * @brief Mount table entry.
+ */
+struct rtems_filesystem_mount_table_entry_tt {
+  rtems_chain_node                       Node;
+  rtems_filesystem_location_info_t       mt_point_node;
+  rtems_filesystem_location_info_t       mt_fs_root;
+  int                                    options;
+  void                                  *fs_info;
+
+  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
+
+  /*
+   * The target or mount point of the file system.
+   */
+  const char                            *target;
+
+  /*
+   * The type of filesystem or the name of the filesystem.
+   */
+  const char                            *type;
+
+  /*
+   *  When someone adds a mounted filesystem on a real device,
+   *  this will need to be used.
+   *
+   *  The lower layers can manage how this is managed. Leave as a
+   *  string.
+   */
+  char                                  *dev;
+};
+
+/**
+ * @brief File system options.
+ */
+typedef enum {
+  RTEMS_FILESYSTEM_READ_ONLY,
+  RTEMS_FILESYSTEM_READ_WRITE,
+  RTEMS_FILESYSTEM_BAD_OPTIONS
+} rtems_filesystem_options_t;
+
+/**
+ * @brief File system table entry.
+ */
+typedef struct rtems_filesystem_table_t {
+  const char                    *type;
+  rtems_filesystem_fsmount_me_t  mount_h;
+} rtems_filesystem_table_t;
+
+/**
+ * @brief Static table of file systems.
+ *
+ * Externally defined by confdefs.h or the user.
+ */
+extern const rtems_filesystem_table_t rtems_filesystem_table [];
+
+/**
+ * @brief Registers a file system @a type.
+ *
+ * The @a mount_h handler will be used to mount a file system of this @a type.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured.  The @c errno indicates the error.
+ */
+int rtems_filesystem_register(
+  const char                    *type,
+  rtems_filesystem_fsmount_me_t  mount_h
+);
+
+/**
+ * @brief Unregisters a file system @a type.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured.  The @c errno indicates the error.
+ */
+int rtems_filesystem_unregister(
+  const char *type
+);
+
+/**
+ * @brief Unmounts the file system at @a mount_path.
+ *
+ * @todo Due to file system implementation shortcomings it is possible to
+ * unmount file systems in use.  This likely leads to heap corruption.  Unmount
+ * only file systems which are not in use by the application.
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured.  The @c errno indicates the error.
+ */
 int unmount(
   const char *mount_path
 );
 
+/**
+ * @brief Mounts a file system at @a target.
+ *
+ * The @a source may be a path to the corresponding device file, or @c NULL.
+ * The @a target path must lead to an existing directory, or @c NULL.  In case
+ * @a target is @c NULL, the root file system will be mounted.  The @a data
+ * parameter will be forwarded to the file system initialization handler.  The
+ * file system type is selected by @a filesystemtype and may be one of
+ * - RTEMS_FILESYSTEM_TYPE_DEVFS,
+ * - RTEMS_FILESYSTEM_TYPE_DOSFS,
+ * - RTEMS_FILESYSTEM_TYPE_FTPFS,
+ * - RTEMS_FILESYSTEM_TYPE_IMFS,
+ * - RTEMS_FILESYSTEM_TYPE_MINIIMFS,
+ * - RTEMS_FILESYSTEM_TYPE_NFS,
+ * - RTEMS_FILESYSTEM_TYPE_RFS, or
+ * - RTEMS_FILESYSTEM_TYPE_TFTPFS.
+ *
+ * Only configured or registered file system types are available.  You can add
+ * file system types to your application configuration with
+ * - CONFIGURE_FILESYSTEM_DEVFS,
+ * - CONFIGURE_FILESYSTEM_DOSFS,
+ * - CONFIGURE_FILESYSTEM_FTPFS,
+ * - CONFIGURE_FILESYSTEM_IMFS,
+ * - CONFIGURE_FILESYSTEM_MINIIMFS,
+ * - CONFIGURE_FILESYSTEM_NFS,
+ * - CONFIGURE_FILESYSTEM_RFS, and
+ * - CONFIGURE_FILESYSTEM_TFTPFS.
+ *
+ * @see rtems_filesystem_register() and mount_and_make_target_path().
+ *
+ * @retval 0 Successful operation.
+ * @retval -1 An error occured.  The @c errno indicates the error.
+ */
 int mount(
   const char                 *source,
@@ -1449,8 +1475,70 @@
 );
 
-/*
- *  Boot Time Mount Table Structure
- */
-
+/**
+ * @brief Per file system type routine.
+ *
+ * @see rtems_filesystem_iterate().
+ *
+ * @retval true Stop the iteration.
+ * @retval false Continue the iteration.
+ */
+typedef bool (*rtems_per_filesystem_routine)(
+  const rtems_filesystem_table_t *fs_entry,
+  void *arg
+);
+
+/**
+ * @brief Iterates over all file system types.
+ *
+ * For each file system type the @a routine will be called with the entry and
+ * the @a routine_arg parameter.
+ *
+ * Do not register or unregister file system types in @a routine.
+ *
+ * The iteration is protected by the IO library mutex.
+ *
+ * @retval true Iteration stopped due to @a routine return status.
+ * @retval false Iteration through all entries.
+ */
+bool rtems_filesystem_iterate(
+  rtems_per_filesystem_routine routine,
+  void *routine_arg
+);
+
+/**
+ * @brief Per file system mount routine.
+ *
+ * @see rtems_filesystem_mount_iterate().
+ *
+ * @retval true Stop the iteration.
+ * @retval false Continue the iteration.
+ */
+typedef bool (*rtems_per_filesystem_mount_routine)(
+  const rtems_filesystem_mount_table_entry_t *mt_entry,
+  void *arg
+);
+
+/**
+ * @brief Iterates over all file system mounts.
+ *
+ * For each file system mount the @a routine will be called with the entry and
+ * the @a routine_arg parameter.
+ *
+ * Do not mount or unmount file systems in @a routine.
+ *
+ * The iteration is protected by the IO library mutex.
+ *
+ * @retval true Iteration stopped due to @a routine return status.
+ * @retval false Iteration through all entries.
+ */
+bool
+rtems_filesystem_mount_iterate(
+  rtems_per_filesystem_mount_routine routine,
+  void *routine_arg
+);
+
+/**
+ * @brief Boot time mount table entry.
+ */
 typedef struct {
   const char                              *type;
@@ -1460,28 +1548,17 @@
 } rtems_filesystem_mount_table_t;
 
+/**
+ * @brief Boot time mount table.
+ *
+ * @todo Only the first entry will be evaluated.  Why do we need a table?
+ */
 extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
-extern const int                             rtems_filesystem_mount_table_size;
-
-typedef void (*rtems_libio_init_functions_t)(void);
-extern  rtems_libio_init_functions_t rtems_libio_init_helper;
-
-void    open_dev_console(void);
-
-typedef void (*rtems_libio_supp_functions_t)(void);
-extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
-
-typedef void (*rtems_fs_init_functions_t)(void);
-extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
-
-/**
- * @brief Creates a directory and all its parent directories according to
- * @a path.
- *
- * The @a mode value selects the access permissions of the directory.
- *
- * @retval 0 Successful operation.
- * @retval -1 An error occured.  The @c errno indicates the error.
- */
-extern int rtems_mkdir(const char *path, mode_t mode);
+
+/**
+ * @brief Boot time mount table entry count.
+ *
+ * @todo Only the first entry will be evaluated.  Why do we need a table?
+ */
+extern const int rtems_filesystem_mount_table_size;
 
 /** @} */
@@ -1557,4 +1634,24 @@
 /** @} */
 
+/**
+ * @brief The pathconf setting for a file system.
+ */
+#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
+
+/**
+ * @brief The type of file system. Its name.
+ */
+#define rtems_filesystem_type(_mte) ((_mte)->type)
+
+/**
+ * @brief The mount point of a file system.
+ */
+#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
+
+/**
+ * @brief The device entry of a file system.
+ */
+#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
+
 #ifdef __cplusplus
 }
Index: cpukit/libcsupport/include/rtems/libio_.h
===================================================================
--- cpukit/libcsupport/include/rtems/libio_.h	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libcsupport/include/rtems/libio_.h	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -39,9 +39,4 @@
 extern rtems_id                          rtems_libio_semaphore;
 extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
-
-/*
- * Mount table list.
- */
-extern rtems_chain_control rtems_filesystem_mount_table_control;
 
 /*
Index: cpukit/libcsupport/src/mount-mgr.c
===================================================================
--- cpukit/libcsupport/src/mount-mgr.c	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libcsupport/src/mount-mgr.c	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -38,8 +38,7 @@
 } filesystem_node;
 
-RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
+static RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
 
-void
-rtems_filesystem_iterate(
+bool rtems_filesystem_iterate(
   rtems_per_filesystem_routine routine,
   void *routine_arg
@@ -48,26 +47,26 @@
   const rtems_filesystem_table_t *table_entry = &rtems_filesystem_table [0];
   rtems_chain_node *node = NULL;
+  bool stop = false;
 
-  while ( table_entry->type ) {
-    if ( !(*routine)( table_entry, routine_arg ) ) {
-      break;
-    }
-
+  while ( table_entry->type && !stop ) {
+    stop = (*routine)( table_entry, routine_arg );
     ++table_entry;
   }
 
-  rtems_libio_lock();
-  for (
-    node = rtems_chain_first( &filesystem_chain );
-    !rtems_chain_is_tail( &filesystem_chain, node );
-    node = rtems_chain_next( node )
-  ) {
-    const filesystem_node *fsn = (filesystem_node *) node;
+  if ( !stop ) {
+    rtems_libio_lock();
+    for (
+      node = rtems_chain_first( &filesystem_chain );
+      !rtems_chain_is_tail( &filesystem_chain, node ) && !stop;
+      node = rtems_chain_next( node )
+    ) {
+      const filesystem_node *fsn = (filesystem_node *) node;
 
-    if ( !(*routine)( &fsn->entry, routine_arg ) ) {
-      break;
+      stop = (*routine)( &fsn->entry, routine_arg );
     }
+    rtems_libio_unlock();
   }
-  rtems_libio_unlock();
+
+  return stop;
 }
 
@@ -82,5 +81,5 @@
 
   if ( strcmp( entry->type, fa->type ) != 0 ) {
-    return true;
+    return false;
   } else {
     fa->mount_h = entry->mount_h;
Index: cpukit/libcsupport/src/mount.c
===================================================================
--- cpukit/libcsupport/src/mount.c	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libcsupport/src/mount.c	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -37,8 +37,5 @@
 #include <rtems/libio_.h>
 
-/*
- * Mount table list.
- */
-RTEMS_CHAIN_DEFINE_EMPTY(rtems_filesystem_mount_table_control);
+static RTEMS_CHAIN_DEFINE_EMPTY(mount_chain);
 
 /*
@@ -60,35 +57,10 @@
 };
 
-/*
- *  Is_node_fs_root
- *
- *  This routine will run through the entries that currently exist in the
- *  mount table chain. For each entry in the mount table chain it will
- *  compare the mount tables root node to the node describing the selected
- *  mount point. If any match is found true is returned else false is
- *  returned.
- *
- */
-
-static bool Is_node_fs_root(
-  rtems_filesystem_location_info_t *loc
+static bool is_node_fs_root(
+  const rtems_filesystem_mount_table_entry_t *mt_entry,
+  void *arg
 )
 {
-  rtems_chain_node *node = NULL;
-
-  /*
-   * For each mount table entry
-   */
-  for ( node = rtems_chain_first( &rtems_filesystem_mount_table_control );
-        !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, node );
-        node = rtems_chain_next( node ) ) {
-    rtems_filesystem_mount_table_entry_t *mount_table_entry =
-      (rtems_filesystem_mount_table_entry_t *) node;
-
-    if ( mount_table_entry->mt_fs_root.node_access == loc->node_access )
-      return true;
-  }
-
-  return false;
+  return arg == mt_entry->mt_fs_root.node_access;
 }
 
@@ -226,5 +198,5 @@
      */
 
-    if ( Is_node_fs_root(  &loc ) ){
+    if ( rtems_filesystem_mount_iterate( is_node_fs_root, loc.node_access ) ) {
       errno = EBUSY;
       goto cleanup_and_bail;
@@ -261,5 +233,5 @@
      * Do we already have a base file system ?
      */
-    if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) ) {
+    if ( !rtems_chain_is_empty( &mount_chain ) ) {
       errno = EINVAL;
       goto cleanup_and_bail;
@@ -286,6 +258,7 @@
    *  Add the mount table entry to the mount table chain
    */
-  rtems_chain_append( &rtems_filesystem_mount_table_control,
-                      &mt_entry->Node );
+  rtems_libio_lock();
+  rtems_chain_append( &mount_chain, &mt_entry->Node );
+  rtems_libio_unlock();
 
   if ( !has_target )
@@ -304,32 +277,25 @@
 }
 
-/*
- * Get the first entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t *
-rtems_filesystem_mounts_first(
-  void
+bool rtems_filesystem_mount_iterate(
+  rtems_per_filesystem_mount_routine routine,
+  void *routine_arg
 )
 {
-  rtems_filesystem_mount_table_entry_t *entry = NULL;
-
-  if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) )
-    entry = (rtems_filesystem_mount_table_entry_t *)
-      rtems_chain_first( &rtems_filesystem_mount_table_control );
-
-  return entry;
+  rtems_chain_node *node = NULL;
+  bool stop = false;
+
+  rtems_libio_lock();
+  for (
+    node = rtems_chain_first( &mount_chain );
+    !rtems_chain_is_tail( &mount_chain, node ) && !stop;
+    node = rtems_chain_next( node )
+  ) {
+    const rtems_filesystem_mount_table_entry_t *mt_entry =
+      (rtems_filesystem_mount_table_entry_t *) node;
+
+    stop = (*routine)( mt_entry, routine_arg );
+  }
+  rtems_libio_unlock();
+
+  return stop;
 }
-
-/*
- * Get the next entry in the mount table.
- */
-rtems_filesystem_mount_table_entry_t *
-rtems_filesystem_mounts_next(
-  rtems_filesystem_mount_table_entry_t *entry
-)
-{
-  if ( !entry )
-    return NULL;
-  return (rtems_filesystem_mount_table_entry_t *)
-    rtems_chain_next( &entry->Node );
-}
Index: cpukit/libcsupport/src/statvfs.c
===================================================================
--- cpukit/libcsupport/src/statvfs.c	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libcsupport/src/statvfs.c	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -21,9 +21,4 @@
 
 #include <sys/statvfs.h>
-
-/*
- *  Data structures and routines private to mount/unmount pair.
- */
-extern rtems_chain_control rtems_filesystem_mount_table_control;
 
 int
Index: cpukit/libcsupport/src/unmount.c
===================================================================
--- cpukit/libcsupport/src/unmount.c	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libcsupport/src/unmount.c	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -23,5 +23,4 @@
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <rtems/chain.h>
 #include <fcntl.h>
 #include <unistd.h>
@@ -33,49 +32,12 @@
 #include <rtems/libio_.h>
 #include <rtems/seterr.h>
+#include <rtems/chain.h>
 
-bool rtems_filesystem_nodes_equal(
-  const rtems_filesystem_location_info_t   *loc1,
-  const rtems_filesystem_location_info_t   *loc2
-){
-  return ( loc1->node_access == loc2->node_access );
-}
-
-
-/*
- *  file_systems_below_this_mountpoint
- *
- *  This routine will run through the entries that currently exist in the
- *  mount table chain. For each entry in the mount table chain it will
- *  compare the mount tables mt_fs_root to the new_fs_root_node. If any of the
- *  mount table file system root nodes matches the new file system root node
- *  this indicates that we are trying to mount a file system that has already
- *  been mounted. This is not a permitted operation. temp_loc is set to
- *  the root node of the file system being unmounted.
- */
-
-bool file_systems_below_this_mountpoint(
-  const char                            *path __attribute__((unused)),
-  rtems_filesystem_location_info_t      *fs_root_loc,
-  rtems_filesystem_mount_table_entry_t  *fs_to_unmount __attribute__((unused))
+static bool is_fs_below_mount_point(
+  const rtems_filesystem_mount_table_entry_t *mt_entry,
+  void *arg
 )
 {
-  rtems_chain_node                     *the_node;
-  rtems_filesystem_mount_table_entry_t *the_mount_entry;
-
-  /*
-   * Search the mount table for any mount entries referencing this
-   * mount entry.
-   */
-
-  for ( the_node = rtems_filesystem_mount_table_control.first;
-        !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node );
-        the_node = the_node->next ) {
-     the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
-     if (the_mount_entry->mt_point_node.mt_entry  == fs_root_loc->mt_entry ) {
-        return true;
-     }
-  }
-
-  return false;
+  return arg == mt_entry->mt_point_node.mt_entry;
 }
 
@@ -115,5 +77,5 @@
    */
 
-  if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){
+  if ( fs_root_loc->node_access != loc.node_access ){
     rtems_filesystem_freenode( &loc );
     rtems_set_errno_and_return_minus_one( EACCES );
@@ -152,5 +114,6 @@
    */
 
-  if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 )
+  if ( rtems_filesystem_mount_iterate( is_fs_below_mount_point,
+                                       fs_root_loc->mt_entry ) )
     rtems_set_errno_and_return_minus_one( EBUSY );
 
@@ -196,5 +159,7 @@
    */
 
-  rtems_chain_extract( ( rtems_chain_node * ) mt_entry );
+  rtems_libio_lock();
+  rtems_chain_extract( &mt_entry->Node );
+  rtems_libio_unlock();
 
   /*
Index: cpukit/libmisc/shell/main_mount.c
===================================================================
--- cpukit/libmisc/shell/main_mount.c	(revision 59673224e00e1ed566e782532b797e564fada90d)
+++ cpukit/libmisc/shell/main_mount.c	(revision 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03)
@@ -32,5 +32,5 @@
   printf("%s ", entry->type);
 
-  return true;
+  return false;
 }
 
