diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-10-29 12:11:55 +0100 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-10-30 19:52:38 +0100 |
commit | b01ef655d8b9753c3d25e4c22e0a4e7c442fe5e1 (patch) | |
tree | 278f8f66e6c01e9954cf66f1f46b8a01c35d432d /fs/xfs | |
parent | xfs: convert directory vector functions to constants (diff) | |
download | linux-b01ef655d8b9753c3d25e4c22e0a4e7c442fe5e1.tar.xz linux-b01ef655d8b9753c3d25e4c22e0a4e7c442fe5e1.zip |
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')
-rw-r--r-- | fs/xfs/xfs_da_format.c | 23 |
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( } 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 * xfs_dir3_data_dot_entry_p( struct xfs_dir2_data_hdr *hdr) { @@ -762,8 +781,8 @@ const struct xfs_dir_ops xfs_dir2_ftype_ops = { .data_entry_offset = sizeof(struct xfs_dir2_data_hdr), .data_dot_entry_p = xfs_dir2_data_dot_entry_p, - .data_dotdot_entry_p = xfs_dir2_data_dotdot_entry_p, - .data_first_entry_p = xfs_dir2_data_first_entry_p, + .data_dotdot_entry_p = xfs_dir2_ftype_data_dotdot_entry_p, + .data_first_entry_p = xfs_dir2_ftype_data_first_entry_p, .data_entry_p = xfs_dir2_data_entry_p, .data_unused_p = xfs_dir2_data_unused_p, |