Re: [PATCH 01/13] RDMA/verbs: Convert struct ib_send_wr conversion functions into macros

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

 



On Fri, Jul 06, 2018 at 10:17:24AM -0700, Bart Van Assche wrote:
> Since the C programming language does not allow to define a single
> function of which the constness of the return type depends on the
> constness of an argument type, convert the struct ib_send_wr
> conversion functions into macros. That will allow these conversion
> functions to be used both in a context where the send work request
> is modified and where it is not modified. The iSER initiator driver
> is the only driver that uses one of these functions to obtain a
> modifiable pointer to a work request, namely as follows:

This seems confounding.

container_of is not const preserving, so it happily strips the const
off the input pointer, which is what the inline wrappers would do if they
were marked to accept a const - so why convert them to #define's?

I'm actually a bit surprised this works, I think it might be a bug in
the container_of macro's type checking that it is ignoring the const
qualifier on the input pointer - not totally sure I want to rely on that

I'd like this alot better if container_of could propogate const, but
can't think of a way to achieve that.

Considering these limitations, why are you making this series?

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