> > This is a revert of 93b4f4050^ and 93b4f4050. > For a SpiceCharDeviceInstance, the base interface must be a > SpiceCharDeviceInterface instance, not a SpiceBaseInterface instance, or > spice-server code will end up reading out of bounds. > > vmc_state/vmc_write/vmc_read implementations also have to be provided. > --- > server/tests/test-display-base.c | 39 > +++++++++++++++++++++++++++++++++------ > 1 file changed, 33 insertions(+), 6 deletions(-) > > diff --git a/server/tests/test-display-base.c > b/server/tests/test-display-base.c > index 04c6403..55e37a5 100644 > --- a/server/tests/test-display-base.c > +++ b/server/tests/test-display-base.c > @@ -816,16 +816,43 @@ void test_add_display_interface(Test* test) > spice_server_add_interface(test->server, &test->qxl_instance.base); > } > > -static SpiceBaseInterface base = { > - .type = SPICE_INTERFACE_CHAR_DEVICE, > - .description = "test spice virtual channel char device", > - .major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR, > - .minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR, > +static int vmc_write(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, > + SPICE_GNUC_UNUSED const uint8_t *buf, > + int len) > +{ > + printf("%s: %d\n", __func__, len); > + return len; > +} > + > +static int vmc_read(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, > + SPICE_GNUC_UNUSED uint8_t *buf, > + int len) > +{ > + printf("%s: %d\n", __func__, len); > + return 0; > +} > + > +static void vmc_state(SPICE_GNUC_UNUSED SpiceCharDeviceInstance *sin, > + int connected) > +{ > + printf("%s: %d\n", __func__, connected); > +} > + > + > +static SpiceCharDeviceInterface vdagent_sif = { > + .base.type = SPICE_INTERFACE_CHAR_DEVICE, > + .base.description = "test spice virtual channel char device", > + .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR, > + .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR, > + .state = vmc_state, > + .write = vmc_write, > + .read = vmc_read, > + > }; > > SpiceCharDeviceInstance vdagent_sin = { > .base = { > - .sif = &base, > + .sif = &vdagent_sif.base, > }, > .subtype = "vdagent", > }; Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx> Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel