aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/uverbs_named_ioctl.h
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-07-04 08:50:28 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-07-04 13:47:01 -0600
commit9a119cd597769e0dd432110361ed1deec729ac06 (patch)
tree6530b4315d47433a702bdf68ce26d3f82f868ef0 /include/rdma/uverbs_named_ioctl.h
parentRDMA/uverbs: Simplify UVERBS_OBJECT and _TREE family of macros (diff)
downloadlinux-dev-9a119cd597769e0dd432110361ed1deec729ac06.tar.xz
linux-dev-9a119cd597769e0dd432110361ed1deec729ac06.zip
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>
Diffstat (limited to 'include/rdma/uverbs_named_ioctl.h')
-rw-r--r--include/rdma/uverbs_named_ioctl.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/rdma/uverbs_named_ioctl.h b/include/rdma/uverbs_named_ioctl.h
index 3ee045d7da4c..2eb1767042af 100644
--- a/include/rdma/uverbs_named_ioctl.h
+++ b/include/rdma/uverbs_named_ioctl.h
@@ -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.