Changeset 6c0fcd4 in rtems


Ignore:
Timestamp:
Jul 1, 2010, 1:05:18 PM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
7424c3ee
Parents:
59673224
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().
Location:
cpukit
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r59673224 r6c0fcd4  
     12010-07-01      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * libcsupport/include/rtems/libio_.h: Removed
     4        rtems_filesystem_mount_table_control.
     5        * libcsupport/include/rtems/libio.h, libcsupport/src/mount-mgr.c,
     6        libcsupport/src/mount.c libcsupport/src/statvfs.c,
     7        libcsupport/src/unmount.c, libmisc/shell/main_mount.c: Documentation.
     8        Removed rtems_filesystem_mounts_first() and
     9        rtems_filesystem_mounts_next().  Added
     10        rtems_filesystem_mount_iterate().  Changed return type of
     11        rtems_filesystem_iterate().  Removed rtems_filesystem_nodes_equal().
     12
    1132010-07-01      Sebastian Huber <sebastian.huber@embedded-brains.de>
    214
  • cpukit/libcsupport/include/rtems/libio.h

    r59673224 r6c0fcd4  
    10401040
    10411041/**
    1042  * @brief File system table entry.
    1043  */
    1044 typedef struct rtems_filesystem_table_t {
    1045   const char                    *type;
    1046   rtems_filesystem_fsmount_me_t  mount_h;
    1047 } rtems_filesystem_table_t;
    1048 
    1049 /**
    1050  * @brief Static table of file systems.
    1051  *
    1052  * Externally defined by confdefs.h or the user.
    1053  */
    1054 extern const rtems_filesystem_table_t rtems_filesystem_table [];
    1055 
    1056 /**
    1057  * @brief Per file system table entry routine type.
    1058  *
    1059  * @see rtems_filesystem_iterate().
    1060  *
    1061  * @retval true Continue the iteration.
    1062  * @retval false Stop the iteration.
    1063  */
    1064 typedef bool (*rtems_per_filesystem_routine)(
    1065   const rtems_filesystem_table_t *entry,
    1066   void *arg
    1067 );
    1068 
    1069 /**
    1070  * @brief Iterates over the file system table.
    1071  *
    1072  * For each file system table entry the @a routine will be called with the
    1073  * table entry and the @a routine_arg parameter.
    1074  */
    1075 void
    1076 rtems_filesystem_iterate(
    1077   rtems_per_filesystem_routine routine,
    1078   void *routine_arg
    1079 );
    1080 
    1081 /**
    10821042 * @brief Gets the mount handler for the file system @a type.
    10831043 *
     
    10871047rtems_filesystem_fsmount_me_t
    10881048rtems_filesystem_get_mount_handler(
    1089   const char *type
    1090 );
    1091 
    1092 /*
    1093  * Get the first entry in the mount table.
    1094  */
    1095 rtems_filesystem_mount_table_entry_t*
    1096 rtems_filesystem_mounts_first( void );
    1097 
    1098 /*
    1099  * Get the next entry in the mount table.
    1100  */
    1101 rtems_filesystem_mount_table_entry_t*
    1102 rtems_filesystem_mounts_next( rtems_filesystem_mount_table_entry_t *entry );
    1103 
    1104 /*
    1105  * Register a file system.
    1106  */
    1107 int
    1108 rtems_filesystem_register(
    1109   const char                    *type,
    1110   rtems_filesystem_fsmount_me_t  mount_h
    1111 );
    1112 
    1113 /*
    1114  * Unregister a file system.
    1115  */
    1116 int
    1117 rtems_filesystem_unregister(
    11181049  const char *type
    11191050);
     
    11461077
    11471078/**
    1148  * @brief Mount table entry.
    1149  */
    1150 struct rtems_filesystem_mount_table_entry_tt {
    1151   rtems_chain_node                       Node;
    1152   rtems_filesystem_location_info_t       mt_point_node;
    1153   rtems_filesystem_location_info_t       mt_fs_root;
    1154   int                                    options;
    1155   void                                  *fs_info;
    1156 
    1157   rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
    1158 
    1159   /*
    1160    * The target or mount point of the file system.
    1161    */
    1162   const char                            *target;
    1163 
    1164   /*
    1165    * The type of filesystem or the name of the filesystem.
    1166    */
    1167   const char                            *type;
    1168 
    1169   /*
    1170    *  When someone adds a mounted filesystem on a real device,
    1171    *  this will need to be used.
    1172    *
    1173    *  The lower layers can manage how this is managed. Leave as a
    1174    *  string.
    1175    */
    1176   char                                  *dev;
    1177 };
    1178 
    1179 /**
    1180  * @brief The pathconf setting for a file system.
    1181  */
    1182 #define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
    1183 
    1184 /**
    1185  * @brief The type of file system. Its name.
    1186  */
    1187 #define rtems_filesystem_type(_mte) ((_mte)->type)
    1188 
    1189 /**
    1190  * @brief The mount point of a file system.
    1191  */
    1192 #define rtems_filesystem_mount_point(_mte) ((_mte)->target)
    1193 
    1194 /**
    1195  * @brief The device entry of a file system.
    1196  */
    1197 #define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
    1198 
    1199 /**
    1200  * @brief File systems options.
    1201  */
    1202 typedef enum {
    1203   RTEMS_FILESYSTEM_READ_ONLY,
    1204   RTEMS_FILESYSTEM_READ_WRITE,
    1205   RTEMS_FILESYSTEM_BAD_OPTIONS
    1206 } rtems_filesystem_options_t;
    1207 
    1208 /**
    12091079 * @brief An open file data structure.
    12101080 *
     
    13951265 (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm ))
    13961266
     1267/*
     1268 *  Prototypes for filesystem
     1269 */
     1270
     1271void rtems_filesystem_initialize( void );
     1272
     1273typedef void (*rtems_libio_init_functions_t)(void);
     1274extern  rtems_libio_init_functions_t rtems_libio_init_helper;
     1275
     1276void    open_dev_console(void);
     1277
     1278typedef void (*rtems_libio_supp_functions_t)(void);
     1279extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
     1280
     1281typedef void (*rtems_fs_init_functions_t)(void);
     1282extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
     1283
     1284/**
     1285 * @brief Creates a directory and all its parent directories according to
     1286 * @a path.
     1287 *
     1288 * The @a mode value selects the access permissions of the directory.
     1289 *
     1290 * @retval 0 Successful operation.
     1291 * @retval -1 An error occured.  The @c errno indicates the error.
     1292 */
     1293extern int rtems_mkdir(const char *path, mode_t mode);
     1294
     1295/** @} */
     1296
     1297/**
     1298 * @defgroup FileSystemTypesAndMount File System Types and Mount
     1299 *
     1300 * @ingroup LibIO
     1301 *
     1302 * @brief File system types and mount.
     1303 *
     1304 * @{
     1305 */
     1306
    13971307/**
    13981308 * @name File System Types
     
    14121322/** @} */
    14131323
    1414 /*
    1415  *  Prototypes for filesystem
    1416  */
    1417 
    1418 void rtems_filesystem_initialize( void );
    1419 
     1324/**
     1325 * @brief Mount table entry.
     1326 */
     1327struct rtems_filesystem_mount_table_entry_tt {
     1328  rtems_chain_node                       Node;
     1329  rtems_filesystem_location_info_t       mt_point_node;
     1330  rtems_filesystem_location_info_t       mt_fs_root;
     1331  int                                    options;
     1332  void                                  *fs_info;
     1333
     1334  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
     1335
     1336  /*
     1337   * The target or mount point of the file system.
     1338   */
     1339  const char                            *target;
     1340
     1341  /*
     1342   * The type of filesystem or the name of the filesystem.
     1343   */
     1344  const char                            *type;
     1345
     1346  /*
     1347   *  When someone adds a mounted filesystem on a real device,
     1348   *  this will need to be used.
     1349   *
     1350   *  The lower layers can manage how this is managed. Leave as a
     1351   *  string.
     1352   */
     1353  char                                  *dev;
     1354};
     1355
     1356/**
     1357 * @brief File system options.
     1358 */
     1359typedef enum {
     1360  RTEMS_FILESYSTEM_READ_ONLY,
     1361  RTEMS_FILESYSTEM_READ_WRITE,
     1362  RTEMS_FILESYSTEM_BAD_OPTIONS
     1363} rtems_filesystem_options_t;
     1364
     1365/**
     1366 * @brief File system table entry.
     1367 */
     1368typedef struct rtems_filesystem_table_t {
     1369  const char                    *type;
     1370  rtems_filesystem_fsmount_me_t  mount_h;
     1371} rtems_filesystem_table_t;
     1372
     1373/**
     1374 * @brief Static table of file systems.
     1375 *
     1376 * Externally defined by confdefs.h or the user.
     1377 */
     1378extern const rtems_filesystem_table_t rtems_filesystem_table [];
     1379
     1380/**
     1381 * @brief Registers a file system @a type.
     1382 *
     1383 * The @a mount_h handler will be used to mount a file system of this @a type.
     1384 *
     1385 * @retval 0 Successful operation.
     1386 * @retval -1 An error occured.  The @c errno indicates the error.
     1387 */
     1388int rtems_filesystem_register(
     1389  const char                    *type,
     1390  rtems_filesystem_fsmount_me_t  mount_h
     1391);
     1392
     1393/**
     1394 * @brief Unregisters a file system @a type.
     1395 *
     1396 * @retval 0 Successful operation.
     1397 * @retval -1 An error occured.  The @c errno indicates the error.
     1398 */
     1399int rtems_filesystem_unregister(
     1400  const char *type
     1401);
     1402
     1403/**
     1404 * @brief Unmounts the file system at @a mount_path.
     1405 *
     1406 * @todo Due to file system implementation shortcomings it is possible to
     1407 * unmount file systems in use.  This likely leads to heap corruption.  Unmount
     1408 * only file systems which are not in use by the application.
     1409 *
     1410 * @retval 0 Successful operation.
     1411 * @retval -1 An error occured.  The @c errno indicates the error.
     1412 */
    14201413int unmount(
    14211414  const char *mount_path
    14221415);
    14231416
     1417/**
     1418 * @brief Mounts a file system at @a target.
     1419 *
     1420 * The @a source may be a path to the corresponding device file, or @c NULL.
     1421 * The @a target path must lead to an existing directory, or @c NULL.  In case
     1422 * @a target is @c NULL, the root file system will be mounted.  The @a data
     1423 * parameter will be forwarded to the file system initialization handler.  The
     1424 * file system type is selected by @a filesystemtype and may be one of
     1425 * - RTEMS_FILESYSTEM_TYPE_DEVFS,
     1426 * - RTEMS_FILESYSTEM_TYPE_DOSFS,
     1427 * - RTEMS_FILESYSTEM_TYPE_FTPFS,
     1428 * - RTEMS_FILESYSTEM_TYPE_IMFS,
     1429 * - RTEMS_FILESYSTEM_TYPE_MINIIMFS,
     1430 * - RTEMS_FILESYSTEM_TYPE_NFS,
     1431 * - RTEMS_FILESYSTEM_TYPE_RFS, or
     1432 * - RTEMS_FILESYSTEM_TYPE_TFTPFS.
     1433 *
     1434 * Only configured or registered file system types are available.  You can add
     1435 * file system types to your application configuration with
     1436 * - CONFIGURE_FILESYSTEM_DEVFS,
     1437 * - CONFIGURE_FILESYSTEM_DOSFS,
     1438 * - CONFIGURE_FILESYSTEM_FTPFS,
     1439 * - CONFIGURE_FILESYSTEM_IMFS,
     1440 * - CONFIGURE_FILESYSTEM_MINIIMFS,
     1441 * - CONFIGURE_FILESYSTEM_NFS,
     1442 * - CONFIGURE_FILESYSTEM_RFS, and
     1443 * - CONFIGURE_FILESYSTEM_TFTPFS.
     1444 *
     1445 * @see rtems_filesystem_register() and mount_and_make_target_path().
     1446 *
     1447 * @retval 0 Successful operation.
     1448 * @retval -1 An error occured.  The @c errno indicates the error.
     1449 */
    14241450int mount(
    14251451  const char                 *source,
     
    14491475);
    14501476
    1451 /*
    1452  *  Boot Time Mount Table Structure
    1453  */
    1454 
     1477/**
     1478 * @brief Per file system type routine.
     1479 *
     1480 * @see rtems_filesystem_iterate().
     1481 *
     1482 * @retval true Stop the iteration.
     1483 * @retval false Continue the iteration.
     1484 */
     1485typedef bool (*rtems_per_filesystem_routine)(
     1486  const rtems_filesystem_table_t *fs_entry,
     1487  void *arg
     1488);
     1489
     1490/**
     1491 * @brief Iterates over all file system types.
     1492 *
     1493 * For each file system type the @a routine will be called with the entry and
     1494 * the @a routine_arg parameter.
     1495 *
     1496 * Do not register or unregister file system types in @a routine.
     1497 *
     1498 * The iteration is protected by the IO library mutex.
     1499 *
     1500 * @retval true Iteration stopped due to @a routine return status.
     1501 * @retval false Iteration through all entries.
     1502 */
     1503bool rtems_filesystem_iterate(
     1504  rtems_per_filesystem_routine routine,
     1505  void *routine_arg
     1506);
     1507
     1508/**
     1509 * @brief Per file system mount routine.
     1510 *
     1511 * @see rtems_filesystem_mount_iterate().
     1512 *
     1513 * @retval true Stop the iteration.
     1514 * @retval false Continue the iteration.
     1515 */
     1516typedef bool (*rtems_per_filesystem_mount_routine)(
     1517  const rtems_filesystem_mount_table_entry_t *mt_entry,
     1518  void *arg
     1519);
     1520
     1521/**
     1522 * @brief Iterates over all file system mounts.
     1523 *
     1524 * For each file system mount the @a routine will be called with the entry and
     1525 * the @a routine_arg parameter.
     1526 *
     1527 * Do not mount or unmount file systems in @a routine.
     1528 *
     1529 * The iteration is protected by the IO library mutex.
     1530 *
     1531 * @retval true Iteration stopped due to @a routine return status.
     1532 * @retval false Iteration through all entries.
     1533 */
     1534bool
     1535rtems_filesystem_mount_iterate(
     1536  rtems_per_filesystem_mount_routine routine,
     1537  void *routine_arg
     1538);
     1539
     1540/**
     1541 * @brief Boot time mount table entry.
     1542 */
    14551543typedef struct {
    14561544  const char                              *type;
     
    14601548} rtems_filesystem_mount_table_t;
    14611549
     1550/**
     1551 * @brief Boot time mount table.
     1552 *
     1553 * @todo Only the first entry will be evaluated.  Why do we need a table?
     1554 */
    14621555extern const rtems_filesystem_mount_table_t *rtems_filesystem_mount_table;
    1463 extern const int                             rtems_filesystem_mount_table_size;
    1464 
    1465 typedef void (*rtems_libio_init_functions_t)(void);
    1466 extern  rtems_libio_init_functions_t rtems_libio_init_helper;
    1467 
    1468 void    open_dev_console(void);
    1469 
    1470 typedef void (*rtems_libio_supp_functions_t)(void);
    1471 extern  rtems_libio_supp_functions_t rtems_libio_supp_helper;
    1472 
    1473 typedef void (*rtems_fs_init_functions_t)(void);
    1474 extern  rtems_fs_init_functions_t    rtems_fs_init_helper;
    1475 
    1476 /**
    1477  * @brief Creates a directory and all its parent directories according to
    1478  * @a path.
    1479  *
    1480  * The @a mode value selects the access permissions of the directory.
    1481  *
    1482  * @retval 0 Successful operation.
    1483  * @retval -1 An error occured.  The @c errno indicates the error.
    1484  */
    1485 extern int rtems_mkdir(const char *path, mode_t mode);
     1556
     1557/**
     1558 * @brief Boot time mount table entry count.
     1559 *
     1560 * @todo Only the first entry will be evaluated.  Why do we need a table?
     1561 */
     1562extern const int rtems_filesystem_mount_table_size;
    14861563
    14871564/** @} */
     
    15571634/** @} */
    15581635
     1636/**
     1637 * @brief The pathconf setting for a file system.
     1638 */
     1639#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options)
     1640
     1641/**
     1642 * @brief The type of file system. Its name.
     1643 */
     1644#define rtems_filesystem_type(_mte) ((_mte)->type)
     1645
     1646/**
     1647 * @brief The mount point of a file system.
     1648 */
     1649#define rtems_filesystem_mount_point(_mte) ((_mte)->target)
     1650
     1651/**
     1652 * @brief The device entry of a file system.
     1653 */
     1654#define rtems_filesystem_mount_device(_mte) ((_mte)->dev)
     1655
    15591656#ifdef __cplusplus
    15601657}
  • cpukit/libcsupport/include/rtems/libio_.h

    r59673224 r6c0fcd4  
    3939extern rtems_id                          rtems_libio_semaphore;
    4040extern const rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers;
    41 
    42 /*
    43  * Mount table list.
    44  */
    45 extern rtems_chain_control rtems_filesystem_mount_table_control;
    4641
    4742/*
  • cpukit/libcsupport/src/mount-mgr.c

    r59673224 r6c0fcd4  
    3838} filesystem_node;
    3939
    40 RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
     40static RTEMS_CHAIN_DEFINE_EMPTY(filesystem_chain);
    4141
    42 void
    43 rtems_filesystem_iterate(
     42bool rtems_filesystem_iterate(
    4443  rtems_per_filesystem_routine routine,
    4544  void *routine_arg
     
    4847  const rtems_filesystem_table_t *table_entry = &rtems_filesystem_table [0];
    4948  rtems_chain_node *node = NULL;
     49  bool stop = false;
    5050
    51   while ( table_entry->type ) {
    52     if ( !(*routine)( table_entry, routine_arg ) ) {
    53       break;
    54     }
    55 
     51  while ( table_entry->type && !stop ) {
     52    stop = (*routine)( table_entry, routine_arg );
    5653    ++table_entry;
    5754  }
    5855
    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;
     56  if ( !stop ) {
     57    rtems_libio_lock();
     58    for (
     59      node = rtems_chain_first( &filesystem_chain );
     60      !rtems_chain_is_tail( &filesystem_chain, node ) && !stop;
     61      node = rtems_chain_next( node )
     62    ) {
     63      const filesystem_node *fsn = (filesystem_node *) node;
    6664
    67     if ( !(*routine)( &fsn->entry, routine_arg ) ) {
    68       break;
     65      stop = (*routine)( &fsn->entry, routine_arg );
    6966    }
     67    rtems_libio_unlock();
    7068  }
    71   rtems_libio_unlock();
     69
     70  return stop;
    7271}
    7372
     
    8281
    8382  if ( strcmp( entry->type, fa->type ) != 0 ) {
    84     return true;
     83    return false;
    8584  } else {
    8685    fa->mount_h = entry->mount_h;
  • cpukit/libcsupport/src/mount.c

    r59673224 r6c0fcd4  
    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 }
  • cpukit/libcsupport/src/statvfs.c

    r59673224 r6c0fcd4  
    2121
    2222#include <sys/statvfs.h>
    23 
    24 /*
    25  *  Data structures and routines private to mount/unmount pair.
    26  */
    27 extern rtems_chain_control rtems_filesystem_mount_table_control;
    2823
    2924int
  • cpukit/libcsupport/src/unmount.c

    r59673224 r6c0fcd4  
    2323#include <sys/types.h>
    2424#include <sys/stat.h>
    25 #include <rtems/chain.h>
    2625#include <fcntl.h>
    2726#include <unistd.h>
     
    3332#include <rtems/libio_.h>
    3433#include <rtems/seterr.h>
     34#include <rtems/chain.h>
    3535
    36 bool rtems_filesystem_nodes_equal(
    37   const rtems_filesystem_location_info_t   *loc1,
    38   const rtems_filesystem_location_info_t   *loc2
    39 ){
    40   return ( loc1->node_access == loc2->node_access );
    41 }
    42 
    43 
    44 /*
    45  *  file_systems_below_this_mountpoint
    46  *
    47  *  This routine will run through the entries that currently exist in the
    48  *  mount table chain. For each entry in the mount table chain it will
    49  *  compare the mount tables mt_fs_root to the new_fs_root_node. If any of the
    50  *  mount table file system root nodes matches the new file system root node
    51  *  this indicates that we are trying to mount a file system that has already
    52  *  been mounted. This is not a permitted operation. temp_loc is set to
    53  *  the root node of the file system being unmounted.
    54  */
    55 
    56 bool file_systems_below_this_mountpoint(
    57   const char                            *path __attribute__((unused)),
    58   rtems_filesystem_location_info_t      *fs_root_loc,
    59   rtems_filesystem_mount_table_entry_t  *fs_to_unmount __attribute__((unused))
     36static bool is_fs_below_mount_point(
     37  const rtems_filesystem_mount_table_entry_t *mt_entry,
     38  void *arg
    6039)
    6140{
    62   rtems_chain_node                     *the_node;
    63   rtems_filesystem_mount_table_entry_t *the_mount_entry;
    64 
    65   /*
    66    * Search the mount table for any mount entries referencing this
    67    * mount entry.
    68    */
    69 
    70   for ( the_node = rtems_filesystem_mount_table_control.first;
    71         !rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node );
    72         the_node = the_node->next ) {
    73      the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node;
    74      if (the_mount_entry->mt_point_node.mt_entry  == fs_root_loc->mt_entry ) {
    75         return true;
    76      }
    77   }
    78 
    79   return false;
     41  return arg == mt_entry->mt_point_node.mt_entry;
    8042}
    8143
     
    11577   */
    11678
    117   if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){
     79  if ( fs_root_loc->node_access != loc.node_access ){
    11880    rtems_filesystem_freenode( &loc );
    11981    rtems_set_errno_and_return_minus_one( EACCES );
     
    152114   */
    153115
    154   if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 )
     116  if ( rtems_filesystem_mount_iterate( is_fs_below_mount_point,
     117                                       fs_root_loc->mt_entry ) )
    155118    rtems_set_errno_and_return_minus_one( EBUSY );
    156119
     
    196159   */
    197160
    198   rtems_chain_extract( ( rtems_chain_node * ) mt_entry );
     161  rtems_libio_lock();
     162  rtems_chain_extract( &mt_entry->Node );
     163  rtems_libio_unlock();
    199164
    200165  /*
  • cpukit/libmisc/shell/main_mount.c

    r59673224 r6c0fcd4  
    3232  printf("%s ", entry->type);
    3333
    34   return true;
     34  return false;
    3535}
    3636
Note: See TracChangeset for help on using the changeset viewer.