1
0

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>
Este cometimento está contido em:
Matan Barak
2018-05-31 16:43:28 +03:00
cometido por Leon Romanovsky
ascendente 5f9bf63ae8
cometimento 3efa38125b
3 ficheiros modificados com 25 adições e 13 eliminações

Ver ficheiro

@@ -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)
{