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>
This commit is contained in:

committed by
Leon Romanovsky

parent
5f9bf63ae8
commit
3efa38125b
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user