[PATCH vhost v9 3/6] virtio: find_vqs: pass struct instead of multi parameters
Michael S. Tsirkin
mst at redhat.com
Thu Jun 20 02:14:24 PDT 2024
On Thu, Jun 20, 2024 at 05:00:49PM +0800, Xuan Zhuo wrote:
> > > @@ -226,21 +248,37 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
> > >
> > > static inline
> > > int virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
> > > - struct virtqueue *vqs[], vq_callback_t *callbacks[],
> > > - const char * const names[],
> > > - struct irq_affinity *desc)
> > > + struct virtqueue *vqs[], vq_callback_t *callbacks[],
> > > + const char * const names[],
> > > + struct irq_affinity *desc)
> > > {
> > > - return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names, NULL, desc);
> > > + struct virtio_vq_config cfg = {};
> > > +
> > > + cfg.nvqs = nvqs;
> > > + cfg.vqs = vqs;
> > > + cfg.callbacks = callbacks;
> > > + cfg.names = (const char **)names;
> >
> >
> > Casting const away? Not safe.
>
>
>
> Because the vp_modern_create_avq() use the "const char *names[]",
> and the virtio_uml.c changes the name in the subsequent commit, so
> change the "names" inside the virtio_vq_config from "const char *const
> *names" to "const char **names".
I'm not sure I understand which commit you mean,
and this kind of change needs to be documented, but it does not matter.
Don't cast away const.
--
MST
More information about the linux-um
mailing list