Changeset 7d01d244 in rtems


Ignore:
Timestamp:
Jun 7, 2010, 3:35:24 PM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
9f5f6f53
Parents:
452fdc10
Message:

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

  • libcsupport/include/rtems/libio_.h: Declare rtems_filesystem_mount_table_control.
  • libcsupport/include/rtems/libio.h: Removed rtems_filesystem_table_first(), rtems_filesystem_table_next() and rtems_filesystem_table_node_t declarations. Declare rtems_per_filesystem_routine, rtems_filesystem_iterate() and rtems_filesystem_get_mount_handler().
  • libcsupport/src/mount.c: Added rtems_filesystem_mounts_first() and rtems_filesystem_mounts_next(). Simplify mount(). Removed rtems_filesystem_mount_table_control_init. Use rtems_filesystem_get_mount_handler().
  • libcsupport/src/mount-mgr.c: Removed rtems_filesystem_mounts_first() and rtems_filesystem_mounts_next(). Added rtems_filesystem_iterate() and rtems_filesystem_get_mount_handler(). Use rtems_libio_lock() and rtems_libio_unlock();
  • sapi/include/confdefs.h, libmisc/shell/main_mount.c: Update for mount API changes.
Location:
cpukit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r452fdc10 r7d01d244  
     12010-06-07      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * libcsupport/include/rtems/libio_.h: Declare
     4        rtems_filesystem_mount_table_control.
     5        * libcsupport/include/rtems/libio.h: Removed
     6        rtems_filesystem_table_first(), rtems_filesystem_table_next() and
     7        rtems_filesystem_table_node_t declarations.  Declare
     8        rtems_per_filesystem_routine, rtems_filesystem_iterate() and
     9        rtems_filesystem_get_mount_handler().
     10        * libcsupport/src/mount.c: Added rtems_filesystem_mounts_first() and
     11        rtems_filesystem_mounts_next().  Simplify mount().  Removed
     12        rtems_filesystem_mount_table_control_init.  Use
     13        rtems_filesystem_get_mount_handler().
     14        * libcsupport/src/mount-mgr.c: Removed rtems_filesystem_mounts_first() and
     15        rtems_filesystem_mounts_next().  Added rtems_filesystem_iterate() and
     16        rtems_filesystem_get_mount_handler().  Use rtems_libio_lock() and
     17        rtems_libio_unlock();
     18        * sapi/include/confdefs.h, libmisc/shell/main_mount.c: Update for
     19        mount API changes.
     20
    1212010-06-07      Bharath Suri <bharath.s.jois@gmail.com>
    222
  • cpukit/libcsupport/include/rtems/libio.h

    r452fdc10 r7d01d244  
    290290};
    291291
    292 /*
    293  * File system table used by mount to manage file systems.
     292/**
     293 * @brief File system table entry.
    294294 */
    295295typedef struct rtems_filesystem_table_t {
     
    298298} rtems_filesystem_table_t;
    299299
    300 /*
    301  * File system table runtime loaded nodes.
    302  */
    303 typedef struct rtems_filesystem_table_node_t {
    304   rtems_chain_node         node;
    305   rtems_filesystem_table_t entry;
    306 } rtems_filesystem_table_node_t;
    307 
    308 /*
    309  * Get the first entry in the filesystem table.
    310  */
    311 const rtems_filesystem_table_t* rtems_filesystem_table_first( void );
    312 
    313 /*
    314  * Get the next entry in the file system table.
    315  */
    316 const rtems_filesystem_table_t*
    317 rtems_filesystem_table_next( const rtems_filesystem_table_t *entry );
     300/**
     301 * @brief Static table of file systems.
     302 *
     303 * Externally defined by confdefs.h or the user.
     304 */
     305extern const rtems_filesystem_table_t rtems_filesystem_table [];
     306
     307/**
     308 * @brief Per file system table entry routine type.
     309 *
     310 * Return @c true to continue the iteration, and @c false to stop.
     311 */
     312typedef bool (*rtems_per_filesystem_routine)(
     313  const rtems_filesystem_table_t *entry,
     314  void *arg
     315);
     316
     317/**
     318 * @brief Iterates over the file system table.
     319 *
     320 * For each file system table entry the @a routine will be called with the
     321 * table entry and the @a routine_arg parameter.
     322 */
     323void
     324rtems_filesystem_iterate(
     325  rtems_per_filesystem_routine routine,
     326  void *routine_arg
     327);
     328
     329/**
     330 * @brief Returns the file system mount handler associated with the @a type, or
     331 * @c NULL if no such association exists.
     332 */
     333rtems_filesystem_fsmount_me_t
     334rtems_filesystem_get_mount_handler(
     335  const char *type
     336);
    318337
    319338/*
  • cpukit/libcsupport/include/rtems/libio_.h

    r452fdc10 r7d01d244  
    3939extern rtems_id                          rtems_libio_semaphore;
    4040extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
     41
     42/*
     43 * Mount table list.
     44 */
     45extern rtems_chain_control rtems_filesystem_mount_table_control;
    4146
    4247/*
  • cpukit/libcsupport/src/mount-mgr.c

    r452fdc10 r7d01d244  
    66 *
    77 *  COPYRIGHT (c) Chris Johns <chrisj@rtems.org> 2010.
     8 *
     9 *  Copyright (c) 2010 embedded brains GmbH.
    810 *
    911 *  The license and distribution terms for this file may be
     
    3133#include <rtems/libio_.h>
    3234
    33 /*
    34  * External defined by confdefs.h or the user.
    35  */
    36 extern const rtems_filesystem_table_t configuration_filesystem_table[];
     35typedef struct {
     36  rtems_chain_node node;
     37  rtems_filesystem_table_t entry;
     38} filesystem_node;
    3739
    38 /*
    39  * Points to a list of filesystems added at runtime.
    40  */
    41 extern rtems_chain_control *rtems_filesystem_table;
     40RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
    4241
    43 /*
    44  * Mount table list.
    45  */
    46 extern rtems_chain_control rtems_filesystem_mount_table_control;
    47 extern bool                rtems_filesystem_mount_table_control_init;
    48 
    49 /*
    50  * Get the first entry in the filesystem table.
    51  */
    52 const rtems_filesystem_table_t*
    53 rtems_filesystem_table_first(
    54   void
     42void
     43rtems_filesystem_iterate(
     44  rtems_per_filesystem_routine routine,
     45  void *routine_arg
    5546)
    5647{
    57   /*
    58    * We can assume this because it is the root file system.
    59    */
    60   return &configuration_filesystem_table[0];
     48  const rtems_filesystem_table_t *table_entry = &rtems_filesystem_table [0];
     49  rtems_chain_node *node = NULL;
     50
     51  while ( table_entry->type ) {
     52    if ( !(*routine)( table_entry, routine_arg ) ) {
     53      break;
     54    }
     55
     56    ++table_entry;
     57  }
     58
     59  rtems_libio_lock();
     60  for (
     61    node = rtems_chain_first( &filesystem_chain );
     62    !rtems_chain_is_tail( &filesystem_chain, node );
     63    node = rtems_chain_next( node )
     64  ) {
     65    const filesystem_node *fsn = (filesystem_node *) node;
     66
     67    if ( !(*routine)( &fsn->entry, routine_arg ) ) {
     68      break;
     69    }
     70  }
     71  rtems_libio_unlock();
    6172}
    6273
    63 /*
    64  * Get the next entry in the file system table.
    65  */
    66 const rtems_filesystem_table_t*
    67 rtems_filesystem_table_next(
    68   const rtems_filesystem_table_t *entry
     74typedef struct {
     75  const char *type;
     76  rtems_filesystem_fsmount_me_t mount_h;
     77} find_arg;
     78
     79static bool find_handler(const rtems_filesystem_table_t *entry, void *arg)
     80{
     81  find_arg *fa = arg;
     82
     83  if ( strcmp( entry->type, fa->type ) != 0 ) {
     84    return true;
     85  } else {
     86    fa->mount_h = entry->mount_h;
     87
     88    return true;
     89  }
     90}
     91
     92rtems_filesystem_fsmount_me_t
     93rtems_filesystem_get_mount_handler(
     94  const char *type
    6995)
    7096{
    71   const rtems_filesystem_table_t* fs;
     97  find_arg fa = {
     98    .type = type,
     99    .mount_h = NULL
     100  };
    72101
    73   fs = rtems_filesystem_table_first( );
    74  
    75   while ( fs->type && ( fs != entry ) )
    76     ++fs;
    77  
    78   if ( fs->type ) {
    79     ++fs;
    80     if ( fs->type )
    81       return fs;
     102  if ( type != NULL ) {
     103    rtems_filesystem_iterate( find_handler, &fa );
    82104  }
    83105
    84   if ( rtems_filesystem_table ) {
    85     rtems_chain_node* node;
    86     for (node = rtems_chain_first( rtems_filesystem_table );
    87          !rtems_chain_is_tail( rtems_filesystem_table, node);
    88          node = rtems_chain_next( node )) {
    89       rtems_filesystem_table_node_t* tnode;
    90       tnode = (rtems_filesystem_table_node_t*) node;
    91       if ( entry == &tnode->entry ) {
    92         node = rtems_chain_next( node );
    93         if ( !rtems_chain_is_tail( rtems_filesystem_table, node ) ) {
    94           tnode = (rtems_filesystem_table_node_t*) node;
    95           return &tnode->entry;
    96         }
    97       }
    98     }
    99   }
    100  
    101   return NULL;
     106  return fa.mount_h;
    102107}
    103108
    104 /*
    105  * Get the first entry in the mount table.
    106  */
    107 rtems_filesystem_mount_table_entry_t*
    108 rtems_filesystem_mounts_first(
    109   void
    110 )
    111 {
    112   rtems_filesystem_mount_table_entry_t* entry = NULL;
    113   if ( rtems_filesystem_mount_table_control_init ) {
    114     if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) )
    115       entry = (rtems_filesystem_mount_table_entry_t*)
    116         rtems_chain_first( &rtems_filesystem_mount_table_control );
    117   }
    118   return entry;
    119 }
    120 
    121 /*
    122  * Get the next entry in the mount table.
    123  */
    124 rtems_filesystem_mount_table_entry_t*
    125 rtems_filesystem_mounts_next(
    126   rtems_filesystem_mount_table_entry_t *entry
    127 )
    128 {
    129   if ( !rtems_filesystem_mount_table_control_init || !entry )
    130     return NULL;
    131   return (rtems_filesystem_mount_table_entry_t*) rtems_chain_next( &entry->Node );
    132 }
    133 
    134 /*
    135  * Register a file system.
    136  */
    137109int
    138110rtems_filesystem_register(
     
    141113)
    142114{
    143   rtems_filesystem_table_node_t *fs;
    144   if ( !rtems_filesystem_table ) {
    145     rtems_filesystem_table = malloc( sizeof( rtems_chain_control ) );
    146     if ( !rtems_filesystem_table )
    147       rtems_set_errno_and_return_minus_one( ENOMEM );
    148     rtems_chain_initialize_empty ( rtems_filesystem_table );
     115  size_t fsn_size = sizeof( filesystem_node ) + strlen(type) + 1;
     116  filesystem_node *fsn = malloc( fsn_size );
     117  char *type_storage = (char *) fsn + sizeof( filesystem_node );
     118
     119  if ( fsn == NULL )
     120    rtems_set_errno_and_return_minus_one( ENOMEM );
     121
     122  strcpy(type_storage, type);
     123  fsn->entry.type = type_storage;
     124  fsn->entry.mount_h = mount_h;
     125
     126  rtems_libio_lock();
     127  if ( rtems_filesystem_get_mount_handler( type ) == NULL ) {
     128    rtems_chain_append( &filesystem_chain, &fsn->node );
     129  } else {
     130    rtems_libio_unlock();
     131    free( fsn );
     132
     133    rtems_set_errno_and_return_minus_one( EINVAL );
    149134  }
    150   fs = malloc( sizeof( rtems_filesystem_table_node_t ) );
    151   if ( !fs )
    152     rtems_set_errno_and_return_minus_one( ENOMEM );
    153   fs->entry.type = strdup( type );
    154   if ( !fs->entry.type ) {
    155     free( fs );
    156     rtems_set_errno_and_return_minus_one( ENOMEM );
    157   }   
    158   fs->entry.mount_h = mount_h;
    159   rtems_chain_append( rtems_filesystem_table, &fs->node );
     135  rtems_libio_unlock();
     136
    160137  return 0;
    161138}
    162139
    163 /*
    164  * Unregister a file system.
    165  */
    166140int
    167141rtems_filesystem_unregister(
     
    169143)
    170144{
    171   if ( rtems_filesystem_table ) {
    172     rtems_chain_node *node;
    173     for (node = rtems_chain_first( rtems_filesystem_table );
    174          !rtems_chain_is_tail( rtems_filesystem_table, node );
    175          node = rtems_chain_next( node ) ) {
    176       rtems_filesystem_table_node_t *fs;
    177       fs = (rtems_filesystem_table_node_t*) node;
    178       if ( strcmp( fs->entry.type, type ) == 0 ) {
    179         rtems_chain_extract( node );
    180         free( (void*) fs->entry.type );
    181         free( fs );
    182         return 0;
    183       }
     145  rtems_chain_node *node = NULL;
     146
     147  if ( type == NULL ) {
     148    rtems_set_errno_and_return_minus_one( EINVAL );
     149  }
     150
     151  rtems_libio_lock();
     152  for (
     153    node = rtems_chain_first( &filesystem_chain );
     154    !rtems_chain_is_tail( &filesystem_chain, node );
     155    node = rtems_chain_next( node )
     156  ) {
     157    filesystem_node *fsn = (filesystem_node *) node;
     158
     159    if ( strcmp( fsn->entry.type, type ) == 0 ) {
     160      rtems_chain_extract( node );
     161      free( fsn );
     162      rtems_libio_unlock();
     163
     164      return 0;
    184165    }
    185166  }
     167  rtems_libio_unlock();
     168
    186169  rtems_set_errno_and_return_minus_one( ENOENT );
    187170}
  • cpukit/libcsupport/src/mount.c

    r452fdc10 r7d01d244  
    1111 *  On-Line Applications Research Corporation (OAR).
    1212 *
     13 *  Copyright (c) 2010 embedded brains GmbH.
     14 *
    1315 *  The license and distribution terms for this file may be
    1416 *  found in the file LICENSE in this distribution or at
     
    2527#include <sys/stat.h>
    2628#include <rtems/chain.h>
     29#include <rtems/seterr.h>
    2730#include <fcntl.h>
    2831#include <unistd.h>
     
    3538
    3639/*
    37  * External defined by confdefs.h or the user.
    38  */
    39 extern const rtems_filesystem_table_t configuration_filesystem_table[];
    40 
    41 /*
    42  * Points to a list of filesystems added at runtime.
    43  */
    44 rtems_chain_control *rtems_filesystem_table;
    45 
    46 /*
    4740 * Mount table list.
    4841 */
    49 rtems_chain_control rtems_filesystem_mount_table_control;
    50 bool                rtems_filesystem_mount_table_control_init;
     42RTEMS_CHAIN_DEFINE_EMPTY(rtems_filesystem_mount_table_control);
    5143
    5244/*
     
    8072
    8173static bool Is_node_fs_root(
    82   rtems_filesystem_location_info_t  *loc
    83 )
    84 {
    85   rtems_chain_node                     *the_node;
    86   rtems_filesystem_mount_table_entry_t *the_mount_entry;
     74  rtems_filesystem_location_info_t *loc
     75)
     76{
     77  rtems_chain_node *node = NULL;
    8778
    8879  /*
    8980   * For each mount table entry
    9081   */
    91   if ( rtems_filesystem_mount_table_control_init ) {
    92     for ( the_node = rtems_chain_first( &rtems_filesystem_mount_table_control );
    93           !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node );
    94           the_node = rtems_chain_next( the_node ) ) {
    95       the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node;
    96       if ( the_mount_entry->mt_fs_root.node_access  == loc->node_access )
    97         return true;
    98     }
     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;
    9990  }
     91
    10092  return false;
     93}
     94
     95static rtems_filesystem_mount_table_entry_t *alloc_mount_table_entry(
     96  const char *source,
     97  const char *target,
     98  const char *filesystemtype,
     99  size_t *target_length_ptr
     100)
     101{
     102  const char *target_str = target ? target : "/";
     103  size_t filesystemtype_size = strlen( filesystemtype ) + 1;
     104  size_t source_size = source ? strlen( source ) + 1 : 0;
     105  size_t target_length = strlen( target_str );
     106  size_t size = sizeof( rtems_filesystem_mount_table_entry_t )
     107    + filesystemtype_size + source_size + target_length + 1;
     108  rtems_filesystem_mount_table_entry_t *mt_entry = calloc( 1, size );
     109
     110  if ( mt_entry ) {
     111    char *str = (char *) mt_entry + sizeof( *mt_entry );
     112
     113    mt_entry->type = str;
     114    strcpy( str, filesystemtype );
     115
     116    if ( source ) {
     117      str += filesystemtype_size;
     118      mt_entry->dev = str;
     119      strcpy( str, source );
     120    }
     121
     122    str += source_size;
     123    mt_entry->target = str;
     124    strcpy( str, target );
     125  }
     126
     127  *target_length_ptr = target_length;
     128
     129  return mt_entry;
    101130}
    102131
     
    122151  rtems_filesystem_options_t options,
    123152  const void                 *data
    124           )
    125 {
    126   const rtems_filesystem_table_t       *entry;
     153)
     154{
     155  rtems_filesystem_fsmount_me_t mount_h = NULL;
    127156  rtems_filesystem_location_info_t      loc;
    128157  rtems_filesystem_mount_table_entry_t *mt_entry = NULL;
    129158  rtems_filesystem_location_info_t     *loc_to_free = NULL;
    130   size_t size;
    131 
    132   /*
    133    * If mount is ever called we allocate the mount table control structure.
    134    */
    135   if ( !rtems_filesystem_mount_table_control_init ) {
    136     rtems_filesystem_mount_table_control_init = true;
    137     rtems_chain_initialize_empty ( &rtems_filesystem_mount_table_control );
    138   }
     159  bool has_target = target != NULL;
     160  size_t target_length = 0;
    139161
    140162  /*
     
    143165
    144166  if ( options != RTEMS_FILESYSTEM_READ_ONLY &&
    145        options != RTEMS_FILESYSTEM_READ_WRITE ) {
    146     errno = EINVAL;
    147     return -1;
    148   }
    149 
    150   /*
    151    * Check the type.
    152    */
    153   if (!filesystemtype) {
    154     errno = EINVAL;
    155     return -1;
    156   }
    157 
    158   if (strlen(filesystemtype) >= 128) {
    159     errno = EINVAL;
    160     return -1;
    161   }
    162    
    163   /*
    164    * Check the configuration table filesystems then check any runtime added
    165    * file systems.
    166    */
    167   entry = &configuration_filesystem_table[0];
    168   while (entry->type) {
    169     if (strcmp (filesystemtype, entry->type) == 0)
    170       break;
    171     ++entry;
    172   }
    173  
    174   if (!entry->type) {
    175     entry = NULL;
    176     if (rtems_filesystem_table) {
    177       rtems_chain_node *the_node;
    178       for (the_node = rtems_chain_first(rtems_filesystem_table);
    179            !rtems_chain_is_tail(rtems_filesystem_table, the_node);
    180            the_node = rtems_chain_next(the_node)) {
    181         entry = &(((rtems_filesystem_table_node_t*) the_node)->entry);
    182         if (strcmp (filesystemtype, entry->type) == 0)
    183           break;
    184         entry = NULL;
    185       }
    186     }
    187   }
    188 
    189   if (!entry)
    190   {
    191     errno = EINVAL;
    192     return -1;
    193   }
    194  
     167       options != RTEMS_FILESYSTEM_READ_WRITE )
     168    rtems_set_errno_and_return_minus_one( EINVAL );
     169
     170  /*
     171   *  Get mount handler
     172   */
     173  mount_h = rtems_filesystem_get_mount_handler( filesystemtype );
     174  if ( !mount_h )
     175    rtems_set_errno_and_return_minus_one( EINVAL );
     176
    195177  /*
    196178   * Allocate a mount table entry
    197179   */
    198 
    199   size = sizeof(rtems_filesystem_mount_table_entry_t);
    200   if ( source )
    201     size += strlen( source ) + 1;
    202    
    203   mt_entry = malloc( size );
    204   if ( !mt_entry ) {
    205     errno = ENOMEM;
    206     return -1;
    207   }
    208 
    209   memset( mt_entry, 0, size );
    210    
     180  mt_entry = alloc_mount_table_entry(
     181    source,
     182    target,
     183    filesystemtype,
     184    &target_length
     185  );
     186  if ( !mt_entry )
     187    rtems_set_errno_and_return_minus_one( ENOMEM );
     188
    211189  mt_entry->mt_fs_root.mt_entry = mt_entry;
    212   mt_entry->type = entry->type;
    213190  mt_entry->options = options;
    214191  mt_entry->pathconf_limits_and_options = rtems_filesystem_default_pathconf;
    215    
    216   if ( source ) {
    217     mt_entry->dev =
    218       (char *)mt_entry + sizeof( rtems_filesystem_mount_table_entry_t );
    219     strcpy( mt_entry->dev, source );
    220   } else
    221     mt_entry->dev = 0;
    222192
    223193  /*
     
    226196   */
    227197
    228   if ( target ) {
    229 
     198  if ( has_target ) {
    230199    if ( rtems_filesystem_evaluate_path(
    231            target, strlen( target ), RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
     200           target, target_length, RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
    232201      goto cleanup_and_bail;
    233202
     
    273242    mt_entry->mt_point_node.ops = loc.ops;
    274243    mt_entry->mt_point_node.mt_entry = loc.mt_entry;
    275      
     244
    276245    /*
    277246     *  This link to the parent is only done when we are dealing with system
     
    287256      goto cleanup_and_bail;
    288257    }
    289 
    290     mt_entry->target = strdup( target );
    291258  } else {
    292 
    293259    /*
    294260     * Do we already have a base file system ?
     
    298264      goto cleanup_and_bail;
    299265    }
    300    
     266
    301267    /*
    302268     *  This is a mount of the base file system --> The
    303      *  mt_point_node.node_access will be set to null to indicate that this
     269     *  mt_point_node.node_access will be left to null to indicate that this
    304270     *  is the root of the entire file system.
    305271     */
    306 
    307     mt_entry->mt_fs_root.node_access = NULL;
    308     mt_entry->mt_fs_root.handlers = NULL;
    309     mt_entry->mt_fs_root.ops = NULL;
    310 
    311     mt_entry->mt_point_node.node_access = NULL;
    312     mt_entry->mt_point_node.handlers = NULL;
    313     mt_entry->mt_point_node.ops = NULL;
    314     mt_entry->mt_point_node.mt_entry = NULL;
    315 
    316     mt_entry->target = "/";
    317272  }
    318273
    319   if ( entry->mount_h( mt_entry, data ) ) {
     274  if ( (*mount_h)( mt_entry, data ) ) {
    320275    /*
    321276     * Try to undo the mount operation
     
    333288                      &mt_entry->Node );
    334289
    335   if ( !target )
     290  if ( !has_target )
    336291    rtems_filesystem_root = mt_entry->mt_fs_root;
    337292
     
    340295cleanup_and_bail:
    341296
    342   free( (void*) mt_entry->target );
    343297  free( mt_entry );
    344298
     
    349303}
    350304
     305/*
     306 * Get the first entry in the mount table.
     307 */
     308rtems_filesystem_mount_table_entry_t *
     309rtems_filesystem_mounts_first(
     310  void
     311)
     312{
     313  rtems_filesystem_mount_table_entry_t *entry = NULL;
     314
     315  if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) )
     316    entry = (rtems_filesystem_mount_table_entry_t *)
     317      rtems_chain_first( &rtems_filesystem_mount_table_control );
     318
     319  return entry;
     320}
     321
     322/*
     323 * Get the next entry in the mount table.
     324 */
     325rtems_filesystem_mount_table_entry_t *
     326rtems_filesystem_mounts_next(
     327  rtems_filesystem_mount_table_entry_t *entry
     328)
     329{
     330  if ( !entry )
     331    return NULL;
     332  return (rtems_filesystem_mount_table_entry_t *)
     333    rtems_chain_next( &entry->Node );
     334}
  • cpukit/libmisc/shell/main_mount.c

    r452fdc10 r7d01d244  
    2828#include "internal.h"
    2929
     30static bool print_filesystem(const rtems_filesystem_table_t *entry, void *arg)
     31{
     32  printf("%s ", entry->type);
     33
     34  return true;
     35}
     36
    3037int rtems_shell_main_mount(
    3138  int   argc,
     
    5663        options = RTEMS_FILESYSTEM_READ_ONLY;
    5764      } else if (argv[arg][1] == 'L') {
    58         const rtems_filesystem_table_t* fs;
    59         fs = rtems_filesystem_table_first();
    6065        printf ("File systems: ");
    61         while (fs) {
    62           printf ("%s ", fs->type);
    63           fs = rtems_filesystem_table_next(fs);
    64         }
     66        rtems_filesystem_iterate(print_filesystem, NULL);
    6567        printf ("\n");
    6668        return 0;
  • cpukit/sapi/include/confdefs.h

    r452fdc10 r7d01d244  
    390390   * The default file system table. Must be terminated with the NULL entry if
    391391   * you provide your own.
    392    *
    393    * The extern is needed to stop the table being removed by the optimizer.
    394    */
    395   extern const rtems_filesystem_table_t configuration_filesystem_table[];
     392   */
    396393  #ifndef CONFIGURE_HAS_OWN_FILESYSTEM_TABLE
    397     const rtems_filesystem_table_t configuration_filesystem_table[] = {
     394    const rtems_filesystem_table_t rtems_filesystem_table[] = {
    398395      #if defined(CONFIGURE_FILESYSTEM_miniIMFS) && \
    399396          defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS)
Note: See TracChangeset for help on using the changeset viewer.