diff options
author | Matan Barak <matanb@mellanox.com> | 2018-05-31 15:43:28 +0200 |
---|---|---|
committer | Leon Romanovsky <leonro@mellanox.com> | 2018-06-02 06:33:53 +0200 |
commit | 3efa38125b81fb4eb7dbb43295cb82a203dc0398 (patch) | |
tree | b70ce7fe0a8d71a80fb8483ffc2447a5a530c0c8 /include/rdma/uverbs_ioctl.h | |
parent | net/mlx5: Export flow counter related API (diff) | |
download | linux-3efa38125b81fb4eb7dbb43295cb82a203dc0398.tar.xz linux-3efa38125b81fb4eb7dbb43295cb82a203dc0398.zip |
IB/uverbs: Add an ib_uobject getter to ioctl() infrastructure
Previously, the user had to dig inside the attribute to get the uobject.
Add a helper function that correctly extract it (and do the required
checks) for him/her.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include/rdma/uverbs_ioctl.h')
-rw-r--r-- | include/rdma/uverbs_ioctl.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h index 4a4201d997a7..7ac6271a5ee0 100644 --- a/include/rdma/uverbs_ioctl.h +++ b/include/rdma/uverbs_ioctl.h @@ -420,6 +420,17 @@ static inline void *uverbs_attr_get_obj(const struct uverbs_attr_bundle *attrs_b return uobj->object; } +static inline struct ib_uobject *uverbs_attr_get_uobject(const struct uverbs_attr_bundle *attrs_bundle, + u16 idx) +{ + const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx); + + if (IS_ERR(attr)) + return ERR_CAST(attr); + + return attr->obj_attr.uobject; +} + static inline int uverbs_copy_to(const struct uverbs_attr_bundle *attrs_bundle, size_t idx, const void *from, size_t size) { |