diff options
Diffstat (limited to 'cpukit/libcsupport')
26 files changed, 62 insertions, 51 deletions
diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index 44dd847ebb..0e74c4c7fe 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -1431,13 +1431,14 @@ extern int rtems_mkdir(const char *path, mode_t mode); */ struct rtems_filesystem_mount_table_entry_tt { rtems_chain_node mt_node; + void *fs_info; + const rtems_filesystem_operations_table *ops; + const void *immutable_fs_info; rtems_chain_control location_chain; rtems_filesystem_global_location_t *mt_point_node; rtems_filesystem_global_location_t *mt_fs_root; bool mounted; bool writeable; - void *fs_info; - const void *immutable_fs_info; rtems_filesystem_limits_and_options_t pathconf_limits_and_options; /* diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h index 3e2139f450..418f4a31ec 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 73d2b06366..6a793755ab 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 45ba0adb6b..007f2499c4 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 73333fe831..47de601b98 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 fa677cbe9c..7cc03a2a07 100644 --- a/cpukit/libcsupport/src/chown.c +++ b/cpukit/libcsupport/src/chown.c @@ -32,12 +32,9 @@ int rtems_filesystem_chown( int eval_flags = eval_follow_link; const rtems_filesystem_location_info_t *currentloc = rtems_filesystem_eval_path_start( &ctx, path, eval_flags ); + const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops; - rv = (*currentloc->ops->chown_h)( - currentloc, - owner, - group - ); + rv = (*ops->chown_h)( currentloc, owner, group ); rtems_filesystem_eval_path_cleanup( &ctx ); diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c index 11ae8fce7a..9e63704f95 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 380ad90699..0ac7c9ef40 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 e2f166a8ab..944873817d 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 bacdbacfd8..6dfbc52ff3 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 28913a4e7d..84e58256d2 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 19ca2d6776..c16e7a018e 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 c9dc1d7ece..6a63455d81 100644 --- a/cpukit/libcsupport/src/mknod.c +++ b/cpukit/libcsupport/src/mknod.c @@ -47,7 +47,9 @@ int rtems_filesystem_mknod( } if ( rv == 0 ) { - rv = (*parentloc->ops->mknod_h)( parentloc, name, namelen, mode, dev ); + const rtems_filesystem_operations_table *ops = parentloc->mt_entry->ops; + + rv = (*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 52886d15b6..4563bdbf24 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 6bfbd53202..02436b66e7 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 3e7a831295..2cafcca10d 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 9b54987e79..4e7baf5e39 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 b944b631eb..163d51eb1a 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 5f7b606e7d..f323dbc8f3 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 d8629c64ab..27dd80145a 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 5234c01ddc..4ebf5f04d7 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 f78451dee1..0eb4221402 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 f49730df70..07ab87fc57 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 6a6091575b..9817ad9611 100644 --- a/cpukit/libcsupport/src/unlink.c +++ b/cpukit/libcsupport/src/unlink.c @@ -34,11 +34,9 @@ int unlink( const char *path ) &parentloc, parent_eval_flags ); + const rtems_filesystem_operations_table *ops = currentloc->mt_entry->ops; - rv = (*currentloc->ops->rmnod_h)( - &parentloc, - currentloc - ); + rv = (*ops->rmnod_h)( &parentloc, currentloc ); rtems_filesystem_eval_path_cleanup_with_parent( &ctx, &parentloc ); diff --git a/cpukit/libcsupport/src/unmount.c b/cpukit/libcsupport/src/unmount.c index cf4befe5a4..b58955d33c 100644 --- a/cpukit/libcsupport/src/unmount.c +++ b/cpukit/libcsupport/src/unmount.c @@ -32,7 +32,10 @@ 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 ); + const rtems_filesystem_operations_table *mt_point_ops = + mt_entry->mt_point_node->location.mt_entry->ops; + + rv = (*mt_point_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 fe4f7109a3..0f65397166 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 |