Commit d384742e authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Doug Ledford

RDMA/uverbs: Use offsetofend instead of opencoding

Discovered this was available already.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent da392921
...@@ -3708,9 +3708,6 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs) ...@@ -3708,9 +3708,6 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
* trailing driver_data flex array. In this case the size of the base struct * trailing driver_data flex array. In this case the size of the base struct
* cannot be changed. * cannot be changed.
*/ */
#define offsetof_after(_struct, _member) \
(offsetof(_struct, _member) + sizeof(((_struct *)NULL)->_member))
#define UAPI_DEF_WRITE_IO(req, resp) \ #define UAPI_DEF_WRITE_IO(req, resp) \
.write.has_resp = 1 + \ .write.has_resp = 1 + \
BUILD_BUG_ON_ZERO(offsetof(req, response) != 0) + \ BUILD_BUG_ON_ZERO(offsetof(req, response) != 0) + \
...@@ -3741,11 +3738,11 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs) ...@@ -3741,11 +3738,11 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)
*/ */
#define UAPI_DEF_WRITE_IO_EX(req, req_last_member, resp, resp_last_member) \ #define UAPI_DEF_WRITE_IO_EX(req, req_last_member, resp, resp_last_member) \
.write.has_resp = 1, \ .write.has_resp = 1, \
.write.req_size = offsetof_after(req, req_last_member), \ .write.req_size = offsetofend(req, req_last_member), \
.write.resp_size = offsetof_after(resp, resp_last_member) .write.resp_size = offsetofend(resp, resp_last_member)
#define UAPI_DEF_WRITE_I_EX(req, req_last_member) \ #define UAPI_DEF_WRITE_I_EX(req, req_last_member) \
.write.req_size = offsetof_after(req, req_last_member) .write.req_size = offsetofend(req, req_last_member)
const struct uapi_definition uverbs_def_write_intf[] = { const struct uapi_definition uverbs_def_write_intf[] = {
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
......
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