Added the length of the name string a a parameter.
Using strlen() on the name string may not give the correct length
in case of paths like: /mountpoint/nonexistdir1/nonexistdir2.
* @return Error code
*/
int ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,
- struct ext4_inode_ref *child, const char *name);
+ struct ext4_inode_ref *child, const char *name, uint32_t name_len);
/**@brief Add new entry to indexed directory
* @param dir Directory i-node
/* Index adding (if allowed) */
if ((ext4_sb_feature_com(sb, EXT4_FCOM_DIR_INDEX)) &&
(ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
- r = ext4_dir_dx_add_entry(parent, child, name);
+ r = ext4_dir_dx_add_entry(parent, child, name, name_len);
/* Check if index is not corrupted */
if (r != EXT4_ERR_BAD_DX_DIR) {
}
int ext4_dir_dx_add_entry(struct ext4_inode_ref *parent,
- struct ext4_inode_ref *child, const char *name)
+ struct ext4_inode_ref *child, const char *name, uint32_t name_len)
{
int rc2 = EOK;
int r;
}
/* Initialize hinfo structure (mainly compute hash) */
- uint32_t name_len = strlen(name);
struct ext4_hash_info hinfo;
r = ext4_dir_hinfo_init(&hinfo, &root_blk, &fs->sb, name_len, name);
if (r != EOK) {