Ignore:
Timestamp:
2012-02-05T12:35:02Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50601ef
Parents:
512a7df
Message:
  • bugfix in adding directory entry (linear)
  • added skeleton for using directory index (not used yet)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_directory_index.c

    r512a7df r565b6ff  
    391391        }
    392392
     393        // Hardcoded number 2 means maximum height of index tree !!!
    393394        ext4_directory_dx_block_t dx_blocks[2];
    394395        ext4_directory_dx_block_t *dx_block;
     
    449450}
    450451
     452int ext4_directory_dx_add_entry(ext4_filesystem_t *fs,
     453                ext4_inode_ref_t *parent, size_t name_size, const char *name)
     454{
     455        // TODO delete this command
     456        return EXT4_ERR_BAD_DX_DIR;
     457
     458        EXT4FS_DBG("NOT REACHED");
     459
     460        int rc;
     461
     462        // get direct block 0 (index root)
     463        uint32_t root_block_addr;
     464        rc = ext4_filesystem_get_inode_data_block_index(fs, parent->inode, 0, &root_block_addr);
     465        if (rc != EOK) {
     466                return rc;
     467        }
     468
     469        block_t *root_block;
     470        rc = block_get(&root_block, fs->device, root_block_addr, BLOCK_FLAGS_NONE);
     471        if (rc != EOK) {
     472                return rc;
     473        }
     474
     475        ext4_hash_info_t hinfo;
     476        rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock, name_size, name);
     477        if (rc != EOK) {
     478                block_put(root_block);
     479                return EXT4_ERR_BAD_DX_DIR;
     480        }
     481
     482        // Hardcoded number 2 means maximum height of index tree !!!
     483        ext4_directory_dx_block_t dx_blocks[2];
     484        ext4_directory_dx_block_t *dx_block;
     485        rc = ext4_directory_dx_get_leaf(&hinfo, fs, parent->inode, root_block, &dx_block, dx_blocks);
     486        if (rc != EOK) {
     487                block_put(root_block);
     488                return EXT4_ERR_BAD_DX_DIR;
     489        }
     490
     491        // TODO
     492        /*
     493         * 1) try to write entry
     494         * 2) split leaves if necessary
     495         * 3) return
     496         */
     497
     498
     499}
    451500
    452501
Note: See TracChangeset for help on using the changeset viewer.