[PATCH] Filesystem: Move operations to mount table entry

sebastian.huber at embedded-brains.de sebastian.huber at embedded-brains.de
Mon May 14 15:23:47 UTC 2012


From: Sebastian Huber <sebastian.huber at embedded-brains.de>

The file system operations are fixed per file system instance.  The file
system node handlers are fixed per file descriptor.  The benefit of
moving the operations to the mount table entry is a size reduction of
the file descriptor (rtems_libio_t).  The code size and memory loads are
slightly increased.
---
 c/src/lib/libbsp/shared/umon/tfsDriver.c          |    2 +-
 cpukit/include/rtems/fs.h                         |    1 -
 cpukit/libcsupport/include/rtems/libio.h          |    1 +
 cpukit/libcsupport/include/rtems/libio_.h         |   14 ++++++++++----
 cpukit/libcsupport/src/__usrenv.c                 |    2 +-
 cpukit/libcsupport/src/_rename_r.c                |    2 +-
 cpukit/libcsupport/src/chmod.c                    |    2 +-
 cpukit/libcsupport/src/chown.c                    |    2 +-
 cpukit/libcsupport/src/chroot.c                   |    4 +++-
 cpukit/libcsupport/src/clonenode.c                |    2 +-
 cpukit/libcsupport/src/fchmod.c                   |    2 +-
 cpukit/libcsupport/src/fchown.c                   |    6 +++++-
 cpukit/libcsupport/src/freenode.c                 |    2 +-
 cpukit/libcsupport/src/link.c                     |    2 +-
 cpukit/libcsupport/src/mknod.c                    |    8 +++++++-
 cpukit/libcsupport/src/mount.c                    |    4 ++--
 cpukit/libcsupport/src/open.c                     |    2 +-
 cpukit/libcsupport/src/readlink.c                 |    6 +++---
 cpukit/libcsupport/src/rmdir.c                    |    9 +++------
 cpukit/libcsupport/src/statvfs.c                  |    2 +-
 cpukit/libcsupport/src/sup_fs_eval_path.c         |    6 +++---
 cpukit/libcsupport/src/sup_fs_eval_path_generic.c |   10 ++++++----
 cpukit/libcsupport/src/sup_fs_location.c          |    3 +--
 cpukit/libcsupport/src/sup_fs_node_type.c         |    2 +-
 cpukit/libcsupport/src/symlink.c                  |    2 +-
 cpukit/libcsupport/src/unlink.c                   |    2 +-
 cpukit/libcsupport/src/unmount.c                  |    4 +++-
 cpukit/libcsupport/src/utime.c                    |    2 +-
 cpukit/libfs/src/devfs/devfs_init.c               |    2 +-
 cpukit/libfs/src/devfs/devfs_show.c               |    2 +-
 cpukit/libfs/src/dosfs/msdos_initsupp.c           |    2 +-
 cpukit/libfs/src/imfs/imfs_initsupp.c             |    2 +-
 cpukit/libfs/src/imfs/imfs_load_tar.c             |    6 +++++-
 cpukit/libfs/src/nfsclient/src/nfs.c              |    2 +-
 cpukit/libfs/src/rfs/rtems-rfs-rtems.c            |    2 +-
 cpukit/libnetworking/lib/ftpfs.c                  |    2 +-
 cpukit/libnetworking/lib/tftpDriver.c             |    2 +-
 cpukit/libnetworking/rtems/rtems_syscall.c        |    1 -
 testsuites/fstests/fsnofs01/init.c                |    1 -
 39 files changed, 75 insertions(+), 55 deletions(-)

diff --git a/c/src/lib/libbsp/shared/umon/tfsDriver.c b/c/src/lib/libbsp/shared/umon/tfsDriver.c
index 426d9ba..02a3105 100644
--- a/c/src/lib/libbsp/shared/umon/tfsDriver.c
+++ b/c/src/lib/libbsp/shared/umon/tfsDriver.c
@@ -93,7 +93,7 @@ static int rtems_tfs_mount_me(
   }
 
   mt_entry->mt_fs_root->location.handlers = &rtems_tfs_handlers;
-  mt_entry->mt_fs_root->location.ops = &rtems_tfs_ops;
+  mt_entry->ops = &rtems_tfs_ops;
   mt_entry->mt_fs_root->location.node_access = root_path;
 
   return 0;
