Changeset e2abab03 in mainline


Ignore:
Timestamp:
2011-03-09T15:25:38Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eef306c
Parents:
84226f0
Message:

Split getting instance out of ext2fs_node_get so we don't unncesarily get instance again in ext2fs_match

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    r84226f0 re2abab03  
    7171} ext2fs_node_t;
    7272
     73/*
     74 * Forward declarations of auxiliary functions
     75 */
    7376static int ext2fs_instance_get(devmap_handle_t, ext2fs_instance_t **);
    7477static void ext2fs_read_directory(ipc_callid_t, ipc_callid_t, aoff64_t,
     
    7780        size_t, ext2fs_instance_t *, ext2_inode_ref_t *);
    7881static bool ext2fs_is_dots(const uint8_t *, size_t);
     82static int ext2fs_node_get_core(fs_node_t **, ext2fs_instance_t *, fs_index_t);
    7983
    8084/*
     
    203207                        if (name_size == component_size && bcmp(component, &it.current->name,
    204208                                    name_size) == 0) {
    205                                 // FIXME: this may be done better (give instance as param)
    206                                 rc = ext2fs_node_get(rfn, eparent->instance->devmap_handle,
     209                                rc = ext2fs_node_get_core(rfn, eparent->instance,
    207210                                        it.current->inode);
    208211                                if (rc != EOK) {
     
    235238{
    236239        EXT2FS_DBG("(-,%u,%u)", devmap_handle, index);
     240       
     241        ext2fs_instance_t *inst = NULL;
     242        int rc;
     243       
     244        rc = ext2fs_instance_get(devmap_handle, &inst);
     245        if (rc != EOK) {
     246                return rc;
     247        }
     248       
     249        return ext2fs_node_get_core(rfn, inst, index);
     250}
     251
     252int ext2fs_node_get_core(fs_node_t **rfn, ext2fs_instance_t *inst,
     253                fs_index_t index)
     254{
    237255        int rc;
    238256        fs_node_t *node = NULL;
    239257        ext2fs_node_t *enode = NULL;
    240         ext2fs_instance_t *inst = NULL;
     258       
    241259        ext2_inode_ref_t *inode_ref = NULL;
    242260
     
    250268                free(enode);
    251269                return ENOMEM;
    252         }
    253        
     270        }       
    254271        fs_node_initialize(node);
    255272
    256         rc = ext2fs_instance_get(devmap_handle, &inst);
    257         if (rc != EOK) {
    258                 free(enode);
    259                 free(node);
    260                 return rc;
    261         }
    262                
    263273        rc = ext2_filesystem_get_inode_ref(inst->filesystem, index, &inode_ref);
    264274        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.