On Tue, 2009-01-13 at 14:23 -0700, Alex Williamson wrote:
> @@ -110,6 +111,36 @@ static void virtio_net_set_features(VirtIODevice *vdev, 
> uint32_t features)
>  #endif
>  }
>  
> +static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
> +{
> +    struct {
> +        uint8_t class;
> +        uint8_t cmd;
> +    } *ctrl;
> +    uint8_t *status;
> +    VirtQueueElement elem;
> +
> +    while (virtqueue_pop(vq, &elem)) {
> +        if ((elem.in_num < 1) | (elem.out_num < 1)) {
> +            fprintf(stderr, "virtio-net ctrl missing headers\n");
> +            exit(1);
> +        }
> +
> +        if (elem.out_sg[0].iov_len < sizeof(*ctrl) ||
> +            elem.out_sg[elem.in_num - 1].iov_len < sizeof(*status)) {
> +            fprintf(stderr, "virtio-net ctrl header not in correct 
> element\n");
> +            exit(1);
> +        }
> +
> +        ctrl = (void *)elem.out_sg[0].iov_base;
> +        status = (void *)elem.in_sg[elem.in_num - 1].iov_base;

These casts aren't needed - iov_base is a void pointer.

Cheers,
Mark.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to