[PATCH 19/29] xfs: replace ATTR_ENTBASESIZE with offsetoff

Christoph Hellwig
2020-01-14T08:16:12Z

Replace an opencoded offsetof with the actual helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_attr_list.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index 9c4acb6dc856..7f08e417d131 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -545,10 +545,9 @@ xfs_attr_list_int(
return error;
}

-#define ATTR_ENTBASESIZE /* minimum bytes used by an attr */ \
- (((struct attrlist_ent *) 0)->a_name - (char *) 0)
#define ATTR_ENTSIZE(namelen) /* actual bytes used by an attr */ \
- ((ATTR_ENTBASESIZE + (namelen) + 1 + sizeof(uint32_t)-1) \
+ ((offsetof(struct attrlist_ent, a_name) + \
+ (namelen) + 1 + sizeof(uint32_t) - 1) \
& ~(sizeof(uint32_t)-1))

/*
--
2.24.1