Re: [Spice-devel] [PATCH spice-server] red-replay-qxl: Fix replay on 32 bit systems

2019-08-09 Thread Frediano Ziglio
ping > > ping > > > > > On 32 systems pointers are 32 bit while QXLPHYSICAL is always > > 64 bit. > > Using pointer -> intptr_t -> QXLPHYSICAL conversion cause pointers > > to have higher 32 bit set to 1 if the address is >= 0x8000. > > This is possible depending on address space. > > The Q

Re: [Spice-devel] [PATCH spice-server] Use (u)intptr_t for virtual addresses

2019-08-09 Thread Frediano Ziglio
ping > > ping > > > > > On LLP64 platforms (like Windows) a virtual address cannot > > be represented by a "unsigned long" type, so use uintptr_t > > which is defined as a integral type large like a pointer. > > "address_delta" is a difference of pointers so use same > > type size. > > > > Sig

Re: [Spice-devel] [PATCH spice-server v2 1/4] spicevmc: Do not use RedCharDevice pipe items handling

2019-08-09 Thread Frediano Ziglio
ping > > ping > > > > > ping > > > > > > > > ping the series > > > > > > > > > > > As we don't use any token there's no reason to not queue directly > > > > instead > > > > of passing through RedCharDevice. > > > > This will make easier to limit the queue which currently is unlimited. > > >

Re: [Spice-devel] [PATCH spice-server v2 1/2] char-device: Don't use RedClient API

2019-08-09 Thread Frediano Ziglio
ping > > ping > > > > > ping > > > > > > > > ping > > > > > > > ping > > > > > > > > > > > > > > ping the series > > > > > > > > > > > > > > > > > RedClient was an opaque structure for RedCharDevice. > > > > > > It started to be used when RedsState started to contain all > > > > > > the

Re: [Spice-devel] [PATCH spice-server 1/2] replay: Remove some goto statement

2019-08-09 Thread Frediano Ziglio
ping > > ping the series > > > > > Signed-off-by: Frediano Ziglio > > --- > > server/tests/replay.c | 18 ++ > > 1 file changed, 6 insertions(+), 12 deletions(-) > > > > diff --git a/server/tests/replay.c b/server/tests/replay.c > > index e3ef7bf15..992f26d63 100644 > > --- a

Re: [Spice-devel] [PATCH spice-gtk 2/2] build: Replace "join_paths" with "/" operator

2019-08-09 Thread Frediano Ziglio
ping > > Supported by Meson 0.49. > New syntax is shorter. > > Signed-off-by: Frediano Ziglio > --- > doc/reference/meson.build | 18 +- > man/meson.build | 2 +- > meson.build | 8 > src/meson.build | 10 +- > vapi/meson.bui

Re: [Spice-devel] [PATCH spice-gtk] Use "#pragma once" instead of preprocessor guards

2019-08-09 Thread Frediano Ziglio
ping > > Guards currently are quite different in format. > Unify updating to "#pragma once" syntax. This syntax is used > by GTK tools too. > To avoid possible regression public headers are left untouched. > > Signed-off-by: Frediano Ziglio > --- > src/bio-gio.h | 5 +

Re: [Spice-devel] [PATCH spice-gtk 1/3] usb-backend: Cache isochronous value

2019-08-09 Thread Frediano Ziglio
ping the series > > Allows to remove _SpiceUsbDevice structure. > _SpiceUsbDevice is only caching this value from SpiceUsbBackendDevice. > > Signed-off-by: Frediano Ziglio > --- > src/usb-backend.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/src/usb-backend.c b/src/usb-b

[Spice-devel] [PATCH spice-gtk v2 33/33] CI: Add usbredir packages to Windows

2019-08-09 Thread Frediano Ziglio
Allows Windows job to build USB code part to make sure it compiles correctly. Signed-off-by: Frediano Ziglio --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8bcef65d..e2d1c55b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,6 +

[Spice-devel] [PATCH spice-gtk v2 32/33] CI: Add --werror

