[Spice-devel] [PATCH 28/35] vdi port: redesign.
Alon Levy
alevy at redhat.com
Mon May 17 02:48:20 PDT 2010
Hi,
As long as we are changing the way SpiceVDIPortPlug (plug) works,
we should have the read callback direction reversed:
struct SpiceVDIPortInterface {
+ int (*have_data)(SpiceVDIPortInstance *sin, uint8_t *buf, int len);
- int (*read)(SpiceVDIPortInstance *sin, uint8_t *buf, int len);
};
Reason/Explanation:
Right now the flow is like this (this is with spice-vmc, it's the same logic as
the current vdi_port, only difference is the originating call)
| guest data arives
| spice_vmc_have_data / vdi_port
| plug->wakeup spice_vmc_interface_read
| | ^
------V--- qemu above spice below -----|-------
| spice_server_vdi_port_wakeup |
| read_from_vdi_port-------------------/
Where spice_vmc_interface_read will be called one or more times until
it returns 0 (no more bytes left).
Instead, I think it would be cleaner to have:
| guest data arives
| spice_vmc_have_data
| plug->have_data
| |
-----V---- qemu above spice below --
| spice_server_vdi_port_have_data
To check this I'll have to compile the vdi_port driver, since back
porting the spice_vmc.c file from qemu-kvm-rhel6 would be too much
work (there is not virtio-serial in current qemu used in upstrea
spice). But I'll try to do it and send the patch over.
Actually, the movement of write to the plug doesn't look right - the
interface is basically a table that is filled by the user, in this
case qemu. So the write function is called by spice, not by qemu. So
why is it in the plug? The wakeup is correctly in the plug, since it
is called by qemu. So is the have_data I'm proposing. If you are making
them one and the same it's ok I guess, just need to make sure this
is understood.
Alon
More information about the Spice-devel
mailing list