Re: [PATCH rdma-next 14/21] IB/core: Introduce DECLARE_UVERBS_GLOBAL_METHODS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/14/2018 11:31 PM, Jason Gunthorpe wrote:
On Thu, May 03, 2018 at 04:37:08PM +0300, Leon Romanovsky wrote:
From: Yishai Hadas <yishaih@xxxxxxxxxxxx>

Introduce a new macro to be used for global methods on a singleton
object.

This macros sets internally the type_attrs to be NULL as such an object
can't be created.

Downstream patches from this series will use this macro.

Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
  include/rdma/uverbs_named_ioctl.h | 4 ++++
  include/rdma/uverbs_std_types.h   | 2 --
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/rdma/uverbs_named_ioctl.h b/include/rdma/uverbs_named_ioctl.h
index c5bb4ebdb0b0..228421f2a427 100644
+++ b/include/rdma/uverbs_named_ioctl.h
@@ -43,6 +43,7 @@
  #define _UVERBS_NAME(x, y)	_UVERBS_PASTE(x, y)
  #define UVERBS_METHOD(id)	_UVERBS_NAME(UVERBS_MODULE_NAME, _method_##id)
  #define UVERBS_HANDLER(id)	_UVERBS_NAME(UVERBS_MODULE_NAME, _handler_##id)
+#define UVERBS_OBJECT(id)	_UVERBS_NAME(UVERBS_MOUDLE_NAME, _object_##id)
#define DECLARE_UVERBS_NAMED_METHOD(id, ...) \
  	DECLARE_UVERBS_METHOD(UVERBS_METHOD(id), id, UVERBS_HANDLER(id), ##__VA_ARGS__)
@@ -56,6 +57,9 @@
  #define DECLARE_UVERBS_NAMED_OBJECT(id, ...)	\
  	DECLARE_UVERBS_OBJECT(UVERBS_OBJECT(id), id, ##__VA_ARGS__)
+#define DECLARE_UVERBS_GLOBAL_METHODS(_name, ...) \
+	DECLARE_UVERBS_NAMED_OBJECT(_name, NULL, ##__VA_ARGS__)

I don't really understand, and don't like that a 'global method' is
associated with an object of some type. It makes no sense, these are
not 'static' methods in a C++ sense, but true 'free functions', so
they shouldn't be linked to an object.

This usage is not new, it just follows the usage of UVERBS_OBJECT_DEVICE but hides the NULL.

Same question applies to the UVERBS_OBJECT_DEVICE too, why does it
exist at all?


good question, this patch just followed current schema.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux