Re: [Spice-devel] [PATCH v2] fixup! Change Drawable->pipes from Ring to GList

2016-09-16 Thread Jonathon Jongsma
On Fri, 2016-09-16 at 12:57 -0400, Frediano Ziglio wrote: > > > > > > Fix potential infinite loop > > --- > >  server/stream.c | 11 --- > >  1 file changed, 4 insertions(+), 7 deletions(-) > > > > diff --git a/server/stream.c b/server/stream.c > > index 934b236..49b5910 100644 > > --- a/

Re: [Spice-devel] [PATCH v2] fixup! Change Drawable->pipes from Ring to GList

2016-09-16 Thread Frediano Ziglio
> > Fix potential infinite loop > --- > server/stream.c | 11 --- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/server/stream.c b/server/stream.c > index 934b236..49b5910 100644 > --- a/server/stream.c > +++ b/server/stream.c > @@ -331,11 +331,10 @@ void detach_strea

[Spice-devel] [PATCH v2] fixup! Change Drawable->pipes from Ring to GList

2016-09-16 Thread Jonathon Jongsma
Fix potential infinite loop --- server/stream.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server/stream.c b/server/stream.c index 934b236..49b5910 100644 --- a/server/stream.c +++ b/server/stream.c @@ -331,11 +331,10 @@ void detach_stream(DisplayChannel *displ

Re: [Spice-devel] [PATCH] fixup! Change Drawable->pipes from Ring to GList

2016-09-16 Thread Jonathon Jongsma
On Fri, 2016-09-16 at 12:25 -0400, Frediano Ziglio wrote: > > > > > > Fix potential infinite loop > > --- > > You can still introduce a foreach macro if you'd like, but this > > should fix > > the > > infinite loop for now. > > > > Macro could be introduced back later if we decide to. > > > >

Re: [Spice-devel] [PATCH] fixup! Change Drawable->pipes from Ring to GList

2016-09-16 Thread Frediano Ziglio
> > Fix potential infinite loop > --- > You can still introduce a foreach macro if you'd like, but this should fix > the > infinite loop for now. > Macro could be introduced back later if we decide to. > server/stream.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --

[Spice-devel] Necessary code ??

2016-09-16 Thread Frediano Ziglio
Hi, I came to this code in dcc.c (dcc_clear_surface_drawables_from_pipe function): /* * in case that the pipe didn't contain any item that is dependent on the surface, but * there is one during sending. Use a shorter timeout, since it is just one item */ return red_chann

[Spice-devel] [PATCH] fixup! Change Drawable->pipes from Ring to GList

2016-09-16 Thread Jonathon Jongsma
Fix potential infinite loop --- You can still introduce a foreach macro if you'd like, but this should fix the infinite loop for now. server/stream.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/stream.c b/server/stream.c index 934b236..be3e437 100644 --- a/ser

Re: [Spice-devel] [PATCH] fixup! RedChannelClient: store pipe items in a GQueue

2016-09-16 Thread Jonathon Jongsma
On Fri, 2016-09-16 at 10:05 +0100, Frediano Ziglio wrote: > Minor changes: > - use same name for dcc_add_surface_area_image argument in header >   and source; > - avoid using 2 variable in a for loop, is not much readable and >   confusing. This also was fixing a regression quite hard to spot >   s

Re: [Spice-devel] [PATCH v2 8/9] Change RedCharDevice::write_queue to GQueue

2016-09-16 Thread Jonathon Jongsma
On Thu, 2016-09-15 at 14:51 -0500, Jonathon Jongsma wrote: > On Thu, 2016-09-15 at 16:55 +0200, Pavel Grunt wrote: > > > > Hey, > > > > On Wed, 2016-09-14 at 11:53 -0500, Jonathon Jongsma wrote: > > > > > > > > > Change a couple more Rings to GQueue > > > --- > > > Changes in v2: > > >  - use G

[Spice-devel] [RFC PATCH 2/2] Introduce some macro to simplify iteration on GList

2016-09-16 Thread Frediano Ziglio
Noting that coding by hand these loop introduced some regression I'm trying to introduce back from macros. Before trying something harder to make possible to bind the type of the content I'm trying some simple macro as were before. I added the type to avoid some blindly void* casts. Also the GListI

Re: [Spice-devel] [PATCH 2/2] Optimise client pipe passing pipe position instead of data

2016-09-16 Thread Frediano Ziglio
> > On Wed, 2016-09-14 at 06:30 -0400, Frediano Ziglio wrote: > > > > > > > > > I haven't looked very carefully at the changes, but a few comments > > > about readability: > > > > > > On Mon, Sep 12, 2016 at 04:32:03PM +0100, Frediano Ziglio wrote: > > > > > > > > This avoid to have the search

[Spice-devel] [RFC PATCH 1/2] RedChannel: Add FOREACH_CHANNEL and use it to iterate

2016-09-16 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/red-channel.c | 50 +++--- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/server/red-channel.c b/server/red-channel.c index 474fe68..166221e 100644 --- a/server/red-channel.c +++ b/server/red-ch

[Spice-devel] [RFC PATCH 0/2] Reintroduce some macro to iterate containers

2016-09-16 Thread Frediano Ziglio
With the introduction of GList/GQueue these macro were removed at the expense of some minor regressions. The first patch was started time ago and resemble more to old macro while the second try to use some more safe way. Frediano Ziglio (2): RedChannel: Add FOREACH_CHANNEL and use it to iterate

Re: [Spice-devel] [vdagent-linux v2 4/5] build-sys: remove prefix from filenames

2016-09-16 Thread Victor Toso
Hi, On Fri, Sep 16, 2016 at 10:38:56AM -0400, Frediano Ziglio wrote: > > > > --- > > .gitignore | 6 + > > Makefile.am| 28 > > +++--- > > src/vdagent/{vdagent-audio.c => audio.c} | 2

Re: [Spice-devel] [vdagent-linux v2 4/5] build-sys: remove prefix from filenames

2016-09-16 Thread Frediano Ziglio
> > --- > .gitignore | 6 + > Makefile.am| 28 > +++--- > src/vdagent/{vdagent-audio.c => audio.c} | 2 +- > src/vdagent/{vdagent-audio.h => audio.h} | 4 ++-- > src/vdagent

Re: [Spice-devel] [PATCH 2/2] fixup! Add DisplayChannelPrivate struct

2016-09-16 Thread Jonathon Jongsma
On Fri, 2016-09-16 at 10:39 +0100, Frediano Ziglio wrote: > Remove added FIXME introducing an helper function. > > Signed-off-by: Frediano Ziglio > --- >  server/display-channel.c | 12 >  server/display-channel.h |  2 ++ >  server/red-worker.c  | 16 ++-- >  3 files ch

Re: [Spice-devel] [PATCH v2 1/2] Improve encapsulation of DisplayChannel

2016-09-16 Thread Frediano Ziglio
> > > > Add a couple new functions to the header so that they can be called by > > other objects rather than poking into the internals of the struct. > > --- > > server/dcc-send.c| 16 +-- > > server/display-channel.c | 71 > > > >

Re: [Spice-devel] [PATCH] fixup! Improve encapsulation of DisplayChannel

2016-09-16 Thread Pavel Grunt
On Fri, 2016-09-16 at 13:26 +0100, Frediano Ziglio wrote: > Style fix > > Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt > --- >  server/display-channel.c | 4 ++-- >  server/display-channel.h | 3 +-- >  2 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/server/display-chann

[Spice-devel] [PATCH] fixup! Improve encapsulation of DisplayChannel

2016-09-16 Thread Frediano Ziglio
Style fix Signed-off-by: Frediano Ziglio --- server/display-channel.c | 4 ++-- server/display-channel.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/server/display-channel.c b/server/display-channel.c index 56bb029..4e643dd 100644 --- a/server/display-channel.c +++ b/

[Spice-devel] [PATCH v3 4/8] replay: Move error check

2016-09-16 Thread Frediano Ziglio
Do the check after replay_fscanf to make sure everything is fine before calling red_replay_compat_drawable or red_replay_native_drawable. Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/red-replay-qxl.c b/serve

[Spice-devel] [PATCH v3 6/8] replay: Propagate error correctly in replay_fread

2016-09-16 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c index 6914c17..6950f98 100644 --- a/server/red-replay-qxl.c +++ b/server/red-replay-qxl.c @@ -57,16 +57,14 @@

[Spice-devel] [PATCH v3 8/8] replay: use unsigned in formatting

2016-09-16 Thread Frediano Ziglio
Avoid negative syntax. Also could prevent some memory problem is number get too big. Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c index 1442686..69

[Spice-devel] [PATCH v3 7/8] replay: Use proper formatting for scanf family

2016-09-16 Thread Frediano Ziglio
Currently on Linux PRIu64 and SCNu64 are the same but just to make sure in the future use the correct macros. Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c i

[Spice-devel] [PATCH v3 3/8] replay: Detect errors from red_replay_data_chunks

2016-09-16 Thread Frediano Ziglio
Change the return to ssize_t to be able to distinguish from empty buffer to error. Check result returned and avoid continuing potentially deferencing NULL pointers. Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 37 ++--- 1 file changed, 26 insertion

[Spice-devel] [PATCH v3 0/8] Improve error handling in red-replay-qxl.c

2016-09-16 Thread Frediano Ziglio
Detect error in files and handle more gracefully. This version: - fix some formatting issue (Pavel); - merged some patches; - improved an error check (Pavel); - added two patches to improve replay. Frediano Ziglio (8): replay: Record allocations in a GList to handle errors replay: Handle error

[Spice-devel] [PATCH v3 5/8] replay: Update pointer in allocated list

2016-09-16 Thread Frediano Ziglio
Avoid to free invalid pointer. Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c index 5fcb243..6914c17 100644 --- a/server/red-replay-qxl.c +++ b/server/red-repl

[Spice-devel] [PATCH v3 2/8] replay: Handle errors reading strings from record file

2016-09-16 Thread Frediano Ziglio
To check fscanf read all needed information a dummy "%n" is appended to any string and the value stored there is tested. This as scanf family could return a valid value but not entirely process the string so adding a "%n" and checking this was processed make sure all expected string is found. The c

[Spice-devel] [PATCH v3 1/8] replay: Record allocations in a GList to handle errors

2016-09-16 Thread Frediano Ziglio
Allocations are kept into a GList to be able to free in case some errors happened. Signed-off-by: Frediano Ziglio --- server/red-replay-qxl.c | 68 - 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/server/red-replay-qxl.c b/server/r

Re: [Spice-devel] [PATCH spice v3 2/2] reds: Simplify vdi_port_read_buf_process

2016-09-16 Thread Frediano Ziglio
> > Reuse and handle the return value from agent_msg_filter_process_data > --- > v3: discard AGENT_MSG_FILTER_MONITORS_CONFIG > --- > server/reds.c | 66 > ++- > 1 file changed, 29 insertions(+), 37 deletions(-) > > diff --git a/server/red

Re: [Spice-devel] [PATCH spice v3 1/2] agent-filter: Use enum as return value

2016-09-16 Thread Frediano Ziglio
> > Explicitely discard AGENT_MSG_FILTER_MONITORS_CONFIG messages > from the agent. > > Also remove unused AGENT_MSG_FILTER_END > --- > v3: discard AGENT_MSG_FILTER_MONITORS_CONFIG > --- > server/agent-msg-filter.c | 4 ++-- > server/agent-msg-filter.h | 11 +-- > server/reds.c

Re: [Spice-devel] [PATCH v2 8/8] replay: Propagate error correctly in replay_fread

2016-09-16 Thread Pavel Grunt
On Thu, 2016-09-15 at 23:19 +0100, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio > --- >  server/red-replay-qxl.c | 11 +-- >  1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c > index 73f9cd4..fe4f7a9 100644 > ---

Re: [Spice-devel] [PATCH v2 6/8] replay: Assure read_binary receives a NULL pointer

2016-09-16 Thread Pavel Grunt
On Thu, 2016-09-15 at 23:19 +0100, Frediano Ziglio wrote: > read_binary do not allocate a buffer for no-NULL pointers. > Avoid using uninitialized data and allocate proper buffer. > > Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt > --- >  server/red-replay-qxl.c | 2 +- >  1 file changed,

Re: [Spice-devel] [PATCH v2 1/8] replay: Rename eof to error

2016-09-16 Thread Pavel Grunt
On Thu, 2016-09-15 at 23:19 +0100, Frediano Ziglio wrote: > The eof variable and enumeration will be used for all errors > so avoid confusion. Ok, ack Pavel > > Signed-off-by: Frediano Ziglio > --- >  server/red-replay-qxl.c | 38 +++--- >  1 file changed, 19 inser

Re: [Spice-devel] [PATCH v2 5/8] replay: Remove useless check

2016-09-16 Thread Pavel Grunt
On Thu, 2016-09-15 at 23:19 +0100, Frediano Ziglio wrote: > Same check is done inside replay_fscanf But removing it will not prevent calling red_replay_compat_drawable or red_replay_native_drawable Maybe you want to check the return value of replay_fscanf Pavel > > Signed-off-by: Frediano Zigl

[Spice-devel] [PATCH spice v3 1/2] agent-filter: Use enum as return value

2016-09-16 Thread Pavel Grunt
Explicitely discard AGENT_MSG_FILTER_MONITORS_CONFIG messages from the agent. Also remove unused AGENT_MSG_FILTER_END --- v3: discard AGENT_MSG_FILTER_MONITORS_CONFIG --- server/agent-msg-filter.c | 4 ++-- server/agent-msg-filter.h | 11 +-- server/reds.c | 6 -- 3 file

[Spice-devel] [PATCH spice v3 2/2] reds: Simplify vdi_port_read_buf_process

2016-09-16 Thread Pavel Grunt
Reuse and handle the return value from agent_msg_filter_process_data --- v3: discard AGENT_MSG_FILTER_MONITORS_CONFIG --- server/reds.c | 66 ++- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/server/reds.c b/server/reds.c in

[Spice-devel] [PATCH 1/2] fixup! Add DisplayChannelPrivate struct

2016-09-16 Thread Frediano Ziglio
Remove unneeded header inclusion. Signed-off-by: Frediano Ziglio --- server/stream.c | 1 - 1 file changed, 1 deletion(-) diff --git a/server/stream.c b/server/stream.c index c3877c7..4732dee 100644 --- a/server/stream.c +++ b/server/stream.c @@ -20,7 +20,6 @@ #include "stream.h" #include "

[Spice-devel] [PATCH 2/2] fixup! Add DisplayChannelPrivate struct

2016-09-16 Thread Frediano Ziglio
Remove added FIXME introducing an helper function. Signed-off-by: Frediano Ziglio --- server/display-channel.c | 12 server/display-channel.h | 2 ++ server/red-worker.c | 16 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/server/display-chan

Re: [Spice-devel] [PATCH v2 2/2] Add DisplayChannelPrivate struct

2016-09-16 Thread Frediano Ziglio
> > On Thu, 2016-09-15 at 15:06 -0500, Jonathon Jongsma wrote: > > On Thu, 2016-09-15 at 11:22 -0500, Jonathon Jongsma wrote: > > > Move all of the DisplayChannel data memembers into a private > > > struct ... > > > @@ -783,11 +787,13 @@ static void handle_dev_oom(void *opaque, > > > void > > > *

Re: [Spice-devel] [PATCH v2 1/2] Improve encapsulation of DisplayChannel

2016-09-16 Thread Frediano Ziglio
> > Add a couple new functions to the header so that they can be called by > other objects rather than poking into the internals of the struct. > --- > server/dcc-send.c| 16 +-- > server/display-channel.c | 71 > > server/display-

[Spice-devel] [PATCH] fixup! RedChannelClient: store pipe items in a GQueue

2016-09-16 Thread Frediano Ziglio
Minor changes: - use same name for dcc_add_surface_area_image argument in header and source; - avoid using 2 variable in a for loop, is not much readable and confusing. This also was fixing a regression quite hard to spot so make sure code is less easy to break in the future; - remove check i

Re: [Spice-devel] [PATCH v2 2/2] Add DisplayChannelPrivate struct

2016-09-16 Thread Pavel Grunt
On Thu, 2016-09-15 at 15:06 -0500, Jonathon Jongsma wrote: > On Thu, 2016-09-15 at 11:22 -0500, Jonathon Jongsma wrote: > > Move all of the DisplayChannel data memembers into a private > > struct > > to > > encapsulate things better. This necessitated a few new 'public' > > methods > > and a small

Re: [Spice-devel] [PATCH v2 1/2] Improve encapsulation of DisplayChannel

2016-09-16 Thread Pavel Grunt
On Thu, 2016-09-15 at 11:22 -0500, Jonathon Jongsma wrote: > Add a couple new functions to the header so that they can be called > by > other objects rather than poking into the internals of the struct. > --- >  server/dcc-send.c| 16 +-- >  server/display-channel.c | 71 > ++

Re: [Spice-devel] [PATCH 1/3] Remove unused drawable parameter

2016-09-16 Thread Pavel Grunt
On Fri, 2016-09-16 at 08:30 +0100, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt > --- >  server/dcc-send.c | 33 - >  1 file changed, 16 insertions(+), 17 deletions(-) > > diff --git a/server/dcc-send.c b/server/dcc-send.c > index 5

Re: [Spice-devel] [PATCH 3/3] Reduce indentation

2016-09-16 Thread Pavel Grunt
On Fri, 2016-09-16 at 08:30 +0100, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt > --- >  server/dcc-send.c | 26 -- >  1 file changed, 12 insertions(+), 14 deletions(-) > > diff --git a/server/dcc-send.c b/server/dcc-send.c > index 89c3dc5.

Re: [Spice-devel] [PATCH v2 6/9] Change Drawable->pipes from Ring to GList

2016-09-16 Thread Frediano Ziglio
> > This improves the readability of the code and keeps things > encapsulated better. > --- > Changes in v2: > - changed some loops from while to for > - moved some declarations within loop scope > > server/dcc.c | 12 +--- > server/dcc.h | 1 - > server/displa

Re: [Spice-devel] [PATCH 2/3] Simplify some boolean arithmetic

2016-09-16 Thread Pavel Grunt
On Fri, 2016-09-16 at 08:30 +0100, Frediano Ziglio wrote: > Pass boolean directly. > > Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt > --- >  server/dcc-send.c | 15 +++ >  1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/server/dcc-send.c b/server/dcc-send.

Re: [Spice-devel] [PATCH v2 4/9] Replace a couple Rings with GList

2016-09-16 Thread Frediano Ziglio
> > Make RedsState::mig_target_clients into a GList to improve encapsulation > and maintainability. Also RedsMigTargetClient::pending_links. With > GList, a type implementation can be ignorant of whether they're > contained within a list or not. Acked-by: Frediano Ziglio Frediano > --- > Chang

[Spice-devel] [PATCH 3/3] Reduce indentation

2016-09-16 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/dcc-send.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/server/dcc-send.c b/server/dcc-send.c index 89c3dc5..1d32276 100644 --- a/server/dcc-send.c +++ b/server/dcc-send.c @@ -102,28 +102,26 @@ static in

[Spice-devel] [PATCH 2/3] Simplify some boolean arithmetic

2016-09-16 Thread Frediano Ziglio
Pass boolean directly. Signed-off-by: Frediano Ziglio --- server/dcc-send.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/server/dcc-send.c b/server/dcc-send.c index 317d906..89c3dc5 100644 --- a/server/dcc-send.c +++ b/server/dcc-send.c @@ -147,11 +147,7 @

[Spice-devel] [PATCH 1/3] Remove unused drawable parameter

2016-09-16 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/dcc-send.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/server/dcc-send.c b/server/dcc-send.c index 521e6a2..317d906 100644 --- a/server/dcc-send.c +++ b/server/dcc-send.c @@ -131,7 +131,7 @@ stat