aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_da_format.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-10-29 07:11:55 -0400
committerBen Myers <bpm@sgi.com>2013-10-30 14:52:38 -0400
commitb01ef655d8b9753c3d25e4c22e0a4e7c442fe5e1 (patch)
tree278f8f66e6c01e9954cf66f1f46b8a01c35d432d /fs/xfs/xfs_da_format.c
parent1c9a5b2e3045b91a10335adcc73267c304cb5dc0 (diff)
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: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_da_format.c')
-rw-r--r--fs/xfs/xfs_da_format.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/fs/xfs/xfs_da_format.c b/fs/xfs/xfs_da_format.c
index 40f18d3b7b9b..870cac0b0981 100644
--- a/fs/xfs/xfs_da_format.c
+++ b/fs/xfs/xfs_da_format.c
@@ -334,6 +334,25 @@ xfs_dir2_data_first_entry_p(
334} 334}
335 335
336static struct xfs_dir2_data_entry * 336static struct xfs_dir2_data_entry *
337xfs_dir2_ftype_data_dotdot_entry_p(
338 struct xfs_dir2_data_hdr *hdr)
339{
340 return (struct xfs_dir2_data_entry *)
341 ((char *)hdr + sizeof(struct xfs_dir2_data_hdr) +
342 XFS_DIR3_DATA_ENTSIZE(1));
343}
344
345static struct xfs_dir2_data_entry *
346xfs_dir2_ftype_data_first_entry_p(
347 struct xfs_dir2_data_hdr *hdr)
348{
349 return (struct xfs_dir2_data_entry *)
350 ((char *)hdr + sizeof(struct xfs_dir2_data_hdr) +
351 XFS_DIR3_DATA_ENTSIZE(1) +
352 XFS_DIR3_DATA_ENTSIZE(2));
353}
354
355static struct xfs_dir2_data_entry *
337xfs_dir3_data_dot_entry_p( 356xfs_dir3_data_dot_entry_p(
338 struct xfs_dir2_data_hdr *hdr) 357 struct xfs_dir2_data_hdr *hdr)
339{ 358{
@@ -762,8 +781,8 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = {
762 .data_entry_offset = sizeof(struct xfs_dir2_data_hdr), 781 .data_entry_offset = sizeof(struct xfs_dir2_data_hdr),
763 782
764 .data_dot_entry_p = xfs_dir2_data_dot_entry_p, 783 .data_dot_entry_p = xfs_dir2_data_dot_entry_p,
765 .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, 784 .data_dotdot_entry_p = xfs_dir2_ftype_data_dotdot_entry_p,
766 .data_first_entry_p = xfs_dir2_data_first_entry_p, 785 .data_first_entry_p = xfs_dir2_ftype_data_first_entry_p,
767 .data_entry_p = xfs_dir2_data_entry_p, 786 .data_entry_p = xfs_dir2_data_entry_p,
768 .data_unused_p = xfs_dir2_data_unused_p, 787 .data_unused_p = xfs_dir2_data_unused_p,
769 788