X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=include%2Frdma%2Fuverbs_types.h;h=66368b5a30066515626d003c7a8e8f57fbd92f5e;hb=6be60aed126ccd4dfb4a60d1dc2ecec0bca21b2e;hp=0777e405f22a08cfc9e628635ebf2bb4b1568e28;hpb=3832125624b75b54567be906e9aa67e1343be569;p=karo-tx-linux.git diff --git a/include/rdma/uverbs_types.h b/include/rdma/uverbs_types.h index 0777e405f22a..66368b5a3006 100644 --- a/include/rdma/uverbs_types.h +++ b/include/rdma/uverbs_types.h @@ -129,4 +129,18 @@ void rdma_alloc_abort_uobject(struct ib_uobject *uobj); int __must_check rdma_remove_commit_uobject(struct ib_uobject *uobj); int rdma_alloc_commit_uobject(struct ib_uobject *uobj); +extern const struct uverbs_obj_type_class uverbs_idr_class; + +#define UVERBS_BUILD_BUG_ON(cond) (sizeof(char[1 - 2 * !!(cond)]) - \ + sizeof(char)) +#define UVERBS_TYPE_ALLOC_IDR_SZ(_size, _order) \ + { \ + .destroy_order = _order, \ + .type_class = &uverbs_idr_class, \ + .obj_size = (_size) + \ + UVERBS_BUILD_BUG_ON((_size) < \ + sizeof(struct ib_uobject)), \ + } +#define UVERBS_TYPE_ALLOC_IDR(_order) \ + UVERBS_TYPE_ALLOC_IDR_SZ(sizeof(struct ib_uobject), _order) #endif