RE: [PATCH rdma-next 02/12] IB/uverbs: Move to new headers and make naming consistent

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

 



> -----Original Message-----
> From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Leon Romanovsky
> Sent: Thursday, March 8, 2018 12:19 PM
> To: Doug Ledford <dledford@xxxxxxxxxx>; Jason Gunthorpe
> <jgg@xxxxxxxxxxxx>
> Cc: Leon Romanovsky <leonro@xxxxxxxxxxxx>; RDMA mailing list <linux-
> rdma@xxxxxxxxxxxxxxx>; Aviad Yehezkel <aviadye@xxxxxxxxxxxx>; Boris
> Pismenny <borisp@xxxxxxxxxxxx>; Matan Barak <matanb@xxxxxxxxxxxx>;
> Yishai Hadas <yishaih@xxxxxxxxxxxx>
> Subject: [PATCH rdma-next 02/12] IB/uverbs: Move to new headers and
> make naming consistent
> 
> From: Matan Barak <matanb@xxxxxxxxxxxx>
> 
> Use macros to make names consistent in ioctl() uAPI:
> The ioctl() uAPI works with object-method hierarchy. The method part
> also states which handler should be executed when this method is called
> from user-space. Therefore, we need to tie method, method's id, method's
> handler and the object owning this method together.
> Previously, this was done through explicit developer chosen names.
> This makes grepping the code harder. Changing the method's name,
> method's handler and object's name to be automatically generated based
> on the ids.
> 
> The headers are split in a way so they be included and used by
> user-space. One header strictly contains structures that are used
> directly by user-space applications, where another header is used for
> internal library (i.e. libibverbs) to form the ioctl() commands.
> Other header simply contains the required general command structure.
> 
> Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
> Signed-off-by: Matan Barak <matanb@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/core/uverbs_std_types.c         | 139 ++++++++++++--------
>
> diff --git a/drivers/infiniband/core/uverbs_std_types.c
> b/drivers/infiniband/core/uverbs_std_types.c
> index df1360e6774f..99f971b6cc67 100644
> --- a/drivers/infiniband/core/uverbs_std_types.c
> +++ b/drivers/infiniband/core/uverbs_std_types.c
> @@ -210,15 +210,24 @@ static int
> uverbs_hot_unplug_completion_event_file(struct ib_uobject_file *uobj_
>  	return 0;
>  };
> 
> +#define UVERBS_METHOD(id)	uverbs_method_##id
> +#define UVERBS_HANDLER(id)	uverbs_handler_##id
> +
> +#define DECLARE_COMMON_METHOD(id, ...)	\
> +	DECLARE_UVERBS_METHOD(UVERBS_METHOD(id), id,
> UVERBS_HANDLER(id), ##__VA_ARGS__)
> +
> +#define DECLARE_COMMON_OBJECT(id, ...)	\
> +	DECLARE_UVERBS_OBJECT(UVERBS_OBJECT(id), id,
> ##__VA_ARGS__)

I applied this patch to my tree and noticed that the declarations for the
METHODS and OBJECTS and HANDLERs had changed.

I assumed that the above macros had been updated in the appropriate
header files.  When I tried to apply these "new" macros to my tree, I couldn't
compile.

So I cannot (easily) use the example of uverbs_std_verbs.c to set up my own
stuff, and if I do, I have to copy the above macros to my files, or decipher these
macros to figure out what I should use.

I.e uverbs_std_verbs.c can no longer be used as a reference of how to use
the IOCLT macros, and I think that that is a bad idea.

I would suggest that these helper macros does not help the clarity of this code.

Thanks,

Mike

--
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