]> git.itanic.dy.fi Git - linux-stable/commit
xfs: simplify xfs_attr_sf_findname
authorChristoph Hellwig <hch@lst.de>
Wed, 20 Dec 2023 06:34:58 +0000 (07:34 +0100)
committerChandan Babu R <chandanbabu@kernel.org>
Fri, 29 Dec 2023 08:07:04 +0000 (13:37 +0530)
commit6c8d169bbd51fc10d1d0029d495962881315b4c2
tree3f42019029773653bfabce94e9ba8d09d0053e3c
parent14f2e4ab5d0310c2bb231941d9884fa5bae47fab
xfs: simplify xfs_attr_sf_findname

xfs_attr_sf_findname has the simple job of finding a xfs_attr_sf_entry in
the attr fork, but the convoluted calling convention obfuscates that.

Return the found entry as the return value instead of an pointer
argument, as the -ENOATTR/-EEXIST can be trivally derived from that, and
remove the basep argument, as it is equivalent of the offset of sfe in
the data for if an sfe was found, or an offset of totsize if not was
found.  To simplify the totsize computation add a xfs_attr_sf_endptr
helper that returns the imaginative xfs_attr_sf_entry at the end of
the current attrs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_leaf.h
fs/xfs/libxfs/xfs_attr_sf.h