diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-07-01 13:05:18 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-07-01 13:05:18 +0000 |
commit | 6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03 (patch) | |
tree | 4d22f3352e6456c69f45d9536732e4a1b6832c34 /cpukit/libcsupport/src/unmount.c | |
parent | 2010-07-01 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-6c0fcd4a39795f11f8d2b8caa2b69d0bd27a2c03.tar.bz2 |
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().
Diffstat (limited to 'cpukit/libcsupport/src/unmount.c')
-rw-r--r-- | cpukit/libcsupport/src/unmount.c | 57 |
1 files changed, 11 insertions, 46 deletions
diff --git a/cpukit/libcsupport/src/unmount.c b/cpukit/libcsupport/src/unmount.c index b535ea9b53..12c659dd6d 100644 --- a/cpukit/libcsupport/src/unmount.c +++ b/cpukit/libcsupport/src/unmount.c @@ -22,7 +22,6 @@ #include <sys/types.h> #include <sys/stat.h> -#include <rtems/chain.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> @@ -32,51 +31,14 @@ #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; } /* @@ -114,7 +76,7 @@ int unmount( * Verify this is the root node for the file system to be unmounted. */ - 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 ); } @@ -151,7 +113,8 @@ int unmount( * Verify there are no file systems below the path specified */ - 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 ); /* @@ -195,7 +158,9 @@ int unmount( * Extract the mount table entry from the chain */ - rtems_chain_extract( ( rtems_chain_node * ) mt_entry ); + rtems_libio_lock(); + rtems_chain_extract( &mt_entry->Node ); + rtems_libio_unlock(); /* * Free the memory node that was allocated in mount |