diff options
Diffstat (limited to 'cpukit/libfs/src/imfs/imfs_eval.c')
-rw-r--r-- | cpukit/libfs/src/imfs/imfs_eval.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_eval.c b/cpukit/libfs/src/imfs/imfs_eval.c index 9bbfc830e2..9e2d6f5c1f 100644 --- a/cpukit/libfs/src/imfs/imfs_eval.c +++ b/cpukit/libfs/src/imfs/imfs_eval.c @@ -38,18 +38,18 @@ static bool IMFS_eval_is_directory( } static IMFS_jnode_t *IMFS_search_in_directory( - IMFS_jnode_t *dir, + IMFS_directory_t *dir, const char *token, size_t tokenlen ) { if ( rtems_filesystem_is_current_directory( token, tokenlen ) ) { - return dir; + return &dir->Node; } else { if ( rtems_filesystem_is_parent_directory( token, tokenlen ) ) { - return dir->Parent; + return dir->Node.Parent; } else { - rtems_chain_control *entries = &dir->info.directory.Entries; + rtems_chain_control *entries = &dir->Entries; rtems_chain_node *current = rtems_chain_first( entries ); rtems_chain_node *tail = rtems_chain_tail( entries ); @@ -72,14 +72,16 @@ static IMFS_jnode_t *IMFS_search_in_directory( static rtems_filesystem_global_location_t **IMFS_is_mount_point( IMFS_jnode_t *node, - IMFS_jnode_types_t type + mode_t mode ) { rtems_filesystem_global_location_t **fs_root_ptr = NULL; - if ( type == IMFS_DIRECTORY ) { - if ( node->info.directory.mt_fs != NULL ) { - fs_root_ptr = &node->info.directory.mt_fs->mt_fs_root; + if ( S_ISDIR( mode ) ) { + IMFS_directory_t *dir = (IMFS_directory_t *) node; + + if ( dir->mt_fs != NULL ) { + fs_root_ptr = &dir->mt_fs->mt_fs_root; } } @@ -97,13 +99,13 @@ static rtems_filesystem_eval_path_generic_status IMFS_eval_token( RTEMS_FILESYSTEM_EVAL_PATH_GENERIC_DONE; rtems_filesystem_location_info_t *currentloc = rtems_filesystem_eval_path_get_currentloc( ctx ); - IMFS_jnode_t *dir = currentloc->node_access; + IMFS_directory_t *dir = currentloc->node_access; bool access_ok = rtems_filesystem_eval_path_check_access( ctx, RTEMS_FS_PERMS_EXEC, - dir->st_mode, - dir->st_uid, - dir->st_gid + dir->Node.st_mode, + dir->Node.st_uid, + dir->Node.st_gid ); if ( access_ok ) { @@ -114,24 +116,27 @@ static rtems_filesystem_eval_path_generic_status IMFS_eval_token( int eval_flags = rtems_filesystem_eval_path_get_flags( ctx ); bool follow_hard_link = (eval_flags & RTEMS_FS_FOLLOW_HARD_LINK) != 0; bool follow_sym_link = (eval_flags & RTEMS_FS_FOLLOW_SYM_LINK) != 0; - IMFS_jnode_types_t type = IMFS_type( entry ); + mode_t mode = entry->st_mode; rtems_filesystem_eval_path_clear_token( ctx ); - if ( type == IMFS_HARD_LINK && (follow_hard_link || !terminal)) { - entry = entry->info.hard_link.link_node; + if ( IMFS_is_hard_link( mode ) && ( follow_hard_link || !terminal ) ) { + const IMFS_link_t *hard_link = (const IMFS_link_t *) entry; + + entry = hard_link->link_node; } - if ( type == IMFS_SYM_LINK && (follow_sym_link || !terminal)) { - const char *target = entry->info.sym_link.name; + if ( S_ISLNK( mode ) && ( follow_sym_link || !terminal ) ) { + const IMFS_sym_link_t *sym_link = (const IMFS_sym_link_t *) entry; + const char *target = sym_link->name; rtems_filesystem_eval_path_recursive( ctx, target, strlen( target ) ); } else { rtems_filesystem_global_location_t **fs_root_ptr = - IMFS_is_mount_point( entry, type ); + IMFS_is_mount_point( entry, mode ); if ( fs_root_ptr == NULL ) { - --dir->reference_count; + --dir->Node.reference_count; ++entry->reference_count; currentloc->node_access = entry; currentloc->node_access_2 = |