Changeset 955a34b5 in rtems for cpukit/libcsupport/src/mount.c


Ignore:
Timestamp:
Jul 1, 2010, 3:18:06 PM (10 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10
Children:
df719841
Parents:
c114654
Message:

2010-07-01 Sebastian Huber <sebastian.huber@…>

  • 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@…>

  • libfs/src/nfsclient/src/nfs.c, libfs/src/nfsclient/src/nfs.c, libfs/src/nfsclient/src/librtemsNfs.h: Renamed rtems_nfsfs_initialize() in rtems_nfs_initialize().
  • sapi/include/confdefs.h: Reflect changes above. Renamed *_miniIMFS in *_MINIIMFS. Renamed *_NFSFS in *_NFS.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/mount.c

    rc114654 r955a34b5  
    3737#include <rtems/libio_.h>
    3838
    39 /*
    40  * Mount table list.
    41  */
    42 RTEMS_CHAIN_DEFINE_EMPTY(rtems_filesystem_mount_table_control);
     39static RTEMS_CHAIN_DEFINE_EMPTY(mount_chain);
    4340
    4441/*
     
    6057};
    6158
    62 /*
    63  *  Is_node_fs_root
    64  *
    65  *  This routine will run through the entries that currently exist in the
    66  *  mount table chain. For each entry in the mount table chain it will
    67  *  compare the mount tables root node to the node describing the selected
    68  *  mount point. If any match is found true is returned else false is
    69  *  returned.
    70  *
    71  */
    72 
    73 static bool Is_node_fs_root(
    74   rtems_filesystem_location_info_t *loc
     59static bool is_node_fs_root(
     60  const rtems_filesystem_mount_table_entry_t *mt_entry,
     61  void *arg
    7562)
    7663{
    77   rtems_chain_node *node = NULL;
    78 
    79   /*
    80    * For each mount table entry
    81    */
    82   for ( node = rtems_chain_first( &rtems_filesystem_mount_table_control );
    83         !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, node );
    84         node = rtems_chain_next( node ) ) {
    85     rtems_filesystem_mount_table_entry_t *mount_table_entry =
    86       (rtems_filesystem_mount_table_entry_t *) node;
    87 
    88     if ( mount_table_entry->mt_fs_root.node_access == loc->node_access )
    89       return true;
    90   }
    91 
    92   return false;
     64  return arg == mt_entry->mt_fs_root.node_access;
    9365}
    9466
     
    226198     */
    227199
    228     if ( Is_node_fs_root(  &loc ) ){
     200    if ( rtems_filesystem_mount_iterate( is_node_fs_root, loc.node_access ) ) {
    229201      errno = EBUSY;
    230202      goto cleanup_and_bail;
     
    261233     * Do we already have a base file system ?
    262234     */
    263     if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) ) {
     235    if ( !rtems_chain_is_empty( &mount_chain ) ) {
    264236      errno = EINVAL;
    265237      goto cleanup_and_bail;
     
    286258   *  Add the mount table entry to the mount table chain
    287259   */
    288   rtems_chain_append( &rtems_filesystem_mount_table_control,
    289                       &mt_entry->Node );
     260  rtems_libio_lock();
     261  rtems_chain_append( &mount_chain, &mt_entry->Node );
     262  rtems_libio_unlock();
    290263
    291264  if ( !has_target )
     
    304277}
    305278
    306 /*
    307  * Get the first entry in the mount table.
    308  */
    309 rtems_filesystem_mount_table_entry_t *
    310 rtems_filesystem_mounts_first(
    311   void
     279bool rtems_filesystem_mount_iterate(
     280  rtems_per_filesystem_mount_routine routine,
     281  void *routine_arg
    312282)
    313283{
    314   rtems_filesystem_mount_table_entry_t *entry = NULL;
    315 
    316   if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) )
    317     entry = (rtems_filesystem_mount_table_entry_t *)
    318       rtems_chain_first( &rtems_filesystem_mount_table_control );
    319 
    320   return entry;
     284  rtems_chain_node *node = NULL;
     285  bool stop = false;
     286
     287  rtems_libio_lock();
     288  for (
     289    node = rtems_chain_first( &mount_chain );
     290    !rtems_chain_is_tail( &mount_chain, node ) && !stop;
     291    node = rtems_chain_next( node )
     292  ) {
     293    const rtems_filesystem_mount_table_entry_t *mt_entry =
     294      (rtems_filesystem_mount_table_entry_t *) node;
     295
     296    stop = (*routine)( mt_entry, routine_arg );
     297  }
     298  rtems_libio_unlock();
     299
     300  return stop;
    321301}
    322 
    323 /*
    324  * Get the next entry in the mount table.
    325  */
    326 rtems_filesystem_mount_table_entry_t *
    327 rtems_filesystem_mounts_next(
    328   rtems_filesystem_mount_table_entry_t *entry
    329 )
    330 {
    331   if ( !entry )
    332     return NULL;
    333   return (rtems_filesystem_mount_table_entry_t *)
    334     rtems_chain_next( &entry->Node );
    335 }
Note: See TracChangeset for help on using the changeset viewer.