Re: [PATCH for-next 6/7] IB/core: Declare all common IB types

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

 



On Tue, Jan 17, 2017 at 07:37:30PM +0200, Matan Barak wrote:
> >> +DECLARE_UVERBS_TYPE(uverbs_type_comp_channel,
> >> +                 &UVERBS_TYPE_ALLOC_FD(0, sizeof(struct ib_uobject) + sizeof(struct ib_uverbs_event_file),
> >> +                                       uverbs_free_event_file,
> >> +                                       &uverbs_event_fops,
> >> +                                       "[infinibandevent]",
> >> O_RDONLY));
> >
> > Really hate these macros.
> >
> > const struct ib_uobject_type uverbs_type_comp_channel = {
> >        .size = sizeof(struct ib_uverbs_event_file,
> >        .destroy = uverbs_destroy_event_file, // destroy = release device resources!!
> >        .fd = {
> >           .fops = &uverbs_event_fops,
> >           .name = "[infinibandevent]"
> >        },
> > };
> >
> > If you can't do it without macros something else is wrong.
> >
> 
> We could initialize directly of course, but the code will be more
> complex than what you proposed (there are some structure
> nestings and pointers there).

Why would it be more complex? That does what the macro does. Don't
make it more complex ;)

> Anyway, what's wrong with this macro? It's pretty straight forward,
> it's a common schema in this code and it even checks
> that the object_size makes sense.

There are too many parameters, it is too hard to casually follow, and
it doesn't fit the typical kernel model for this kind of thing.

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