2019-08-09 Thread Frediano Ziglio
Give errors on warnings, we want the code to compile without warnings, at least with CI. Signed-off-by: Frediano Ziglio --- .gitlab-ci.yml | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa70f7ad..8bcef65d 100644 --- a/.gitlab-

[Spice-devel] [PATCH spice-gtk v2 30/33] usb-redir: command-line option to create emulated CD drive

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich Added command-line option for sharing emulated CD devices. It uses property interface of usb-device-manager to create CD, this is a temporary solution until public API of usb-device-manager defined for shared CD management from both GUI and command line. Signed-off-by: Yur

[Spice-devel] [PATCH spice-gtk v2 31/33] usb-redir: Add base test for cd-emulation

2019-08-09 Thread Frediano Ziglio
Just allocate and free to test for base leaks and reference counting. Signed-off-by: Frediano Ziglio --- tests/cd-emu.c| 92 +++ tests/meson.build | 4 +++ 2 files changed, 96 insertions(+) create mode 100644 tests/cd-emu.c diff --git a/tests/cd

[Spice-devel] [PATCH spice-gtk v2 29/33] usb-redir: enable redirection of emulated CD drive

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich Add implementation of emulated device to build. Now it is possible to create emulated CD devices. Signed-off-by: Yuri Benditovich --- src/meson.build | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/meson.build b/src/meson.build index fe19c160..3837a9dc 100

[Spice-devel] [PATCH spice-gtk v2 27/33] fixup! usb-redir: add implementation of emulated CD device

2019-08-09 Thread Frediano Ziglio
Avoids double setting a variable. Some code analyzers could complain about it --- src/usb-device-cd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usb-device-cd.c b/src/usb-device-cd.c index b03d6838..03b8f5ee 100644 --- a/src/usb-device-cd.c +++ b/src/usb-device-cd.c @@

[Spice-devel] [PATCH spice-gtk v2 28/33] fixup! usb-redir: add implementation of emulated CD device

2019-08-09 Thread Frediano Ziglio
Avoid file_object, it's not necessary to keep it. --- src/usb-device-cd.c | 116 +--- 1 file changed, 55 insertions(+), 61 deletions(-) diff --git a/src/usb-device-cd.c b/src/usb-device-cd.c index 03b8f5ee..c33bb290 100644 --- a/src/usb-device-cd.c +++ b/sr

