Thread (16 messages) 16 messages, 2 authors, 2020-03-26

Re: [PATCH V8 5/9] vDPA: introduce vDPA bus

From: Jason Wang <jasowang@redhat.com>
Date: 2020-03-26 05:52:07
Also in: kvm, lkml, netdev

On 2020/3/25 下午8:29, Jason Gunthorpe wrote:
On Wed, Mar 25, 2020 at 04:27:07PM +0800, Jason Wang wrote:
quoted
+struct vdpa_device *__vdpa_alloc_device(struct device *parent,
+					const struct vdpa_config_ops *config,
+					size_t size);
+
+#define vdpa_alloc_device(dev_struct, member, parent, config)   \
+			  container_of(__vdpa_alloc_device( \
+				       parent, config, \
+				       sizeof(struct dev_struct) + \
+				       BUILD_BUG_ON_ZERO(offsetof( \
+				       struct dev_struct, member))), \
+				       struct dev_struct, member)
This all looks robust now, one minor remark is to not do 'struct
dev_struct' here so the caller has to do

    vdpa_alloc_device(struct foo, vpda, ...)

Which suggests to the reader something unusual is happening

Jason

Yes, that's better.

But my understanding is that this can be done on top.

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help