RDMA/uverbs: Get rid of the & in method specifications
Hide it inside the macros. The & is confusing and interferes with using this as a generic DSL in later patches. Since this also touches almost every line, also run the specs through clang-format (with 'BinPackParameters: false') to make the maintenance easier. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
This commit is contained in:
@@ -212,7 +212,7 @@ struct uverbs_object_tree_def {
|
||||
#define UA_FLAGS(_flags) .flags = _flags
|
||||
|
||||
#define UVERBS_ATTR_IDR(_attr_id, _idr_type, _access, ...) \
|
||||
((const struct uverbs_attr_def){ \
|
||||
(&(const struct uverbs_attr_def){ \
|
||||
.id = _attr_id, \
|
||||
.attr = { .type = UVERBS_ATTR_TYPE_IDR, \
|
||||
.u.obj.obj_type = _idr_type, \
|
||||
@@ -220,7 +220,7 @@ struct uverbs_object_tree_def {
|
||||
__VA_ARGS__ } })
|
||||
|
||||
#define UVERBS_ATTR_FD(_attr_id, _fd_type, _access, ...) \
|
||||
((const struct uverbs_attr_def){ \
|
||||
(&(const struct uverbs_attr_def){ \
|
||||
.id = (_attr_id) + \
|
||||
BUILD_BUG_ON_ZERO((_access) != UVERBS_ACCESS_NEW && \
|
||||
(_access) != UVERBS_ACCESS_READ), \
|
||||
@@ -230,14 +230,14 @@ struct uverbs_object_tree_def {
|
||||
__VA_ARGS__ } })
|
||||
|
||||
#define UVERBS_ATTR_PTR_IN(_attr_id, _type, ...) \
|
||||
((const struct uverbs_attr_def){ \
|
||||
(&(const struct uverbs_attr_def){ \
|
||||
.id = _attr_id, \
|
||||
.attr = { .type = UVERBS_ATTR_TYPE_PTR_IN, \
|
||||
_type, \
|
||||
__VA_ARGS__ } })
|
||||
|
||||
#define UVERBS_ATTR_PTR_OUT(_attr_id, _type, ...) \
|
||||
((const struct uverbs_attr_def){ \
|
||||
(&(const struct uverbs_attr_def){ \
|
||||
.id = _attr_id, \
|
||||
.attr = { .type = UVERBS_ATTR_TYPE_PTR_OUT, \
|
||||
_type, \
|
||||
@@ -245,7 +245,7 @@ struct uverbs_object_tree_def {
|
||||
|
||||
/* _enum_arry should be a 'static const union uverbs_attr_spec[]' */
|
||||
#define UVERBS_ATTR_ENUM_IN(_attr_id, _enum_arr, ...) \
|
||||
((const struct uverbs_attr_def){ \
|
||||
(&(const struct uverbs_attr_def){ \
|
||||
.id = _attr_id, \
|
||||
.attr = { .type = UVERBS_ATTR_TYPE_ENUM_IN, \
|
||||
.u2.enum_def.ids = _enum_arr, \
|
||||
@@ -259,12 +259,12 @@ struct uverbs_object_tree_def {
|
||||
* spec.
|
||||
*/
|
||||
#define UVERBS_ATTR_UHW() \
|
||||
&UVERBS_ATTR_PTR_IN(UVERBS_ATTR_UHW_IN, \
|
||||
UVERBS_ATTR_PTR_IN(UVERBS_ATTR_UHW_IN, \
|
||||
UVERBS_ATTR_SIZE(0, USHRT_MAX), \
|
||||
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)), \
|
||||
UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_UHW_OUT, \
|
||||
UVERBS_ATTR_SIZE(0, USHRT_MAX), \
|
||||
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO)), \
|
||||
&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_UHW_OUT, \
|
||||
UVERBS_ATTR_SIZE(0, USHRT_MAX), \
|
||||
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO))
|
||||
UA_FLAGS(UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO))
|
||||
|
||||
/*
|
||||
* =======================================
|
||||
|
@@ -78,13 +78,24 @@
|
||||
_object_id)[] = { __VA_ARGS__ }; \
|
||||
const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \
|
||||
.id = _object_id, \
|
||||
.type_attrs = _type_attrs, \
|
||||
.type_attrs = &_type_attrs, \
|
||||
.num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
|
||||
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
|
||||
}
|
||||
|
||||
#define DECLARE_UVERBS_GLOBAL_METHODS(_name, ...) \
|
||||
DECLARE_UVERBS_NAMED_OBJECT(_name, NULL, ##__VA_ARGS__)
|
||||
/*
|
||||
* Declare global methods. These still have a unique object_id because we
|
||||
* identify all uapi methods with a (object,method) tuple. However, they have
|
||||
* no type pointer.
|
||||
*/
|
||||
#define DECLARE_UVERBS_GLOBAL_METHODS(_object_id, ...) \
|
||||
static const struct uverbs_method_def *const UVERBS_OBJECT_METHODS( \
|
||||
_object_id)[] = { __VA_ARGS__ }; \
|
||||
const struct uverbs_object_def UVERBS_OBJECT(_object_id) = { \
|
||||
.id = _object_id, \
|
||||
.num_methods = ARRAY_SIZE(UVERBS_OBJECT_METHODS(_object_id)), \
|
||||
.methods = &UVERBS_OBJECT_METHODS(_object_id) \
|
||||
}
|
||||
|
||||
/* Used by drivers to declare a complete parsing tree for a single method that
|
||||
* differs only in having additional driver specific attributes.
|
||||
|
Reference in New Issue
Block a user