/* Node Directory */
return xfs_readdir_dir2_node(file, dirent, core);
}
-
- return -1;
}
static int xfs_readdir(struct file *file, struct dirent *dirent)
/* Node Directory */
return xfs_dir2_node_find_entry(dname, parent, core);
}
-
- return NULL;
}
static inline struct inode *xfs_fmt_btree_find_entry(const char *dname,
inode = xfs_fmt_extents_find_entry(dname, parent, core);
} else if (core->di_format == XFS_DINODE_FMT_BTREE) {
inode = xfs_fmt_btree_find_entry(dname, parent, core);
- } else {
- xfs_debug("format %hhu", core->di_format);
- xfs_debug("TODO: format \"local\" and \"extents\" are the only "
- "supported ATM");
- goto out;
}
if (!inode) {
}
out:
- free(leaf);
-
return NULL;
found:
xfs_debug("entry inode's number %lu", ino);
- free(leaf);
-
return ip;
failed:
free(ip);
- free(leaf);
return ip;
}
goto out;
}
- free(node);
node = (xfs_da_intnode_t *)xfs_dir2_dirblks_get_cached(parent->fs,
fsblkno, 1);
} while(be16_to_cpu(node->hdr.info.magic) == XFS_DA_NODE_MAGIC);
}
out:
- free(node);
-
return NULL;
found:
xfs_debug("entry inode's number %lu", ino);
- free(node);
-
return ip;
failed:
free(ip);
- free(node);
return NULL;
}
if (retval)
xfs_error("Failed to fill in dirent structure");
- free(leaf);
-
return retval;
out:
- free(leaf);
-
return -1;
}
leaf = (xfs_dir2_leaf_t*)xfs_dir2_dirblks_get_cached(fs, fsblkno, 1);
if (be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR2_LEAFN_MAGIC) {
xfs_error("Leaf's magic number does not match!");
- goto out1;
+ goto out;
}
if (!leaf->hdr.count ||
XFS_PVT(inode)->i_leaf_ent_offset >= be16_to_cpu(leaf->hdr.count)) {
XFS_PVT(inode)->i_btree_offset++;
XFS_PVT(inode)->i_leaf_ent_offset = 0;
- free(leaf);
goto try_next_btree;
}
if (XFS_PVT(inode)->i_leaf_ent_offset == be16_to_cpu(leaf->hdr.count)) {
XFS_PVT(inode)->i_btree_offset++;
XFS_PVT(inode)->i_leaf_ent_offset = 0;
- free(leaf);
goto try_next_btree;
} else {
XFS_PVT(inode)->i_leaf_ent_offset++;
fsblkno = xfs_dir2_get_right_blk(fs, core, db, &error);
if (error) {
xfs_error("Cannot find data block!");
- goto out1;
+ goto out;
}
buf = xfs_dir2_dirblks_get_cached(fs, fsblkno, 1);
data_hdr = (xfs_dir2_data_hdr_t *)buf;
if (be32_to_cpu(data_hdr->magic) != XFS_DIR2_DATA_MAGIC) {
xfs_error("Leaf directory's data magic No. does not match!");
- goto out1;
+ goto out;
}
offset = xfs_dir2_dataptr_to_off(fs, be32_to_cpu(lep->address));
if (retval)
xfs_error("Failed to fill in dirent structure");
- free(leaf);
- free(node);
-
return retval;
-out1:
- free(leaf);
-
out:
- free(node);
-
XFS_PVT(inode)->i_btree_offset = 0;
XFS_PVT(inode)->i_leaf_ent_offset = 0;