Re: [PATCH 7/9] RDMA/uverbs: Remove UA_FLAGS

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

 



On Wed, Jun 27, 2018 at 06:17:47AM -0600, Guy Levi(SW) wrote:
> > 
> >  /* Use in the '...' of any UVERBS_ATTR */
> 
> Add a comment that specify that '...' requires at list one argument
> or, alternatively, you can move the comma after __VA_ARGS__ from the
> caller macros to inside of each define below (and optional bit can
> be removed also).

No, need, it already works fine.

The new simplified macro is like this:

#define UVERBS_ATTR_PTR_IN(_attr_id, _type, ...)                               \
	(&(const struct uverbs_attr_def){                                      \
		.id = _attr_id,                                                \
		.attr = { .type = UVERBS_ATTR_TYPE_PTR_IN,                     \
			  _type,                                               \
			  __VA_ARGS__ } })

And when _VA_ARGS__ is empty we get expansion to

.attr = { .type = UVERBS_ATTR_TYPE_PTR_IN,                     
	  _type,
	  }

Which is legal C, trailing commas are allowed in a structure
initializer.

However, there is one typo here:

#define UVERBS_ATTR_IDR(_attr_id, _idr_type, _access, ...)                     \
	(&(const struct uverbs_attr_def){                                      \
		.id = _attr_id,                                                \
		.attr = {                                                      \
			.type = UVERBS_ATTR_TYPE_IDR,                          \
			.u.obj.obj_type = _idr_type,                           \
			.u.obj.access = _access,                               \
			__VA_ARGS__,                                           \
		} })

Where the trailing , after __VA_ARGS__ should not exist! Woops, fixed

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