[Spice-devel] [PATCH spice-gtk v2 23/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Clear stream pointer. As we set loaded to FALSE there's no reason to keep the potential stream. --- src/cd-scsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 62c58942..25842b3b 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -650,6 +650,8 @@ int cd_s

[Spice-devel] [PATCH spice-gtk v2 26/33] fixup! usb-redir: add implementation of emulated CD device

2019-08-09 Thread Frediano Ziglio
Fix style indentation --- src/usb-device-cd.c | 71 ++--- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/usb-device-cd.c b/src/usb-device-cd.c index 3c57185f..b03d6838 100644 --- a/src/usb-device-cd.c +++ b/src/usb-device-cd.c @@ -461,27

[Spice-devel] [PATCH spice-gtk v2 24/33] usb-redir: add implementation of emulated CD device

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich This module contains implementation of emulated device interface for shared CD. Signed-off-by: Yuri Benditovich --- src/usb-device-cd.c | 790 src/usb-device-cd.h | 37 +++ 2 files changed, 827 insertions(+) create mode 1006

[Spice-devel] [PATCH spice-gtk v2 16/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Use g_free instead of free and g_clear_pointer. Do not mix free and g_free, on some platform or with some settings can be quite different function or heap. --- src/cd-scsi.c | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c inde

[Spice-devel] [PATCH spice-gtk v2 18/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Retain stream using reference counting. Allow caller to free the object. --- src/cd-scsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index f9e8441c..1cb268bf 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -433,6 +433,7 @@ void cd_scsi

[Spice-devel] [PATCH spice-gtk v2 21/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
sub_page field in MODE SENSE 10 command is 8 bit, not 4. --- src/cd-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 3c1f0b3e..d623d665 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -1443,7 +1443,7 @@ static void cd_scsi_cmd_mode_se

[Spice-devel] [PATCH spice-gtk v2 22/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Set correctly loaded flag in case media_params is NULL. In case the pointer is NULL the action is the same as an unload. --- src/cd-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index d623d665..62c58942 100644 --- a/src/cd-scsi.c +++ b/s

[Spice-devel] [PATCH spice-gtk v2 19/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Remove potential integer overflow. count can be specified with all bits. --- src/cd-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 1cb268bf..d039e3c4 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -2545,7 +2545,7 @@ static void cd_

[Spice-devel] [PATCH spice-gtk v2 20/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Do not return negative values from scsi_cdb_length. The value get written in cbd_len field with is unsigned and use to represent the used length of a buffer, avoid possible potential future overflows due to it. --- src/cd-scsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --g

[Spice-devel] [PATCH spice-gtk v2 25/33] fixup! usb-redir: add implementation of emulated CD device

2019-08-09 Thread Frediano Ziglio
Fix compile, update function definition due to another previous follow up of another commit. --- src/usb-device-cd.c | 2 +- src/usb-device-cd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usb-device-cd.c b/src/usb-device-cd.c index b5193d1e..3c57185f 100644 --- a/sr

[Spice-devel] [PATCH spice-gtk v2 17/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Free all possible data in cd_scsi_target_free. Avoid some leaks. --- src/cd-scsi.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 66e4ddef..f9e8441c 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -423,10 +423,19 @@ CdScsi

[Spice-devel] [PATCH spice-gtk v2 13/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Make some parameter constant. Make clear they don't change the passed value --- src/cd-scsi.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 9c5616b0..dbb78e54 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -432,12 +432,12 @@ v

[Spice-devel] [PATCH spice-gtk v2 15/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Reuse MIN macro. --- src/cd-scsi.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 616c65da..bce7191b 100644 --- a/src/cd-scsi.c +++ b/src/cd-scsi.c @@ -849,8 +849,7 @@ static void cd_scsi_cmd_request_sense(CdScs

[Spice-devel] [PATCH spice-gtk v2 09/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Minor, printf format --- src/cd-usb-bulk-msd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cd-usb-bulk-msd.c b/src/cd-usb-bulk-msd.c index 95365163..387a42a7 100644 --- a/src/cd-usb-bulk-msd.c +++ b/src/cd-usb-bulk-msd.c @@ -306,7 +306,7 @@ static int parse_usb_msd_cmd(

[Spice-devel] [PATCH spice-gtk v2 01/33] usb-redir: define interfaces to support emulated devices

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich SpiceUsbBackendDevice structure is extended to support additional kind of device that is emulated by Spice-GTK and not present locally (and does not have libusb_device), such device has instead pointer to SpiceUsbEmulatedDevice abstract structure. Specific implementation of

[Spice-devel] [PATCH spice-gtk v2 11/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Filter cmd_len bits, specifications state it's a 5 bit field Although higher bits of the byte are reserved and should be zero filter them out. Also accept 16 as length. --- src/cd-usb-bulk-msd.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cd-usb-bulk-msd.c b/src

[Spice-devel] [PATCH spice-gtk v2 12/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Avoid G_GUINT32_FORMAT. We don't support architectures less than 32 bit. Due to C type promotion %u is surely fine. --- src/cd-scsi.c | 244 -- 1 file changed, 116 insertions(+), 128 deletions(-) diff --git a/src/cd-scsi.c b/src/cd-scsi.c index 2a35

[Spice-devel] [PATCH spice-gtk v2 02/33] fixup! usb-redir: define interfaces to support emulated devices

2019-08-09 Thread Frediano Ziglio
Change reference counting semantic for emulated devices. Make the same as not emulated. This fix a leak if spice_usb_backend_device_eject is not called. Consistently the reference counter for SpiceUsbBackendDevice is now the number of owning pointers. --- src/usb-backend.c | 19 ++---

[Spice-devel] [PATCH spice-gtk v2 14/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Remove num_luns, fix cd_scsi_cmd_report_luns. num_luns was used only in cd_scsi_cmd_report_luns. In cd_scsi_cmd_report_luns the length of the list is expressed in bytes and the format of the LUN can be quite complicated (the more simple is used now). --- src/cd-scsi.c | 48 +---

[Spice-devel] [PATCH spice-gtk v2 07/33] fixup! usb-redir: extend USB backend to support emulated devices

2019-08-09 Thread Frediano Ziglio
--- src/usb-backend.c | 79 +-- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/src/usb-backend.c b/src/usb-backend.c index bed431c3..9aee6c7d 100644 --- a/src/usb-backend.c +++ b/src/usb-backend.c @@ -579,8 +579,7 @@ static int check_ede

[Spice-devel] [PATCH spice-gtk v2 05/33] usb-redir: do not use spice_usb_acl_helper for emulated devices

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich Signed-off-by: Yuri Benditovich Acked-by: Frediano Ziglio --- src/channel-usbredir.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c index 8d4cd664..8fd6b41c 100644 ---

[Spice-devel] [PATCH spice-gtk v2 10/33] fixup! usb-redir: add files for SCSI and USB MSC implementation

2019-08-09 Thread Frediano Ziglio
Remove some written only fields --- src/cd-scsi.h | 1 - src/cd-usb-bulk-msd.c | 5 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/cd-scsi.h b/src/cd-scsi.h index 65242444..c058a66e 100644 --- a/src/cd-scsi.h +++ b/src/cd-scsi.h @@ -58,7 +58,6 @@ typedef struct CdS

[Spice-devel] [PATCH spice-gtk v2 06/33] usb-redir: extend USB backend to support emulated devices

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich Redirection of emulated devices requires special approach, as usbredirhost can't be used for that (it works only with libusb devices). For emulated devices we create instance of usbredirparser that implements USB redirection protocol. In order to work with the same set of p

[Spice-devel] [PATCH spice-gtk v2 03/33] fixup! usb-redir: define interfaces to support emulated devices

2019-08-09 Thread Frediano Ziglio
Style --- src/usb-backend.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/usb-backend.c b/src/usb-backend.c index de2b55ec..7f9fcc17 100644 --- a/src/usb-backend.c +++ b/src/usb-backend.c @@ -200,7 +200,7 @@ static int compare_dev_list_fire_callback(Spi

[Spice-devel] [PATCH spice-gtk v2 00/33] CD emulation follow ups

2019-08-09 Thread Frediano Ziglio
Hi, updated series and proposed some follow ups. Some patches are just styles, some minor fixes. One is the proposed change to reference counting of SpiceUsbBackendDevice already discussed and sent on ML. Added also a test to test some leaks (to fully detect it requires the configuration of some

[Spice-devel] [PATCH spice-gtk v2 04/33] usb-redir: move implementation of device description to USB backend

2019-08-09 Thread Frediano Ziglio
From: Yuri Benditovich For local USB device the USB backend returns the same device description as spice-usb-manager did, for emulated devices it uses the description provided by device's implementation. Signed-off-by: Yuri Benditovich Acked-by: Frediano Ziglio --- src/usb-backend.c|

Re: [Spice-devel] [PATCH spice-gtk] fixup! usb-redir: define interfaces to support emulated devices

2019-08-09 Thread Frediano Ziglio
> > On Thu, Aug 8, 2019 at 1:41 PM Frediano Ziglio wrote: > > > > Change reference counting semantic for emulated devices. > > Make the same as not emulated. > > This fix a leak if spice_usb_backend_device_eject is not called. > > Consistently the reference counter for SpiceUsbBackendDevice is >

Re: [Spice-devel] [PATCH spice-gtk] fixup! usb-redir: define interfaces to support emulated devices

2019-08-09 Thread Yuri Benditovich
On Thu, Aug 8, 2019 at 1:41 PM Frediano Ziglio wrote: > > Change reference counting semantic for emulated devices. > Make the same as not emulated. > This fix a leak if spice_usb_backend_device_eject is not called. > Consistently the reference counter for SpiceUsbBackendDevice is > now the number