Re: [PATCH 1/6] relay: allow the use of const callback structs

2020-11-23 Thread Jani Nikula
On Thu, 19 Nov 2020, Christoph Hellwig wrote: > But taking one step back: All instances implement create_buf_file > and remove_buf_file, which makes sense as that is the prime aim > of these methods. So there is no point in making those optional. > subbuf_start_callback is overriden by two

Re: [PATCH 1/6] relay: allow the use of const callback structs

2020-11-19 Thread Christoph Hellwig
On Thu, Nov 19, 2020 at 08:11:20AM +, Christoph Hellwig wrote: > Please also add a patch to mark all rchan_callbacks instances const > while you're at it. Oops, I just noticed you actually sent that one.

Re: [PATCH 1/6] relay: allow the use of const callback structs

2020-11-19 Thread Christoph Hellwig
> +/* > + * rchan_callback wrappers. Call the callbacks if available, otherwise fall > back > + * to default behaviour. > + */ This adds an overly long line. That being said this behavior is pretty normal for kernel APIs, so I'm not even sure we need it at all. > + > +/* > + * subbuf_start()

[PATCH 1/6] relay: allow the use of const callback structs

2020-11-18 Thread Jani Nikula
None of the relay users require the use of mutable structs for callbacks, however the relay code does. Instead of assigning default callbacks when there is none, add callback wrappers to conditionally call the client callbacks if available, and fall back to default behaviour (typically no-op)