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

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

 



On Wed, Mar 25, 2020 at 04:27:07PM +0800, Jason Wang wrote:
> +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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux