[Spice-devel] [PATCH] Do endian swapping.
Christophe Fergeau
cfergeau at redhat.com
Wed Dec 14 16:29:43 UTC 2016
On Wed, Dec 14, 2016 at 04:43:11PM +0100, Michal Suchánek wrote:
> On Wed, 14 Dec 2016 15:32:11 +0100
> Christophe Fergeau <cfergeau at redhat.com> wrote:
>
> > Hey,
> >
> > On Mon, Nov 28, 2016 at 03:08:34PM +0100, Michal Suchanek wrote:
> > > This allows running big endian and little endian guest side by side
> > > using cut&paste between them.
> > >
> > > There is some general design idea that swapping should come as
> > > cloce to virtio_read/virtio_write as possible. In particular, the
> > > protocol between vdagent and vdagentd is guest-specific and in
> > > native endian. With muliple layers of headers this is a bit tricky.
> > > A few message types have to be swapped fully before passing through
> > > vdagentd.
> > >
> > > Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> > > ---
> > > src/vdagentd/uinput.c | 4 +++
> > > src/vdagentd/vdagentd.c | 68
> > > ++++++++++++++++++++++++++++++++++------------
> > > src/vdagentd/virtio-port.c | 35 +++++++++++++++--------- 3 files
> > > changed, 76 insertions(+), 31 deletions(-)
> > >
> > > diff --git a/src/vdagentd/uinput.c b/src/vdagentd/uinput.c
> > > index e2966c4..21292cb 100644
> > > --- a/src/vdagentd/uinput.c
> > > +++ b/src/vdagentd/uinput.c
> > > @@ -200,6 +200,10 @@ void vdagentd_uinput_do_mouse(struct
> > > vdagentd_uinput **uinputp, };
> > > int i, down;
> > >
> > > + mouse->x = le32toh(mouse->x);
> > > + mouse->y = le32toh(mouse->y);
> > > + mouse->buttons = le32toh(mouse->buttons);
> > > +
> > > if (*uinputp) {
> > > if (mouse->display_id >= uinput->screen_count) {
> >
> > No swapping of mouse->display_id?
>
> /usr/include/spice-1/spice/vd_agent.h: uint8_t display_id;
> > and would be missing a
> > vdata->nchannels byteswap if I'm not mistaken.
>
> /usr/include/spice-1/spice/vd_agent.h: uint8_t nchannels;
>
Ah, my bad, sorry for the noise!
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161214/7f0f63a6/attachment-0001.sig>
More information about the Spice-devel
mailing list