Changeset da154e14 in rtems


Ignore:
Timestamp:
May 14, 2012, 2:55:41 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
0a95800a, a7d1992c
Parents:
7666afc
git-author:
Sebastian Huber <sebastian.huber@…> (05/14/12 14:55:41)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/15/12 08:01:43)
Message:

Filesystem: Move operations to mount table entry

The scope of the file system operations is the file system instance.
The scope of the file system node handlers is the file location. The
benefit of moving the operations to the mount table entry is a size
reduction of the file location (rtems_filesystem_location_info_t). The
code size is slightly increased due to additional load instructions.

Restructure rtems_filesystem_mount_table_entry_t to improve cache
efficiency.

Files:
39 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/umon/tfsDriver.c

    r7666afc rda154e14  
    9393  }
    9494
     95  mt_entry->ops = &rtems_tfs_ops;
    9596  mt_entry->mt_fs_root->location.handlers = &rtems_tfs_handlers;
    96   mt_entry->mt_fs_root->location.ops = &rtems_tfs_ops;
    9797  mt_entry->mt_fs_root->location.node_access = root_path;
    9898
  • cpukit/include/rtems/fs.h

    r7666afc rda154e14  
    5454   void                                    *node_access_2;
    5555   const rtems_filesystem_file_handlers_r  *handlers;
    56    const rtems_filesystem_operations_table *ops;
    5756   rtems_filesystem_mount_table_entry_t    *mt_entry;
    5857} rtems_filesystem_location_info_t;
  • cpukit/libcsupport/include/rtems/libio.h

    r7666afc rda154e14  
    14321432struct rtems_filesystem_mount_table_entry_tt {
    14331433  rtems_chain_node                       mt_node;
     1434  void                                  *fs_info;
     1435  const rtems_filesystem_operations_table *ops;
     1436  const void                            *immutable_fs_info;
    14341437  rtems_chain_control                    location_chain;
    14351438  rtems_filesystem_global_location_t    *mt_point_node;
     
    14371440  bool                                   mounted;
    14381441  bool                                   writeable;
    1439   void                                  *fs_info;
    1440   const void                            *immutable_fs_info;
    14411442  rtems_filesystem_limits_and_options_t  pathconf_limits_and_options;
    14421443
  • cpukit/libcsupport/include/rtems/libio_.h

    r7666afc rda154e14  
    251251)
    252252{
    253   (*loc->ops->lock_h)( loc->mt_entry );
     253  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
     254
     255  (*mt_entry->ops->lock_h)( mt_entry );
    254256}
    255257
     
    258260)
    259261{
    260   (*loc->ops->unlock_h)( loc->mt_entry );
     262  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
     263
     264  (*mt_entry->ops->unlock_h)( mt_entry );
    261265}
    262266
     
    583587)
    584588{
    585   return (*loc->ops->are_nodes_equal_h)(
     589  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
     590
     591  return (*mt_entry->ops->are_nodes_equal_h)(
    586592    loc,
    587     &loc->mt_entry->mt_fs_root->location
     593    &mt_entry->mt_fs_root->location
    588594  );
    589595}
  • cpukit/libcsupport/src/__usrenv.c

    r7666afc rda154e14  
    221221    }
    222222  },
     223  .ops = &null_ops,
    223224  .mt_point_node = &rtems_filesystem_global_location_null,
    224225  .mt_fs_root = &rtems_filesystem_global_location_null,
     
    234235    },
    235236    .handlers = &rtems_filesystem_null_handlers,
    236     .ops = &null_ops,
    237237    .mt_entry = &rtems_filesystem_null_mt_entry
    238238  },
  • cpukit/libcsupport/src/_rename_r.c

    r7666afc rda154e14  
    5858  );
    5959  if ( rv == 0 ) {
    60     rv = (*new_currentloc->ops->rename_h)(
     60    rv = (*new_currentloc->mt_entry->ops->rename_h)(
    6161      &old_parentloc,
    6262      old_currentloc,
  • cpukit/libcsupport/src/chmod.c

    r7666afc rda154e14  
    2626    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
    2727
    28   rv = (*currentloc->ops->fchmod_h)( currentloc, mode );
     28  rv = (*currentloc->mt_entry->ops->fchmod_h)( currentloc, mode );
    2929
    3030  rtems_filesystem_eval_path_cleanup( &ctx );
  • cpukit/libcsupport/src/chown.c

    r7666afc rda154e14  
    3333  const rtems_filesystem_location_info_t *currentloc =
    3434    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
     35  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
    3536
    36   rv = (*currentloc->ops->chown_h)(
    37     currentloc,
    38     owner,
    39     group
    40   );
     37  rv = (*ops->chown_h)( currentloc, owner, group );
    4138
    4239  rtems_filesystem_eval_path_cleanup( &ctx );
  • cpukit/libcsupport/src/chroot.c

    r7666afc rda154e14  
    5050      rtems_filesystem_global_location_obtain( &new_current_loc );
    5151    rtems_filesystem_node_types_t type =
    52       (*new_root_loc->location.ops->node_type_h)( &new_root_loc->location );
     52      (*new_root_loc->location.mt_entry->ops->node_type_h)(
     53        &new_root_loc->location
     54      );
    5355
    5456    if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
  • cpukit/libcsupport/src/clonenode.c

    r7666afc rda154e14  
    2727
    2828  clone = rtems_filesystem_location_copy( clone, master );
    29   rv = (*clone->ops->clonenod_h)( clone );
     29  rv = (*clone->mt_entry->ops->clonenod_h)( clone );
    3030  if ( rv != 0 ) {
    3131    rtems_filesystem_location_remove_from_mt_entry( clone );
  • cpukit/libcsupport/src/fchmod.c

    r7666afc rda154e14  
    2929  if (iop->pathinfo.mt_entry->writeable) {
    3030    rtems_filesystem_instance_lock( &iop->pathinfo );
    31     rv = (*iop->pathinfo.ops->fchmod_h)( &iop->pathinfo, mode );
     31    rv = (*iop->pathinfo.mt_entry->ops->fchmod_h)( &iop->pathinfo, mode );
    3232    rtems_filesystem_instance_unlock( &iop->pathinfo );
    3333  } else {
  • cpukit/libcsupport/src/fchown.c

    r7666afc rda154e14  
    2929  if (iop->pathinfo.mt_entry->writeable) {
    3030    rtems_filesystem_instance_lock( &iop->pathinfo );
    31     rv = (*iop->pathinfo.ops->chown_h)( &iop->pathinfo, owner, group );
     31    rv = (*iop->pathinfo.mt_entry->ops->chown_h)(
     32      &iop->pathinfo,
     33      owner,
     34      group
     35    );
    3236    rtems_filesystem_instance_unlock( &iop->pathinfo );
    3337  } else {
  • cpukit/libcsupport/src/freenode.c

    r7666afc rda154e14  
    2222{
    2323  rtems_filesystem_instance_lock( loc );
    24   (*loc->ops->freenod_h)( loc );
     24  (*loc->mt_entry->ops->freenod_h)( loc );
    2525  rtems_filesystem_instance_unlock( loc );
    2626  rtems_filesystem_location_remove_from_mt_entry( loc );
  • cpukit/libcsupport/src/link.c

    r7666afc rda154e14  
    3737  );
    3838  if ( rv == 0 ) {
    39     rv = (*currentloc_2->ops->link_h)(
     39    rv = (*currentloc_2->mt_entry->ops->link_h)(
    4040      currentloc_2,
    4141      currentloc_1,
  • cpukit/libcsupport/src/mknod.c

    r7666afc rda154e14  
    4848 
    4949  if ( rv == 0 ) {
    50     rv = (*parentloc->ops->mknod_h)( parentloc, name, namelen, mode, dev );
     50    const rtems_filesystem_operations_table *ops = parentloc->mt_entry->ops;
     51
     52    rv = (*ops->mknod_h)( parentloc, name, namelen, mode, dev );
    5153  }
    5254
  • cpukit/libcsupport/src/mount.c

    r7666afc rda154e14  
    123123    mt_point_node = rtems_filesystem_location_transform_to_global( &targetloc );
    124124    mt_entry->mt_point_node = mt_point_node;
    125     rv = (*mt_point_node->location.ops->mount_h)( mt_entry );
     125    rv = (*mt_point_node->location.mt_entry->ops->mount_h)( mt_entry );
    126126    if ( rv == 0 ) {
    127127      rtems_filesystem_mt_lock();
     
    219219
    220220          if ( rv != 0 ) {
    221             (*mt_entry->mt_fs_root->location.ops->fsunmount_me_h)( mt_entry );
     221            (*mt_entry->ops->fsunmount_me_h)( mt_entry );
    222222          }
    223223        }
  • cpukit/libcsupport/src/open.c

    r7666afc rda154e14  
    8686      rtems_filesystem_eval_path_get_currentloc( &ctx );
    8787    rtems_filesystem_node_types_t type =
    88       (*currentloc->ops->node_type_h)( currentloc );
     88      (*currentloc->mt_entry->ops->node_type_h)( currentloc );
    8989
    9090    if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
  • cpukit/libcsupport/src/readlink.c

    r7666afc rda154e14  
    2525  const rtems_filesystem_location_info_t *currentloc =
    2626    rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
    27   rtems_filesystem_node_types_t type =
    28     (*currentloc->ops->node_type_h)( currentloc );
     27  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
     28  rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
    2929
    3030  if ( type == RTEMS_FILESYSTEM_SYM_LINK ) {
    31     rv = (*currentloc->ops->readlink_h)( currentloc, buf, bufsize );
     31    rv = (*ops->readlink_h)( currentloc, buf, bufsize );
    3232  } else {
    3333    rtems_filesystem_eval_path_error( &ctx, EINVAL );
  • cpukit/libcsupport/src/rmdir.c

    r7666afc rda154e14  
    3535      parent_eval_flags
    3636    );
    37   rtems_filesystem_node_types_t type =
    38     (*currentloc->ops->node_type_h)( currentloc );
     37  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
     38  rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
    3939
    4040  if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
    41     rv = (*currentloc->ops->rmnod_h)(
    42       &parentloc,
    43       currentloc
    44     );
     41    rv = (*ops->rmnod_h)( &parentloc, currentloc );
    4542  } else {
    4643    rtems_filesystem_eval_path_error( &ctx, ENOTDIR );
  • cpukit/libcsupport/src/statvfs.c

    r7666afc rda154e14  
    3030  memset( buf, 0, sizeof( *buf ) );
    3131
    32   rv = (*currentloc->ops->statvfs_h)( currentloc, buf );
     32  rv = (*currentloc->mt_entry->ops->statvfs_h)( currentloc, buf );
    3333
    3434  rtems_filesystem_eval_path_cleanup( &ctx );
  • cpukit/libcsupport/src/sup_fs_eval_path.c

    r7666afc rda154e14  
    105105
    106106  while (ctx->pathlen > 0) {
    107     (*ctx->currentloc.ops->eval_path_h)(ctx);
     107    (*ctx->currentloc.mt_entry->ops->eval_path_h)(ctx);
    108108  }
    109109
     
    261261      ++ctx->recursionlevel;
    262262      while (ctx->pathlen > 0) {
    263         (*ctx->currentloc.ops->eval_path_h)(ctx);
     263        (*ctx->currentloc.mt_entry->ops->eval_path_h)(ctx);
    264264      }
    265265      --ctx->recursionlevel;
     
    298298  rtems_filesystem_mt_entry_declare_lock_context(lock_context);
    299299
    300   (*loc->ops->freenod_h)(loc);
     300  (*loc->mt_entry->ops->freenod_h)(loc);
    301301
    302302  rtems_filesystem_mt_entry_lock(lock_context);
  • cpukit/libcsupport/src/sup_fs_eval_path_generic.c

    r7666afc rda154e14  
    2121static bool is_fs_root( const rtems_filesystem_location_info_t *loc )
    2222{
     23  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
    2324  const rtems_filesystem_location_info_t *mt_fs_root =
    24     &loc->mt_entry->mt_fs_root->location;
     25    &mt_entry->mt_fs_root->location;
    2526
    26   return (*loc->ops->are_nodes_equal_h)( loc, mt_fs_root );
     27  return (*mt_entry->ops->are_nodes_equal_h)( loc, mt_fs_root );
    2728}
    2829
     
    3233)
    3334{
     35  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
    3436  const rtems_filesystem_location_info_t *rootloc = &ctx->rootloc->location;
    3537
    36   return loc->mt_entry == rootloc->mt_entry
    37     && (*loc->ops->are_nodes_equal_h)( loc, rootloc );
     38  return mt_entry == rootloc->mt_entry
     39    && (*mt_entry->ops->are_nodes_equal_h)( loc, rootloc );
    3840}
    3941
  • cpukit/libcsupport/src/sup_fs_location.c

    r7666afc rda154e14  
    3434  dst->node_access_2 = src->node_access_2;
    3535  dst->handlers = src->handlers;
    36   dst->ops = src->ops;
    3736  dst->mt_entry = src->mt_entry;
    3837  rtems_filesystem_location_add_to_mt_entry(dst);
     
    214213  rtems_filesystem_mt_unlock();
    215214  rtems_filesystem_global_location_release(mt_entry->mt_point_node);
    216   (*mt_entry->mt_fs_root->location.ops->fsunmount_me_h)(mt_entry);
     215  (*mt_entry->ops->fsunmount_me_h)(mt_entry);
    217216  free(mt_entry);
    218217}
  • cpukit/libcsupport/src/sup_fs_node_type.c

    r7666afc rda154e14  
    2626
    2727  rtems_filesystem_instance_lock(loc);
    28   type = (*loc->ops->node_type_h)(loc);
     28  type = (*loc->mt_entry->ops->node_type_h)(loc);
    2929  rtems_filesystem_instance_unlock(loc);
    3030
  • cpukit/libcsupport/src/symlink.c

    r7666afc rda154e14  
    2828    rtems_filesystem_eval_path_start( &ctx, path2, eval_flags );
    2929
    30   rv = (*currentloc->ops->symlink_h)(
     30  rv = (*currentloc->mt_entry->ops->symlink_h)(
    3131    currentloc,
    3232    rtems_filesystem_eval_path_get_token( &ctx ),
  • cpukit/libcsupport/src/unlink.c

    r7666afc rda154e14  
    3535      parent_eval_flags
    3636    );
     37  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
    3738
    38   rv = (*currentloc->ops->rmnod_h)(
    39     &parentloc,
    40     currentloc
    41   );
     39  rv = (*ops->rmnod_h)( &parentloc, currentloc );
    4240
    4341  rtems_filesystem_eval_path_cleanup_with_parent( &ctx, &parentloc );
  • cpukit/libcsupport/src/unmount.c

    r7666afc rda154e14  
    3333
    3434  if ( rtems_filesystem_location_is_root( currentloc ) ) {
    35     rv = (*mt_entry->mt_point_node->location.ops->unmount_h)( mt_entry );
     35    const rtems_filesystem_operations_table *mt_point_ops =
     36      mt_entry->mt_point_node->location.mt_entry->ops;
     37
     38    rv = (*mt_point_ops->unmount_h)( mt_entry );
    3639    if ( rv == 0 ) {
    3740      rtems_filesystem_mt_entry_declare_lock_context( lock_context );
  • cpukit/libcsupport/src/utime.c

    r7666afc rda154e14  
    3939  }
    4040
    41   rv = (*currentloc->ops->utime_h)(
     41  rv = (*currentloc->mt_entry->ops->utime_h)(
    4242    currentloc,
    4343    times->actime,
  • cpukit/libfs/src/devfs/devfs_init.c

    r7666afc rda154e14  
    5757
    5858  if (data != NULL) {
     59    mt_entry->ops = &devFS_ops;
    5960    mt_entry->immutable_fs_info = data;
    6061    mt_entry->mt_fs_root->location.handlers = &devFS_file_handlers;
    61     mt_entry->mt_fs_root->location.ops = &devFS_ops;
    6262  } else {
    6363    errno = EINVAL;
  • cpukit/libfs/src/devfs/devfs_show.c

    r7666afc rda154e14  
    1515  rtems_filesystem_location_info_t *rootloc = &rtems_filesystem_root->location;
    1616
    17   if (rootloc->ops == &devFS_ops) {
     17  if (rootloc->mt_entry->ops == &devFS_ops) {
    1818    const devFS_data *data = devFS_get_data(rootloc);
    1919    size_t i = 0;
  • cpukit/libfs/src/dosfs/msdos_initsupp.c

    r7666afc rda154e14  
    142142    temp_mt_entry->mt_fs_root->location.node_access = fat_fd;
    143143    temp_mt_entry->mt_fs_root->location.handlers = directory_handlers;
    144     temp_mt_entry->mt_fs_root->location.ops = op_table;
     144    temp_mt_entry->ops = op_table;
    145145
    146146    return rc;
  • cpukit/libfs/src/imfs/imfs_initsupp.c

    r7666afc rda154e14  
    8080    if ( root_node != NULL ) {
    8181      mt_entry->fs_info = fs_info;
     82      mt_entry->ops = op_table;
    8283      mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS;
    8384      mt_entry->mt_fs_root->location.node_access = root_node;
    84       mt_entry->mt_fs_root->location.ops = op_table;
    8585      IMFS_Set_handlers( &mt_entry->mt_fs_root->location );
    8686    } else {
  • cpukit/libfs/src/imfs/imfs_load_tar.c

    r7666afc rda154e14  
    102102     RTEMS_FS_MAKE | RTEMS_FS_EXCLUSIVE
    103103   );
    104    if (rootloc.ops != &IMFS_ops && rootloc.ops != &fifoIMFS_ops) {
     104
     105   if (
     106     rootloc.mt_entry->ops != &IMFS_ops
     107       && rootloc.mt_entry->ops != &fifoIMFS_ops
     108   ) {
    105109     rv = -1;
    106110   }
  • cpukit/libfs/src/nfsclient/src/nfs.c

    r7666afc rda154e14  
    17541754        rootNode = 0;
    17551755
    1756         mt_entry->mt_fs_root->location.ops              = &nfs_fs_ops;
     1756        mt_entry->ops = &nfs_fs_ops;
    17571757        mt_entry->mt_fs_root->location.handlers  = &nfs_dir_file_handlers;
    17581758        mt_entry->pathconf_limits_and_options = nfs_limits_and_options;
  • cpukit/libfs/src/rfs/rtems-rfs-rtems.c

    r7666afc rda154e14  
    919919  }
    920920
    921   mt_entry->fs_info = fs;
    922 
     921  mt_entry->fs_info                          = fs;
     922  mt_entry->ops                              = &rtems_rfs_ops;
    923923  mt_entry->mt_fs_root->location.node_access = (void*) RTEMS_RFS_ROOT_INO;
    924924  mt_entry->mt_fs_root->location.handlers    = &rtems_rfs_rtems_dir_handlers;
    925   mt_entry->mt_fs_root->location.ops         = &rtems_rfs_ops;
    926925
    927926  rtems_rfs_rtems_unlock (fs);
  • cpukit/libnetworking/lib/ftpfs.c

    r7666afc rda154e14  
    11951195  /* Set handler and oparations table */
    11961196  e->mt_fs_root->location.handlers = &rtems_ftpfs_root_handlers;
    1197   e->mt_fs_root->location.ops = &rtems_ftpfs_ops;
     1197  e->ops = &rtems_ftpfs_ops;
    11981198
    11991199  /* We maintain no real file system nodes, so there is no real root */
  • cpukit/libnetworking/lib/tftpDriver.c

    r7666afc rda154e14  
    206206  mt_entry->mt_fs_root->location.node_access = root_path;
    207207  mt_entry->mt_fs_root->location.handlers = &rtems_tftp_handlers;
    208   mt_entry->mt_fs_root->location.ops = &rtems_tftp_ops;
     208  mt_entry->ops = &rtems_tftp_ops;
    209209 
    210210  /*
  • cpukit/libnetworking/rtems/rtems_syscall.c

    r7666afc rda154e14  
    8989  iop->data1 = so;
    9090  iop->pathinfo.handlers = &socket_handlers;
    91   iop->pathinfo.ops = &rtems_filesystem_operations_default;
    9291  iop->pathinfo.mt_entry = &rtems_filesystem_null_mt_entry;
    9392  rtems_filesystem_location_add_to_mt_entry(&iop->pathinfo);
  • testsuites/fstests/fsnofs01/init.c

    r7666afc rda154e14  
    5454  rtems_test_assert(null_loc->location.node_access_2 == local_loc->node_access_2);
    5555  rtems_test_assert(null_loc->location.handlers == local_loc->handlers);
    56   rtems_test_assert(null_loc->location.ops == local_loc->ops);
    5756  rtems_test_assert(null_loc->location.mt_entry == local_loc->mt_entry);
    5857}
Note: See TracChangeset for help on using the changeset viewer.