diff --git a/cpukit/include/rtems/fs.h b/cpukit/include/rtems/fs.h
index 7e4dff9..6270877 100644
--- a/cpukit/include/rtems/fs.h
+++ b/cpukit/include/rtems/fs.h
@@ -53,7 +53,6 @@ typedef struct rtems_filesystem_location_info_tt {
    void                                    *node_access;
    void                                    *node_access_2;
    const rtems_filesystem_file_handlers_r  *handlers;
-   const rtems_filesystem_operations_table *ops;
    rtems_filesystem_mount_table_entry_t    *mt_entry;
 } rtems_filesystem_location_info_t;
 
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h
index 44dd847..7b7cc63 100644
--- a/cpukit/libcsupport/include/rtems/libio.h
+++ b/cpukit/libcsupport/include/rtems/libio.h
@@ -1432,6 +1432,7 @@ extern int rtems_mkdir(const char *path, mode_t mode);
 struct rtems_filesystem_mount_table_entry_tt {
   rtems_chain_node                       mt_node;
   rtems_chain_control                    location_chain;
+  const rtems_filesystem_operations_table *ops;
   rtems_filesystem_global_location_t    *mt_point_node;
   rtems_filesystem_global_location_t    *mt_fs_root;
   bool                                   mounted;
diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
index 3e2139f..418f4a3 100644
--- a/cpukit/libcsupport/include/rtems/libio_.h
+++ b/cpukit/libcsupport/include/rtems/libio_.h
@@ -250,14 +250,18 @@ static inline void rtems_filesystem_instance_lock(
   const rtems_filesystem_location_info_t *loc
 )
 {
-  (*loc->ops->lock_h)( loc->mt_entry );
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
+
+  (*mt_entry->ops->lock_h)( mt_entry );
 }
 
 static inline void rtems_filesystem_instance_unlock(
   const rtems_filesystem_location_info_t *loc
 )
 {
-  (*loc->ops->unlock_h)( loc->mt_entry );
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
+
+  (*mt_entry->ops->unlock_h)( mt_entry );
 }
 
 /*
@@ -582,9 +586,11 @@ static inline bool rtems_filesystem_location_is_root(
   const rtems_filesystem_location_info_t *loc
 )
 {
-  return (*loc->ops->are_nodes_equal_h)(
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
+
+  return (*mt_entry->ops->are_nodes_equal_h)(
     loc,
-    &loc->mt_entry->mt_fs_root->location
+    &mt_entry->mt_fs_root->location
   );
 }
 
diff --git a/cpukit/libcsupport/src/__usrenv.c b/cpukit/libcsupport/src/__usrenv.c
index 73d2b06..6a79375 100644
--- a/cpukit/libcsupport/src/__usrenv.c
+++ b/cpukit/libcsupport/src/__usrenv.c
@@ -220,6 +220,7 @@ rtems_filesystem_mount_table_entry_t rtems_filesystem_null_mt_entry = {
       .fill = &rtems_filesystem_global_location_null.location.mt_entry_node,
     }
   },
+  .ops = &null_ops,
   .mt_point_node = &rtems_filesystem_global_location_null,
   .mt_fs_root = &rtems_filesystem_global_location_null,
   .mounted = false,
@@ -233,7 +234,6 @@ rtems_filesystem_global_location_t rtems_filesystem_global_location_null = {
       .previous = &rtems_filesystem_null_mt_entry.location_chain.Head.Node
     },
     .handlers = &rtems_filesystem_null_handlers,
-    .ops = &null_ops,
     .mt_entry = &rtems_filesystem_null_mt_entry
   },
 
diff --git a/cpukit/libcsupport/src/_rename_r.c b/cpukit/libcsupport/src/_rename_r.c
index 45ba0ad..007f249 100644
--- a/cpukit/libcsupport/src/_rename_r.c
+++ b/cpukit/libcsupport/src/_rename_r.c
@@ -57,7 +57,7 @@ int _rename_r(
     new_currentloc
   );
   if ( rv == 0 ) {
-    rv = (*new_currentloc->ops->rename_h)(
+    rv = (*new_currentloc->mt_entry->ops->rename_h)(
       &old_parentloc,
       old_currentloc,
       new_currentloc,
diff --git a/cpukit/libcsupport/src/chmod.c b/cpukit/libcsupport/src/chmod.c
index 73333fe..47de601 100644
--- a/cpukit/libcsupport/src/chmod.c
+++ b/cpukit/libcsupport/src/chmod.c
@@ -25,7 +25,7 @@ int chmod( const char *path, mode_t mode )
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
-  rv = (*currentloc->ops->fchmod_h)( currentloc, mode );
+  rv = (*currentloc->mt_entry->ops->fchmod_h)( currentloc, mode );
 
   rtems_filesystem_eval_path_cleanup( &ctx );
 
diff --git a/cpukit/libcsupport/src/chown.c b/cpukit/libcsupport/src/chown.c
index fa677cb..06c7ba7 100644
--- a/cpukit/libcsupport/src/chown.c
+++ b/cpukit/libcsupport/src/chown.c
@@ -33,7 +33,7 @@ int rtems_filesystem_chown(
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
-  rv = (*currentloc->ops->chown_h)(
+  rv = (*currentloc->mt_entry->ops->chown_h)(
     currentloc,
     owner,
     group
diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c
index 11ae8fc..9e63704 100644
--- a/cpukit/libcsupport/src/chroot.c
+++ b/cpukit/libcsupport/src/chroot.c
@@ -49,7 +49,9 @@ int chroot( const char *path )
     rtems_filesystem_global_location_t *new_root_loc =
       rtems_filesystem_global_location_obtain( &new_current_loc );
     rtems_filesystem_node_types_t type =
-      (*new_root_loc->location.ops->node_type_h)( &new_root_loc->location );
+      (*new_root_loc->location.mt_entry->ops->node_type_h)(
+        &new_root_loc->location
+      );
 
     if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
       sc = rtems_libio_set_private_env();
diff --git a/cpukit/libcsupport/src/clonenode.c b/cpukit/libcsupport/src/clonenode.c
index 380ad90..0ac7c9e 100644
--- a/cpukit/libcsupport/src/clonenode.c
+++ b/cpukit/libcsupport/src/clonenode.c
@@ -26,7 +26,7 @@ void rtems_filesystem_location_clone(
   int rv = 0;
 
   clone = rtems_filesystem_location_copy( clone, master );
-  rv = (*clone->ops->clonenod_h)( clone );
+  rv = (*clone->mt_entry->ops->clonenod_h)( clone );
   if ( rv != 0 ) {
     rtems_filesystem_location_remove_from_mt_entry( clone );
     rtems_filesystem_location_initialize_to_null( clone );
diff --git a/cpukit/libcsupport/src/fchmod.c b/cpukit/libcsupport/src/fchmod.c
index e2f166a..9448738 100644
--- a/cpukit/libcsupport/src/fchmod.c
+++ b/cpukit/libcsupport/src/fchmod.c
@@ -28,7 +28,7 @@ int fchmod( int fd, mode_t mode )
 
   if (iop->pathinfo.mt_entry->writeable) {
     rtems_filesystem_instance_lock( &iop->pathinfo );
-    rv = (*iop->pathinfo.ops->fchmod_h)( &iop->pathinfo, mode );
+    rv = (*iop->pathinfo.mt_entry->ops->fchmod_h)( &iop->pathinfo, mode );
     rtems_filesystem_instance_unlock( &iop->pathinfo );
   } else {
     errno = EROFS;
diff --git a/cpukit/libcsupport/src/fchown.c b/cpukit/libcsupport/src/fchown.c
index bacdbac..6dfbc52 100644
--- a/cpukit/libcsupport/src/fchown.c
+++ b/cpukit/libcsupport/src/fchown.c
@@ -28,7 +28,11 @@ int fchown( int fd, uid_t owner, gid_t group )
 
   if (iop->pathinfo.mt_entry->writeable) {
     rtems_filesystem_instance_lock( &iop->pathinfo );
-    rv = (*iop->pathinfo.ops->chown_h)( &iop->pathinfo, owner, group );
+    rv = (*iop->pathinfo.mt_entry->ops->chown_h)(
+      &iop->pathinfo,
+      owner,
+      group
+    );
     rtems_filesystem_instance_unlock( &iop->pathinfo );
   } else {
     errno = EROFS;
diff --git a/cpukit/libcsupport/src/freenode.c b/cpukit/libcsupport/src/freenode.c
index 28913a4..84e5825 100644
--- a/cpukit/libcsupport/src/freenode.c
+++ b/cpukit/libcsupport/src/freenode.c
@@ -21,7 +21,7 @@
 void rtems_filesystem_location_free( rtems_filesystem_location_info_t *loc )
 {
   rtems_filesystem_instance_lock( loc );
-  (*loc->ops->freenod_h)( loc );
+  (*loc->mt_entry->ops->freenod_h)( loc );
   rtems_filesystem_instance_unlock( loc );
   rtems_filesystem_location_remove_from_mt_entry( loc );
 }
diff --git a/cpukit/libcsupport/src/link.c b/cpukit/libcsupport/src/link.c
index 19ca2d6..c16e7a0 100644
--- a/cpukit/libcsupport/src/link.c
+++ b/cpukit/libcsupport/src/link.c
@@ -36,7 +36,7 @@ int link( const char *path1, const char *path2 )
     currentloc_2
   );
   if ( rv == 0 ) {
-    rv = (*currentloc_2->ops->link_h)(
+    rv = (*currentloc_2->mt_entry->ops->link_h)(
       currentloc_2,
       currentloc_1,
       rtems_filesystem_eval_path_get_token( &ctx_2 ),
diff --git a/cpukit/libcsupport/src/mknod.c b/cpukit/libcsupport/src/mknod.c
index c9dc1d7..bc928e5 100644
--- a/cpukit/libcsupport/src/mknod.c
+++ b/cpukit/libcsupport/src/mknod.c
@@ -47,7 +47,13 @@ int rtems_filesystem_mknod(
   }
   
   if ( rv == 0 ) {
-    rv = (*parentloc->ops->mknod_h)( parentloc, name, namelen, mode, dev );
+    rv = (*parentloc->mt_entry->ops->mknod_h)(
+      parentloc,
+      name,
+      namelen,
+      mode,
+      dev
+    );
   }
 
   return rv;
diff --git a/cpukit/libcsupport/src/mount.c b/cpukit/libcsupport/src/mount.c
index 52886d1..4563bdb 100644
--- a/cpukit/libcsupport/src/mount.c
+++ b/cpukit/libcsupport/src/mount.c
@@ -122,7 +122,7 @@ static int register_subordinate_file_system(
     rtems_filesystem_eval_path_extract_currentloc( &ctx, &targetloc );
     mt_point_node = rtems_filesystem_location_transform_to_global( &targetloc );
     mt_entry->mt_point_node = mt_point_node;
-    rv = (*mt_point_node->location.ops->mount_h)( mt_entry );
+    rv = (*mt_point_node->location.mt_entry->ops->mount_h)( mt_entry );
     if ( rv == 0 ) {
       rtems_filesystem_mt_lock();
       rtems_chain_append_unprotected(
@@ -218,7 +218,7 @@ int mount(
           }
 
           if ( rv != 0 ) {
-            (*mt_entry->mt_fs_root->location.ops->fsunmount_me_h)( mt_entry );
+            (*mt_entry->ops->fsunmount_me_h)( mt_entry );
           }
         }
 
diff --git a/cpukit/libcsupport/src/open.c b/cpukit/libcsupport/src/open.c
index 6bfbd53..02436b6 100644
--- a/cpukit/libcsupport/src/open.c
+++ b/cpukit/libcsupport/src/open.c
@@ -85,7 +85,7 @@ static int do_open(
     const rtems_filesystem_location_info_t *currentloc =
       rtems_filesystem_eval_path_get_currentloc( &ctx );
     rtems_filesystem_node_types_t type =
-      (*currentloc->ops->node_type_h)( currentloc );
+      (*currentloc->mt_entry->ops->node_type_h)( currentloc );
 
     if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
       rtems_filesystem_eval_path_error( &ctx, EISDIR );
diff --git a/cpukit/libcsupport/src/readlink.c b/cpukit/libcsupport/src/readlink.c
index 3e7a831..2cafcca 100644
--- a/cpukit/libcsupport/src/readlink.c
+++ b/cpukit/libcsupport/src/readlink.c
@@ -24,11 +24,11 @@ ssize_t readlink( const char *path, char *buf, size_t bufsize )
   int eval_flags = RTEMS_FS_FOLLOW_HARD_LINK;
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
-  rtems_filesystem_node_types_t type =
-    (*currentloc->ops->node_type_h)( currentloc );
+  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
+  rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
 
   if ( type == RTEMS_FILESYSTEM_SYM_LINK ) {
-    rv = (*currentloc->ops->readlink_h)( currentloc, buf, bufsize );
+    rv = (*ops->readlink_h)( currentloc, buf, bufsize );
   } else {
     rtems_filesystem_eval_path_error( &ctx, EINVAL );
     rv = -1;
diff --git a/cpukit/libcsupport/src/rmdir.c b/cpukit/libcsupport/src/rmdir.c
index 9b54987..4e7baf5 100644
--- a/cpukit/libcsupport/src/rmdir.c
+++ b/cpukit/libcsupport/src/rmdir.c
@@ -34,14 +34,11 @@ int rmdir( const char *path )
       &parentloc,
       parent_eval_flags
     );
-  rtems_filesystem_node_types_t type =
-    (*currentloc->ops->node_type_h)( currentloc );
+  const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops;
+  rtems_filesystem_node_types_t type = (*ops->node_type_h)( currentloc );
 
   if ( type == RTEMS_FILESYSTEM_DIRECTORY ) {
-    rv = (*currentloc->ops->rmnod_h)(
-      &parentloc,
-      currentloc
-    );
+    rv = (*ops->rmnod_h)( &parentloc, currentloc );
   } else {
     rtems_filesystem_eval_path_error( &ctx, ENOTDIR );
     rv = -1;
diff --git a/cpukit/libcsupport/src/statvfs.c b/cpukit/libcsupport/src/statvfs.c
index b944b63..163d51e 100644
--- a/cpukit/libcsupport/src/statvfs.c
+++ b/cpukit/libcsupport/src/statvfs.c
@@ -29,7 +29,7 @@ int statvfs( const char *path, struct statvfs *buf )
 
   memset( buf, 0, sizeof( *buf ) );
 
-  rv = (*currentloc->ops->statvfs_h)( currentloc, buf );
+  rv = (*currentloc->mt_entry->ops->statvfs_h)( currentloc, buf );
 
   rtems_filesystem_eval_path_cleanup( &ctx );
 
diff --git a/cpukit/libcsupport/src/sup_fs_eval_path.c b/cpukit/libcsupport/src/sup_fs_eval_path.c
index 5f7b606..f323dbc 100644
--- a/cpukit/libcsupport/src/sup_fs_eval_path.c
+++ b/cpukit/libcsupport/src/sup_fs_eval_path.c
@@ -104,7 +104,7 @@ void rtems_filesystem_eval_path_continue(
   int eval_flags;
 
   while (ctx->pathlen > 0) {
-    (*ctx->currentloc.ops->eval_path_h)(ctx);
+    (*ctx->currentloc.mt_entry->ops->eval_path_h)(ctx);
   }
 
   eval_flags = rtems_filesystem_eval_path_get_flags(ctx);
@@ -260,7 +260,7 @@ void rtems_filesystem_eval_path_recursive(
 
       ++ctx->recursionlevel;
       while (ctx->pathlen > 0) {
-        (*ctx->currentloc.ops->eval_path_h)(ctx);
+        (*ctx->currentloc.mt_entry->ops->eval_path_h)(ctx);
       }
       --ctx->recursionlevel;
 
@@ -297,7 +297,7 @@ static void free_location(rtems_filesystem_location_info_t *loc)
 {
   rtems_filesystem_mt_entry_declare_lock_context(lock_context);
 
-  (*loc->ops->freenod_h)(loc);
+  (*loc->mt_entry->ops->freenod_h)(loc);
 
   rtems_filesystem_mt_entry_lock(lock_context);
   rtems_chain_extract_unprotected(&loc->mt_entry_node);
diff --git a/cpukit/libcsupport/src/sup_fs_eval_path_generic.c b/cpukit/libcsupport/src/sup_fs_eval_path_generic.c
index d8629c6..27dd801 100644
--- a/cpukit/libcsupport/src/sup_fs_eval_path_generic.c
+++ b/cpukit/libcsupport/src/sup_fs_eval_path_generic.c
@@ -20,10 +20,11 @@
 
 static bool is_fs_root( const rtems_filesystem_location_info_t *loc )
 {
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
   const rtems_filesystem_location_info_t *mt_fs_root =
-    &loc->mt_entry->mt_fs_root->location;
+    &mt_entry->mt_fs_root->location;
 
-  return (*loc->ops->are_nodes_equal_h)( loc, mt_fs_root );
+  return (*mt_entry->ops->are_nodes_equal_h)( loc, mt_fs_root );
 }
 
 static bool is_eval_path_root(
@@ -31,10 +32,11 @@ static bool is_eval_path_root(
   const rtems_filesystem_location_info_t *loc
 )
 {
+  const rtems_filesystem_mount_table_entry_t *mt_entry = loc->mt_entry;
   const rtems_filesystem_location_info_t *rootloc = &ctx->rootloc->location;
 
-  return loc->mt_entry == rootloc->mt_entry
-    && (*loc->ops->are_nodes_equal_h)( loc, rootloc );
+  return mt_entry == rootloc->mt_entry
+    && (*mt_entry->ops->are_nodes_equal_h)( loc, rootloc );
 }
 
 void rtems_filesystem_eval_path_generic(
diff --git a/cpukit/libcsupport/src/sup_fs_location.c b/cpukit/libcsupport/src/sup_fs_location.c
index 5234c01..4ebf5f0 100644
--- a/cpukit/libcsupport/src/sup_fs_location.c
+++ b/cpukit/libcsupport/src/sup_fs_location.c
@@ -33,7 +33,6 @@ rtems_filesystem_location_info_t *rtems_filesystem_location_copy(
   dst->node_access = src->node_access;
   dst->node_access_2 = src->node_access_2;
   dst->handlers = src->handlers;
-  dst->ops = src->ops;
   dst->mt_entry = src->mt_entry;
   rtems_filesystem_location_add_to_mt_entry(dst);
 
@@ -213,6 +212,6 @@ void rtems_filesystem_do_unmount(
   rtems_chain_extract_unprotected(&mt_entry->mt_node);
   rtems_filesystem_mt_unlock();
   rtems_filesystem_global_location_release(mt_entry->mt_point_node);
-  (*mt_entry->mt_fs_root->location.ops->fsunmount_me_h)(mt_entry);
+  (*mt_entry->ops->fsunmount_me_h)(mt_entry);
   free(mt_entry);
 }
diff --git a/cpukit/libcsupport/src/sup_fs_node_type.c b/cpukit/libcsupport/src/sup_fs_node_type.c
index f78451d..0eb4221 100644
--- a/cpukit/libcsupport/src/sup_fs_node_type.c
+++ b/cpukit/libcsupport/src/sup_fs_node_type.c
@@ -25,7 +25,7 @@ rtems_filesystem_node_types_t rtems_filesystem_node_type(
   rtems_filesystem_node_types_t type;
 
   rtems_filesystem_instance_lock(loc);
-  type = (*loc->ops->node_type_h)(loc);
+  type = (*loc->mt_entry->ops->node_type_h)(loc);
   rtems_filesystem_instance_unlock(loc);
 
   return type;
diff --git a/cpukit/libcsupport/src/symlink.c b/cpukit/libcsupport/src/symlink.c
index f49730d..07ab87f 100644
--- a/cpukit/libcsupport/src/symlink.c
+++ b/cpukit/libcsupport/src/symlink.c
@@ -27,7 +27,7 @@ int symlink( const char *path1, const char *path2 )
   const rtems_filesystem_location_info_t *currentloc =
     rtems_filesystem_eval_path_start( &ctx, path2, eval_flags );
 
-  rv = (*currentloc->ops->symlink_h)(
+  rv = (*currentloc->mt_entry->ops->symlink_h)(
     currentloc,
     rtems_filesystem_eval_path_get_token( &ctx ),
     rtems_filesystem_eval_path_get_tokenlen( &ctx ),
diff --git a/cpukit/libcsupport/src/unlink.c b/cpukit/libcsupport/src/unlink.c
index 6a60915..8eff28a 100644
--- a/cpukit/libcsupport/src/unlink.c
+++ b/cpukit/libcsupport/src/unlink.c
@@ -35,7 +35,7 @@ int unlink( const char *path )
       parent_eval_flags
     );
 
-  rv = (*currentloc->ops->rmnod_h)(
+  rv = (*currentloc->mt_entry->ops->rmnod_h)(
     &parentloc,
     currentloc
   );
diff --git a/cpukit/libcsupport/src/unmount.c b/cpukit/libcsupport/src/unmount.c
index cf4befe..ab82350 100644
--- a/cpukit/libcsupport/src/unmount.c
+++ b/cpukit/libcsupport/src/unmount.c
@@ -32,7 +32,9 @@ int unmount( const char *path )
   rtems_filesystem_mount_table_entry_t *mt_entry = currentloc->mt_entry;
 
   if ( rtems_filesystem_location_is_root( currentloc ) ) {
-    rv = (*mt_entry->mt_point_node->location.ops->unmount_h)( mt_entry );
+    rv = (*mt_entry->mt_point_node->location.mt_entry->ops->unmount_h)(
+      mt_entry
+    );
     if ( rv == 0 ) {
       rtems_filesystem_mt_entry_declare_lock_context( lock_context );
 
diff --git a/cpukit/libcsupport/src/utime.c b/cpukit/libcsupport/src/utime.c
index fe4f710..0f65397 100644
--- a/cpukit/libcsupport/src/utime.c
+++ b/cpukit/libcsupport/src/utime.c
@@ -38,7 +38,7 @@ int utime( const char *path, const struct utimbuf *times )
     times = &now_times;
   }
 
-  rv = (*currentloc->ops->utime_h)(
+  rv = (*currentloc->mt_entry->ops->utime_h)(
     currentloc,
     times->actime,
     times->modtime
diff --git a/cpukit/libfs/src/devfs/devfs_init.c b/cpukit/libfs/src/devfs/devfs_init.c
index e489781..f8c1aaa 100644
--- a/cpukit/libfs/src/devfs/devfs_init.c
+++ b/cpukit/libfs/src/devfs/devfs_init.c
@@ -58,7 +58,7 @@ int devFS_initialize(
   if (data != NULL) {
     mt_entry->immutable_fs_info = data;
     mt_entry->mt_fs_root->location.handlers = &devFS_file_handlers;
-    mt_entry->mt_fs_root->location.ops = &devFS_ops;
+    mt_entry->ops = &devFS_ops;
   } else {
     errno = EINVAL;
     rv = -1;
diff --git a/cpukit/libfs/src/devfs/devfs_show.c b/cpukit/libfs/src/devfs/devfs_show.c
index acaa346..56badb1 100644
--- a/cpukit/libfs/src/devfs/devfs_show.c
+++ b/cpukit/libfs/src/devfs/devfs_show.c
@@ -14,7 +14,7 @@ void devFS_Show(void)
 {
   rtems_filesystem_location_info_t *rootloc = &rtems_filesystem_root->location;
 
-  if (rootloc->ops == &devFS_ops) {
+  if (rootloc->mt_entry->ops == &devFS_ops) {
     const devFS_data *data = devFS_get_data(rootloc);
     size_t i = 0;
     size_t n = data->count;
diff --git a/cpukit/libfs/src/dosfs/msdos_initsupp.c b/cpukit/libfs/src/dosfs/msdos_initsupp.c
index 1f05398..f3a2cc5 100644
--- a/cpukit/libfs/src/dosfs/msdos_initsupp.c
+++ b/cpukit/libfs/src/dosfs/msdos_initsupp.c
@@ -141,7 +141,7 @@ msdos_initialize_support(
 
     temp_mt_entry->mt_fs_root->location.node_access = fat_fd;
     temp_mt_entry->mt_fs_root->location.handlers = directory_handlers;
-    temp_mt_entry->mt_fs_root->location.ops = op_table;
+    temp_mt_entry->ops = op_table;
 
     return rc;
 }
diff --git a/cpukit/libfs/src/imfs/imfs_initsupp.c b/cpukit/libfs/src/imfs/imfs_initsupp.c
index 39b691a..4372558 100644
--- a/cpukit/libfs/src/imfs/imfs_initsupp.c
+++ b/cpukit/libfs/src/imfs/imfs_initsupp.c
@@ -78,10 +78,10 @@ int IMFS_initialize_support(
       NULL
     );
     if ( root_node != NULL ) {
+      mt_entry->ops = op_table;
       mt_entry->fs_info = fs_info;
       mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS;
       mt_entry->mt_fs_root->location.node_access = root_node;
-      mt_entry->mt_fs_root->location.ops = op_table;
       IMFS_Set_handlers( &mt_entry->mt_fs_root->location );
     } else {
       errno = ENOMEM;
diff --git a/cpukit/libfs/src/imfs/imfs_load_tar.c b/cpukit/libfs/src/imfs/imfs_load_tar.c
index 9abaf2f..e51194f 100644
--- a/cpukit/libfs/src/imfs/imfs_load_tar.c
+++ b/cpukit/libfs/src/imfs/imfs_load_tar.c
@@ -101,7 +101,11 @@ int rtems_tarfs_load(
      &ctx,
      RTEMS_FS_MAKE | RTEMS_FS_EXCLUSIVE
    );
-   if (rootloc.ops != &IMFS_ops && rootloc.ops != &fifoIMFS_ops) {
+
+   if (
+     rootloc.mt_entry->ops != &IMFS_ops
+       && rootloc.mt_entry->ops != &fifoIMFS_ops
+   ) {
      rv = -1;
    }
 
diff --git a/cpukit/libfs/src/nfsclient/src/nfs.c b/cpukit/libfs/src/nfsclient/src/nfs.c
index 0f33cf3..372f078 100644
--- a/cpukit/libfs/src/nfsclient/src/nfs.c
+++ b/cpukit/libfs/src/nfsclient/src/nfs.c
@@ -1753,7 +1753,7 @@ char				*path     = mt_entry->dev;
 
 	rootNode = 0;
 
-	mt_entry->mt_fs_root->location.ops		 = &nfs_fs_ops;
+	mt_entry->ops = &nfs_fs_ops;
 	mt_entry->mt_fs_root->location.handlers	 = &nfs_dir_file_handlers;
 	mt_entry->pathconf_limits_and_options = nfs_limits_and_options;
 
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c
index 9a245f5..5761583 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-rtems.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems.c
@@ -922,7 +922,7 @@ rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t* mt_entry,
 
   mt_entry->mt_fs_root->location.node_access = (void*) RTEMS_RFS_ROOT_INO;
   mt_entry->mt_fs_root->location.handlers    = &rtems_rfs_rtems_dir_handlers;
-  mt_entry->mt_fs_root->location.ops         = &rtems_rfs_ops;
+  mt_entry->ops                              = &rtems_rfs_ops;
 
   rtems_rfs_rtems_unlock (fs);
 
diff --git a/cpukit/libnetworking/lib/ftpfs.c b/cpukit/libnetworking/lib/ftpfs.c
index fad8f48..8c5f4db 100644
--- a/cpukit/libnetworking/lib/ftpfs.c
+++ b/cpukit/libnetworking/lib/ftpfs.c
@@ -1194,7 +1194,7 @@ int rtems_ftpfs_initialize(
 
   /* Set handler and oparations table */
   e->mt_fs_root->location.handlers = &rtems_ftpfs_root_handlers;
-  e->mt_fs_root->location.ops = &rtems_ftpfs_ops;
+  e->ops = &rtems_ftpfs_ops;
 
   /* We maintain no real file system nodes, so there is no real root */
   e->mt_fs_root->location.node_access = NULL;
diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c
index 3b81f54..d549436 100644
--- a/cpukit/libnetworking/lib/tftpDriver.c
+++ b/cpukit/libnetworking/lib/tftpDriver.c
@@ -205,7 +205,7 @@ int rtems_tftpfs_initialize(
   mt_entry->fs_info = fs;
   mt_entry->mt_fs_root->location.node_access = root_path;
   mt_entry->mt_fs_root->location.handlers = &rtems_tftp_handlers;
-  mt_entry->mt_fs_root->location.ops = &rtems_tftp_ops;
+  mt_entry->ops = &rtems_tftp_ops;
   
   /*
    *  Now allocate a semaphore for mutual exclusion.
diff --git a/cpukit/libnetworking/rtems/rtems_syscall.c b/cpukit/libnetworking/rtems/rtems_syscall.c
index d4a9e57..727eac6 100644
--- a/cpukit/libnetworking/rtems/rtems_syscall.c
+++ b/cpukit/libnetworking/rtems/rtems_syscall.c
@@ -88,7 +88,6 @@ rtems_bsdnet_makeFdForSocket (void *so)
   iop->data0 = fd;
   iop->data1 = so;
   iop->pathinfo.handlers = &socket_handlers;
-  iop->pathinfo.ops = &rtems_filesystem_operations_default;
   iop->pathinfo.mt_entry = &rtems_filesystem_null_mt_entry;
   rtems_filesystem_location_add_to_mt_entry(&iop->pathinfo);
   return fd;
diff --git a/testsuites/fstests/fsnofs01/init.c b/testsuites/fstests/fsnofs01/init.c
index 3ddc615..9d7f98b 100644
--- a/testsuites/fstests/fsnofs01/init.c
+++ b/testsuites/fstests/fsnofs01/init.c
@@ -53,7 +53,6 @@ static void rtems_test_assert_equal_to_null_loc(
   rtems_test_assert(null_loc->location.node_access == local_loc->node_access);
   rtems_test_assert(null_loc->location.node_access_2 == local_loc->node_access_2);
   rtems_test_assert(null_loc->location.handlers == local_loc->handlers);
-  rtems_test_assert(null_loc->location.ops == local_loc->ops);
   rtems_test_assert(null_loc->location.mt_entry == local_loc->mt_entry);
 }
 
-- 
1.6.4.2




More information about the devel mailing list