Commit b01ef655 authored by Dave Chinner's avatar Dave Chinner Committed by Ben Myers

xfs: make dir2 ftype offset pointers explicit

Rather than hiding the ftype field size accounting inside the dirent
padding for the ".." and first entry offset functions for v2
directory formats, add explicit functions that calculate it
correctly.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 1c9a5b2e
...@@ -333,6 +333,25 @@ xfs_dir2_data_first_entry_p( ...@@ -333,6 +333,25 @@ xfs_dir2_data_first_entry_p(
XFS_DIR2_DATA_ENTSIZE(2)); XFS_DIR2_DATA_ENTSIZE(2));
} }
static struct xfs_dir2_data_entry *
xfs_dir2_ftype_data_dotdot_entry_p(
struct xfs_dir2_data_hdr *hdr)
{
return (struct xfs_dir2_data_entry *)
((char *)hdr + sizeof(struct xfs_dir2_data_hdr) +
XFS_DIR3_DATA_ENTSIZE(1));
}
static struct xfs_dir2_data_entry *
xfs_dir2_ftype_data_first_entry_p(
struct xfs_dir2_data_hdr *hdr)
{
return (struct xfs_dir2_data_entry *)
((char *)hdr + sizeof(struct xfs_dir2_data_hdr) +
XFS_DIR3_DATA_ENTSIZE(1) +
XFS_DIR3_DATA_ENTSIZE(2));
}
static struct xfs_dir2_data_entry * static struct xfs_dir2_data_entry *
xfs_dir3_data_dot_entry_p( xfs_dir3_data_dot_entry_p(
struct xfs_dir2_data_hdr *hdr) struct xfs_dir2_data_hdr *hdr)
...@@ -762,8 +781,8 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = { ...@@ -762,8 +781,8 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = {
.data_entry_offset = sizeof(struct xfs_dir2_data_hdr), .data_entry_offset = sizeof(struct xfs_dir2_data_hdr),
.data_dot_entry_p = xfs_dir2_data_dot_entry_p, .data_dot_entry_p = xfs_dir2_data_dot_entry_p,
.data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, .data_dotdot_entry_p = xfs_dir2_ftype_data_dotdot_entry_p,
.data_first_entry_p = xfs_dir2_data_first_entry_p, .data_first_entry_p = xfs_dir2_ftype_data_first_entry_p,
.data_entry_p = xfs_dir2_data_entry_p, .data_entry_p = xfs_dir2_data_entry_p,
.data_unused_p = xfs_dir2_data_unused_p, .data_unused_p = xfs_dir2_data_unused_p,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment