[Spice-devel] [spice-gtk v1] spicy: fix leak of transfer hash table
184 (88 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 10,025 of 11,515 at 0x4C28BF6: malloc (vg_replace_malloc.c:299) by 0x9D33218: g_malloc (gmem.c:94) by 0x9D49D02: g_slice_alloc (gslice.c:1025) by 0x9D1CCBD: g_hash_table_new_full (ghash.c:711) by 0x406196: connection_new (spicy.c:1693) by 0x405BFE: main (spicy.c:1852) --- src/spicy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spicy.c b/src/spicy.c index 0475530..d19b95a 100644 --- a/src/spicy.c +++ b/src/spicy.c @@ -1715,6 +1715,7 @@ static void connection_disconnect(spice_connection *conn) static void connection_destroy(spice_connection *conn) { g_object_unref(conn->session); +g_hash_table_unref(conn->transfers); free(conn); connections--; -- 2.5.5 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk v1] spicy: fix leak of transfer hash table
Acked-by: Christophe Fergeau On Tue, May 10, 2016 at 10:28:28AM +0200, Victor Toso wrote: > 184 (88 direct, 96 indirect) bytes in 1 blocks are definitely lost in > loss record 10,025 of 11,515 at 0x4C28BF6: malloc > (vg_replace_malloc.c:299) > by 0x9D33218: g_malloc (gmem.c:94) > by 0x9D49D02: g_slice_alloc (gslice.c:1025) > by 0x9D1CCBD: g_hash_table_new_full (ghash.c:711) > by 0x406196: connection_new (spicy.c:1693) > by 0x405BFE: main (spicy.c:1852) > --- > src/spicy.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/spicy.c b/src/spicy.c > index 0475530..d19b95a 100644 > --- a/src/spicy.c > +++ b/src/spicy.c > @@ -1715,6 +1715,7 @@ static void connection_disconnect(spice_connection > *conn) > static void connection_destroy(spice_connection *conn) > { > g_object_unref(conn->session); > +g_hash_table_unref(conn->transfers); > free(conn); > > connections--; > -- > 2.5.5 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [spice-devel]Please help me to check this problem , Compile spice-gtk-0.30 error
[root@fc21 spice-gtk-0.30]# mingw32-make make all-recursive make[1]: Entering directory '/home/luohongzhen/Downloads/spice-gtk-0.30' Making all in spice-common make[2]: Entering directory '/home/luohongzhen/Downloads/spice-gtk-0.30/spice-common' make all-recursive make[3]: Entering directory '/home/luohongzhen/Downloads/spice-gtk-0.30/spice-common' Making all in common make[4]: Entering directory '/home/luohongzhen/Downloads/spice-gtk-0.30/spice-common/common' make[4]: *** No rule to make target '/spice.proto', needed by 'generated_client_demarshallers.c'. Stop. make[4]: Leaving directory '/home/luohongzhen/Downloads/spice-gtk-0.30/spice-common/common' Makefile:436: recipe for target 'all-recursive' failed make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory '/home/luohongzhen/Downloads/spice-gtk-0.30/spice-common' Makefile:367: recipe for target 'all' failed make[2]: *** [all] Error 2 make[2]: Leaving directory '/home/luohongzhen/Downloads/spice-gtk-0.30/spice-common' Makefile:659: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/luohongzhen/Downloads/spice-gtk-0.30' Makefile:561: recipe for target 'all' failed make: *** [all] Error 2 But the spice-gtk 0.27 and 0.28 were compiled successfully .except ..0.30... I tried to do "yum install pyparsing" ,but the problem was still happened .. I really don't know how to deal with this problem ,if you know that ,please tell me thank you very much .expect your replyEnvironementFedora 21 / spice-protocol 12.10(be installed)/ usbredir(be installed)/libvirt(ok)/qemu(ok)/libusb(ok) ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] spice-server style documentation
> > Hey, > > On Mon, May 09, 2016 at 11:09:40AM -0400, Frediano Ziglio wrote: > > I think it's time to update this document > > > > > > > > 1. C and C++ style > > > > > > All of the following are applicable for both c and c++, except for > > > section 25 > > > which is c++ extension. > > > > > > > This file is in spice-server which is not much C++ but this paragraph is > > not going to hurt. > > spice-server used to have a spice/client directory with c++ code, long > gon. > > > > > > 2. Source Files > > > > > > 2.1. Names > > > Use lower case and separate words using underscore (e.g., file_name.c, > > > header.h). > > > > > > > Now we use dashes, not underscores. > > > > > Use cpp file extension for c++ source files and hpp extension for c++ > > > template files. Use standard file extension for c source and header > > > files. > > > 2.2. Line width > > > No more then 100 character on a single line > > > > There are lines with more than 140 characters. > > I personally don't think we should get in that habit, and that 100 > characters is plenty enough. Fine with me if we go with a bigger limit. > > > > 5. Static storage initialization > > > > > > To improve code readability, explicitly initialize variables that depend > > > on > > > default initialization with zero/null. > > > > > > > Does it still apply? > > "Do not use static" ? :) Anyway, I don't think it hurts to have that. > > > > > > > 6. Fixme and todo > > > > > > Comments that are prefixed with “fixme” describe a bug that need to be > > > fixed. > > > Generally, it is not allowed to commit new code having “fixme” comment. > > > Committing “fixme” is allowed only for existing bugs. Comments that are > > > prefixed with “todo” describe further features, optimization or code > > > improvements, and they are allowed to be committed along with the > > > relevant > > > code. > > > > > > > Most are TODO and FIXME now. > > > > > 7. ASSERT > > > > > > Use it freely. ASSERT helps testing function arguments and function > > > results > > > validity. ASSERT helps detecting bugs and improve code readability and > > > stability. > > > > > > > This is quite outdated > > > > > 8. sizeof > > > > > > Apply function style to sizeof (i.e., use sizeof(x)) > > > > > > 9. const > > > > > > Use const keyword when applicable to improve code reliability and > > > celerity. > > > > > > 10. goto > > > > > > Using goto is allowed in c code for error handling. In any other case it > > > will > > > be used only as a special exception. > > > > > > > not really true, in some code we use quite a lot of gotos. > > > > > 11. Defining Constant values > > > > > > Use defines for constant values for improving readability and ease of > > > changes. Alternatively, use global const variables. > > > > > > > > > > > > 12. void argument > > > > > > Don't add explicitly void argument in functions without arguments. (i.e., > > > void function_name() is OK) > > > > > > > This apply only to C++. > > > > > 13. Short functions > > > > > > Try to split code to short functions, each having simple functionality, > > > in > > > order to improve code readability and re-usability. Prefix with inline > > > short > > > functions or functions that were splitted for readability reason. > > > > > > 14. Return on if > > > > > > Try to return immediately on if in places that can reduce indentation > > > level. > > > > > > Example: > > > > > > prefer > > > > > > void function(int *n) > > > { > > > if (!n) { > > > return; > > > } > > > ... > > > } > > > > > > on > > > > > > void function(int *n) > > > { > > > if (!n) { > > > return; > > > } else { > > > ... > > > } > > > } > > > > > > 15. Names > > > > > > Don't underestimate the importance of name choosing. Good names make the > > > code > > > more easy to understand and reduce the required level of code > > > documentation. > > > When choosing names, prefer long meaningful names over short vague name. > > > > > > Variable and Function names – use lower case and separate words using > > > underscore (e.g., sample_variable_name) > > > > > > Structures, class and enum names – one or more words, each word start > > > with > > > upper case (e.g., Name, SampleStructName) > > > > > > Defines and enum items names – uppercase words separated using > > > underscores > > > (e.g., NAME, SAMPLE_DEFINE_NAME) > > > > > > 16. Optimization > > > > > > Keep optimization to fast path code. Prefer safe, clear and easy to > > > maintain > > > coding for code that is not on the fast path. > > > > > > 17. Spacing > > > > > > Use spacing for improving code readability. > > > > > > for (i = 0; i < 10; ++i) { > > > some_func(var, i * i + *ptr, &var, sizeof(var)); > > > } > > > > > > > we should specify something more than this > > > > > > > > > 18. Function Indentation > > > > > > No spaces between function name to left bracket. > > > Curly
Re: [Spice-devel] spice-server style documentation
Hey, On Tue, May 10, 2016 at 05:45:40AM -0400, Frediano Ziglio wrote: > > > > Hey, > > > > On Mon, May 09, 2016 at 11:09:40AM -0400, Frediano Ziglio wrote: > > > I think it's time to update this document > > > > > > > > > > > 1. C and C++ style > > > > > > > > All of the following are applicable for both c and c++, except for > > > > section 25 > > > > which is c++ extension. > > > > > > > > > > This file is in spice-server which is not much C++ but this paragraph is > > > not going to hurt. > > > > spice-server used to have a spice/client directory with c++ code, long > > gon. > > > > > > > > > 2. Source Files > > > > > > > > 2.1. Names > > > > Use lower case and separate words using underscore (e.g., file_name.c, > > > > header.h). > > > > > > > > > > Now we use dashes, not underscores. > > > > > > > Use cpp file extension for c++ source files and hpp extension for c++ > > > > template files. Use standard file extension for c source and header > > > > files. > > > > 2.2. Line width > > > > No more then 100 character on a single line > > > > > > There are lines with more than 140 characters. > > > > I personally don't think we should get in that habit, and that 100 > > characters is plenty enough. Fine with me if we go with a bigger limit. > > > > > > 5. Static storage initialization > > > > > > > > To improve code readability, explicitly initialize variables that depend > > > > on > > > > default initialization with zero/null. > > > > > > > > > > Does it still apply? > > > > "Do not use static" ? :) Anyway, I don't think it hurts to have that. > > > > > > > > > > > 6. Fixme and todo > > > > > > > > Comments that are prefixed with “fixme” describe a bug that need to be > > > > fixed. > > > > Generally, it is not allowed to commit new code having “fixme” comment. > > > > Committing “fixme” is allowed only for existing bugs. Comments that are > > > > prefixed with “todo” describe further features, optimization or code > > > > improvements, and they are allowed to be committed along with the > > > > relevant > > > > code. > > > > > > > > > > Most are TODO and FIXME now. > > > > > > > 7. ASSERT > > > > > > > > Use it freely. ASSERT helps testing function arguments and function > > > > results > > > > validity. ASSERT helps detecting bugs and improve code readability and > > > > stability. > > > > > > > > > > This is quite outdated > > > > > > > 8. sizeof > > > > > > > > Apply function style to sizeof (i.e., use sizeof(x)) > > > > > > > > 9. const > > > > > > > > Use const keyword when applicable to improve code reliability and > > > > celerity. > > > > > > > > 10. goto > > > > > > > > Using goto is allowed in c code for error handling. In any other case it > > > > will > > > > be used only as a special exception. > > > > > > > > > > not really true, in some code we use quite a lot of gotos. > > > > > > > 11. Defining Constant values > > > > > > > > Use defines for constant values for improving readability and ease of > > > > changes. Alternatively, use global const variables. > > > > > > > > > > > > > > > > 12. void argument > > > > > > > > Don't add explicitly void argument in functions without arguments. > > > > (i.e., > > > > void function_name() is OK) > > > > > > > > > > This apply only to C++. > > > > > > > 13. Short functions > > > > > > > > Try to split code to short functions, each having simple functionality, > > > > in > > > > order to improve code readability and re-usability. Prefix with inline > > > > short > > > > functions or functions that were splitted for readability reason. > > > > > > > > 14. Return on if > > > > > > > > Try to return immediately on if in places that can reduce indentation > > > > level. > > > > > > > > Example: > > > > > > > > prefer > > > > > > > > void function(int *n) > > > > { > > > > if (!n) { > > > > return; > > > > } > > > > ... > > > > } > > > > > > > > on > > > > > > > > void function(int *n) > > > > { > > > > if (!n) { > > > > return; > > > > } else { > > > > ... > > > > } > > > > } > > > > > > > > 15. Names > > > > > > > > Don't underestimate the importance of name choosing. Good names make the > > > > code > > > > more easy to understand and reduce the required level of code > > > > documentation. > > > > When choosing names, prefer long meaningful names over short vague name. > > > > > > > > Variable and Function names – use lower case and separate words using > > > > underscore (e.g., sample_variable_name) > > > > > > > > Structures, class and enum names – one or more words, each word start > > > > with > > > > upper case (e.g., Name, SampleStructName) > > > > > > > > Defines and enum items names – uppercase words separated using > > > > underscores > > > > (e.g., NAME, SAMPLE_DEFINE_NAME) > > > > > > > > 16. Optimization > > > > > > > > Keep optimization to fast path code. Prefer safe, clear and easy to > > > > maintai
Re: [Spice-devel] [spice-protocol PATCH v4] LZ4 compression is now available at the Spicevmc channel
Hi, On Thu, May 05, 2016 at 02:43:33PM +0300, Snir Sheriber wrote: > -New message type for compressed messages has been added to the protocol > -SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4 capability has been added Let's keep the commit messages under 72 char. > --- > spice/enums.h| 10 ++ > spice/protocol.h | 4 > 2 files changed, 14 insertions(+) > > diff --git a/spice/enums.h b/spice/enums.h > index c6e9840..cf49c3a 100644 > --- a/spice/enums.h > +++ b/spice/enums.h > @@ -106,6 +106,14 @@ typedef enum SpiceMouseMode { > SPICE_MOUSE_MODE_MASK = 0x3 > } SpiceMouseMode; > > +typedef enum SpiceDataCompressionType { > +SPICE_DATA_COMPRESSION_TYPE_NONE, > +SPICE_DATA_COMPRESSION_TYPE_LZ4, > +SPICE_DATA_COMPRESSION_TYPE_INVALID, SPICE_DATA_COMPRESSION_TYPE_INVALID is not used in your patches, maybe it could be removed then? Apart from this, looks good. Reviewed-by: Victor Toso > + > +SPICE_DATA_COMPRESSION_TYPE_ENUM_END > +} SpiceDataCompressionType; > + > typedef enum SpicePubkeyType { > SPICE_PUBKEY_TYPE_INVALID, > SPICE_PUBKEY_TYPE_RSA, > @@ -634,12 +642,14 @@ enum { > > enum { > SPICE_MSG_SPICEVMC_DATA = 101, > +SPICE_MSG_SPICEVMC_COMPRESSED_DATA, > > SPICE_MSG_END_SPICEVMC > }; > > enum { > SPICE_MSGC_SPICEVMC_DATA = 101, > +SPICE_MSGC_SPICEVMC_COMPRESSED_DATA, > > SPICE_MSGC_END_SPICEVMC > }; > diff --git a/spice/protocol.h b/spice/protocol.h > index f4a2259..d742eda 100644 > --- a/spice/protocol.h > +++ b/spice/protocol.h > @@ -148,6 +148,10 @@ enum { > }; > > enum { > +SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4, > +}; > + > +enum { > SPICE_PORT_EVENT_OPENED, > SPICE_PORT_EVENT_CLOSED, > SPICE_PORT_EVENT_BREAK, > -- > 2.5.5 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-protocol PATCH v4] LZ4 compression is now available at the Spicevmc channel
On Tue, May 10, 2016 at 12:23:30PM +0200, Victor Toso wrote: > Hi, > > On Thu, May 05, 2016 at 02:43:33PM +0300, Snir Sheriber wrote: > > -New message type for compressed messages has been added to the protocol > > -SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4 capability has been added > > Let's keep the commit messages under 72 char. Hehe, sorry. It is already under 72 char... bad toso, bad bad toso! > > > --- > > spice/enums.h| 10 ++ > > spice/protocol.h | 4 > > 2 files changed, 14 insertions(+) > > > > diff --git a/spice/enums.h b/spice/enums.h > > index c6e9840..cf49c3a 100644 > > --- a/spice/enums.h > > +++ b/spice/enums.h > > @@ -106,6 +106,14 @@ typedef enum SpiceMouseMode { > > SPICE_MOUSE_MODE_MASK = 0x3 > > } SpiceMouseMode; > > > > +typedef enum SpiceDataCompressionType { > > +SPICE_DATA_COMPRESSION_TYPE_NONE, > > +SPICE_DATA_COMPRESSION_TYPE_LZ4, > > +SPICE_DATA_COMPRESSION_TYPE_INVALID, > > SPICE_DATA_COMPRESSION_TYPE_INVALID is not used in your patches, maybe > it could be removed then? > > Apart from this, looks good. > Reviewed-by: Victor Toso > > > + > > +SPICE_DATA_COMPRESSION_TYPE_ENUM_END > > +} SpiceDataCompressionType; > > + > > typedef enum SpicePubkeyType { > > SPICE_PUBKEY_TYPE_INVALID, > > SPICE_PUBKEY_TYPE_RSA, > > @@ -634,12 +642,14 @@ enum { > > > > enum { > > SPICE_MSG_SPICEVMC_DATA = 101, > > +SPICE_MSG_SPICEVMC_COMPRESSED_DATA, > > > > SPICE_MSG_END_SPICEVMC > > }; > > > > enum { > > SPICE_MSGC_SPICEVMC_DATA = 101, > > +SPICE_MSGC_SPICEVMC_COMPRESSED_DATA, > > > > SPICE_MSGC_END_SPICEVMC > > }; > > diff --git a/spice/protocol.h b/spice/protocol.h > > index f4a2259..d742eda 100644 > > --- a/spice/protocol.h > > +++ b/spice/protocol.h > > @@ -148,6 +148,10 @@ enum { > > }; > > > > enum { > > +SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4, > > +}; > > + > > +enum { > > SPICE_PORT_EVENT_OPENED, > > SPICE_PORT_EVENT_CLOSED, > > SPICE_PORT_EVENT_BREAK, > > -- > > 2.5.5 > > > > ___ > > Spice-devel mailing list > > Spice-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-common PATCH v4] Add LZ4 data compression and used it in spicevmc channel
On Thu, May 05, 2016 at 02:43:32PM +0300, Snir Sheriber wrote: > Compressed message type is CompressedData which contains compression > type (1 byte) followed by the uncompressed data size (4 bytes) followed > by the compressed data size (4 bytes) followed by the compressed data Acked-by: Victor Toso > --- > common/client_marshallers.h | 1 + > common/messages.h | 7 +++ > spice.proto | 15 +++ > 3 files changed, 23 insertions(+) > > diff --git a/common/client_marshallers.h b/common/client_marshallers.h > index 728987e..2074323 100644 > --- a/common/client_marshallers.h > +++ b/common/client_marshallers.h > @@ -33,6 +33,7 @@ SPICE_BEGIN_DECLS > typedef struct { > void (*msg_SpiceMsgEmpty)(SpiceMarshaller *m, SpiceMsgEmpty *msg); > void (*msg_SpiceMsgData)(SpiceMarshaller *m, SpiceMsgData *msg); > +void (*msg_SpiceMsgCompressedData)(SpiceMarshaller *m, > SpiceMsgCompressedData *msg); > void (*msgc_ack_sync)(SpiceMarshaller *m, SpiceMsgcAckSync *msg); > void (*msgc_pong)(SpiceMarshaller *m, SpiceMsgPing *msg); > void (*msgc_disconnecting)(SpiceMarshaller *m, SpiceMsgDisconnect *msg); > diff --git a/common/messages.h b/common/messages.h > index f537950..d001850 100644 > --- a/common/messages.h > +++ b/common/messages.h > @@ -55,6 +55,13 @@ typedef struct SpiceMsgData { > uint8_t data[0]; > } SpiceMsgData; > > +typedef struct SpiceMsgCompressedData { > +uint8_t type; > +uint32_t uncompressed_size; > +uint32_t compressed_size; > +uint8_t compressed_data[0]; > +} SpiceMsgCompressedData; > + > typedef struct SpiceMsgEmpty { > uint8_t padding; > } SpiceMsgEmpty; > diff --git a/spice.proto b/spice.proto > index 4a0778d..ea29fb0 100644 > --- a/spice.proto > +++ b/spice.proto > @@ -120,6 +120,19 @@ message Data { > uint8 data[] @end @ctype(uint8_t); > } @nocopy; > > +enum8 data_compression_type { > +NONE, > +LZ4, > +INVALID, > +}; > + > +message CompressedData { > +data_compression_type type; > +uint32 uncompressed_size; > +uint32 compressed_size; > +uint8 compressed_data[] @end; > +} @ctype(SpiceMsgCompressedData); > + > struct ChannelWait { > uint8 channel_type; > uint8 channel_id; > @@ -1373,8 +1386,10 @@ channel SmartcardChannel : BaseChannel { > channel SpicevmcChannel : BaseChannel { > server: > Data data = 101; > +CompressedData compressed_data = 102; > client: > Data data = 101; > +CompressedData compressed_data = 102; > }; > > channel UsbredirChannel : SpicevmcChannel { > -- > 2.5.5 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk PATCH v4] Usbredir: enable lz4 compression
Hi, On Thu, May 05, 2016 at 02:43:35PM +0300, Snir Sheriber wrote: > Compressed message type is CompressedData which contains compression > type (1 byte) followed by the uncompressed data size (4 bytes) followed > by the compressed data size (4 bytes) followed by the compressed data > > If SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4 capability is available && > data_size > COMPRESS_THRESHOLD data will be sent compressed otherwise > data will be sent uncompressed (as well if compression has failed) > --- > src/channel-usbredir.c | 134 > ++--- > 1 file changed, 128 insertions(+), 6 deletions(-) > > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c > index c8a2da9..a97dfa0 100644 > --- a/src/channel-usbredir.c > +++ b/src/channel-usbredir.c > @@ -24,6 +24,9 @@ > #ifdef USE_USBREDIR > #include > #include > +#ifdef USE_LZ4 > +#include > +#endif > #ifdef USE_POLKIT > #include "usb-acl-helper.h" > #endif > @@ -32,6 +35,7 @@ > #include "usbutil.h" > #endif > > +#include "common/log.h" > #include "spice-client.h" > #include "spice-common.h" > > @@ -51,6 +55,7 @@ > > #ifdef USE_USBREDIR > > +#define COMPRESS_THRESHOLD 1000 > #define SPICE_USBREDIR_CHANNEL_GET_PRIVATE(obj) > \ > (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_USBREDIR_CHANNEL, > SpiceUsbredirChannelPrivate)) > > @@ -233,6 +238,7 @@ static void channel_set_handlers(SpiceChannelClass *klass) > { > static const spice_msg_handler handlers[] = { > [ SPICE_MSG_SPICEVMC_DATA ] = usbredir_handle_msg, > +[ SPICE_MSG_SPICEVMC_COMPRESSED_DATA ] = usbredir_handle_msg, > }; > > spice_channel_set_handlers(klass, handlers, G_N_ELEMENTS(handlers)); > @@ -269,6 +275,9 @@ void > spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel, > #if USBREDIR_VERSION >= 0x000701 > usbredirhost_set_buffered_output_size_cb(priv->host, > usbredir_buffered_output_size_callback); > #endif > +#ifdef USE_LZ4 > +spice_channel_set_capability(channel, > SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4); > +#endif > } > > static gboolean spice_usbredir_channel_open_device( > @@ -632,11 +641,76 @@ static void usbredir_free_write_cb_data(uint8_t *data, > void *user_data) > usbredirhost_free_write_buffer(priv->host, data); > } > > +#ifdef USE_LZ4 > +static void usbredir_free_write_cb_compressed_data(uint8_t *data, void > *user_data) > +{ > +SpiceUsbredirChannel *channel = user_data; > +SpiceUsbredirChannelPrivate *priv = channel->priv; > + > +usbredirhost_free_write_buffer(priv->host, > + (uint8_t*)SPICE_CONTAINEROF(data, > SpiceMsgCompressedData, compressed_data)); > +} > + > +static int try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t > *data, int count) { > +SpiceChannelPrivate *c; > +SpiceMsgOut *msg_out_compressed; > +int bound, compressed_data_count; > +SpiceMsgCompressedData *compressed_data_msg; > + > +c = SPICE_CHANNEL(channel)->priv; > +if (g_socket_get_family(c->sock) == G_SOCKET_FAMILY_UNIX) { > +/* AF_LOCAL socket - data will not be compressed */ > +return FALSE; > +} > +if (count <= COMPRESS_THRESHOLD) { > +/* Not enough data to compress */ > +return FALSE; > +} I did not feel any performance problem on webcam mostly because, in my case, the message size was always less than COMPRESS_THRESHOLD. I think this is good enough for now but it would be good to have a FIXME here about identifying the device as isoc and avoiding compress in such case. > +if (!spice_channel_test_capability(SPICE_CHANNEL(channel), > + > SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4)) { > +/*No server compressing capability - data will not be compressed*/ > +return FALSE; > +} > +bound = LZ4_compressBound(count); > +if (bound == 0) { > +/*Invalid bound - data will not be compressed*/ Really, really minor thing but could you also give a space after and before '*' ? :) > +return FALSE; > +} > +compressed_data_msg = > (SpiceMsgCompressedData*)spice_malloc(sizeof(SpiceMsgCompressedData) + bound); > +compressed_data_msg->uncompressed_size = count; > +compressed_data_msg->type = SPICE_DATA_COMPRESSION_TYPE_LZ4; > +compressed_data_count = LZ4_compress_default((char*)data, > + > (char*)compressed_data_msg->compressed_data, > + count, > + bound); > +if (compressed_data_count > 0) { > +compressed_data_msg->compressed_size = compressed_data_count; > +msg_out_compressed = spice_msg_out_new(SPICE_CHANNEL(channel), > + > SPICE_MSGC_SPICEVMC_COMPRESSED_DATA); > + > msg_out_compressed->marshallers->msg_
Re: [Spice-devel] [server PATCH v4] LZ4 compression is now available at the Spicevmc channel
Hi, On Thu, May 05, 2016 at 02:43:34PM +0300, Snir Sheriber wrote: > Compressed message type is CompressedData which contains compression > type (1 byte) followed by the uncompressed data size (4 bytes) followed > by the compressed data size (4 bytes) followed by the compressed data > > If SPICE_USBREDIR_CAP_DATA_COMPRESS_LZ4 capability is available && > data_size > COMPRESS_THRESHOLD data will be sent compressed otherwise > data will be sent uncompressed (also if compression has failed) It works and code looks good to me. I'm not 100% comfortable to ack this on server so I'd wait for other's opinion that this seems fine. Reviewed-by: Victor Toso > --- > server/spicevmc.c | 155 > ++ > 1 file changed, 145 insertions(+), 10 deletions(-) > > diff --git a/server/spicevmc.c b/server/spicevmc.c > index 54dfe4a..896eb3c 100644 > --- a/server/spicevmc.c > +++ b/server/spicevmc.c > @@ -34,6 +34,9 @@ > #include "red-channel.h" > #include "reds.h" > #include "migration-protocol.h" > +#ifdef USE_LZ4 > +#include > +#endif > > /* todo: add flow control. i.e., > * (a) limit the tokens available for the client > @@ -41,10 +44,13 @@ > */ > /* 64K should be enough for all but the largest writes + 32 bytes hdr */ > #define BUF_SIZE (64 * 1024 + 32) > +#define COMPRESS_THRESHOLD 1000 > > typedef struct RedVmcPipeItem { > RedPipeItem base; > > +SpiceDataCompressionType type; > +uint32_t uncompressed_data_size; > /* writes which don't fit this will get split, this is not a problem */ > uint8_t buf[BUF_SIZE]; > uint32_t buf_used; > @@ -105,6 +111,55 @@ enum { > RED_PIPE_ITEM_TYPE_PORT_EVENT, > }; > > +static uint8_t *spicevmc_red_channel_alloc_msg_rcv_buf(RedChannelClient *rcc, > + uint16_t type, > + uint32_t size); > + > +static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc, > + uint16_t type, > + uint32_t size, > + uint8_t *msg); > + > +static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, > RedVmcPipeItem *msg_item) { > +RedVmcPipeItem *msg_item_compressed; > +int bound, compressed_data_count; > + > +if (reds_stream_get_family(state->rcc->stream) == AF_UNIX) { > +/* AF_LOCAL - data will not be compressed */ > +return NULL; > +} > +if (n <= COMPRESS_THRESHOLD) { > +/* n <= threshold - data will not be compressed */ > +return NULL; > +} > +if (!red_channel_test_remote_cap(&state->channel, > SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4)) { > +/* Client doesn't has compression cap - data will not be compressed > */ > +return NULL; > +} > +bound = LZ4_compressBound(n); > +if (bound == 0 || bound >= BUF_SIZE) { > +/* bound is invalid - data will not be compressed */ > +return NULL; > +} > +msg_item_compressed = spice_new0(RedVmcPipeItem, 1); > +red_pipe_item_init(&msg_item_compressed->base, > RED_PIPE_ITEM_TYPE_SPICEVMC_DATA); > +compressed_data_count = LZ4_compress_default((char*)&msg_item->buf, > + > (char*)&msg_item_compressed->buf, > + n, > + bound); > + > +if (compressed_data_count > 0) { > +msg_item_compressed->type = SPICE_DATA_COMPRESSION_TYPE_LZ4; > +msg_item_compressed->uncompressed_data_size = n; > +msg_item_compressed->buf_used = compressed_data_count; > +free(msg_item); > +return msg_item_compressed; > +}/* LZ4 compression failed-fallback a non-compressed data is to be sent > */ > +spice_warning("Compress Error"); > +free(msg_item_compressed); > +return NULL; > +} > + > static RedPipeItem > *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance *sin, > void *opaque) > { > @@ -121,6 +176,7 @@ static RedPipeItem > *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance * > > if (!state->pipe_item) { > msg_item = spice_new0(RedVmcPipeItem, 1); > +msg_item->type = SPICE_DATA_COMPRESSION_TYPE_NONE; > red_pipe_item_init(&msg_item->base, > RED_PIPE_ITEM_TYPE_SPICEVMC_DATA); > } else { > spice_assert(state->pipe_item->buf_used == 0); > @@ -132,6 +188,15 @@ static RedPipeItem > *spicevmc_chardev_read_msg_from_dev(SpiceCharDeviceInstance * >sizeof(msg_item->buf)); > if (n > 0) { > spice_debug("read from dev %d", n); > +#ifdef USE_LZ4 > +RedVmcPipeItem *msg_item_compressed; > + > +msg_item_compressed = try_compress_lz4(state, n, msg_item); >
Re: [Spice-devel] [spice-gtk v1] spicy: fix leak of transfer hash table
Hi, On Tue, May 10, 2016 at 11:16:43AM +0200, Christophe Fergeau wrote: > > Acked-by: Christophe Fergeau Thanks, pushed as https://cgit.freedesktop.org/spice/spice-gtk/commit/?id=e6ca385208d68204c470b51e312582bba8076551 > > On Tue, May 10, 2016 at 10:28:28AM +0200, Victor Toso wrote: > > 184 (88 direct, 96 indirect) bytes in 1 blocks are definitely lost in > > loss record 10,025 of 11,515 at 0x4C28BF6: malloc > > (vg_replace_malloc.c:299) > > by 0x9D33218: g_malloc (gmem.c:94) > > by 0x9D49D02: g_slice_alloc (gslice.c:1025) > > by 0x9D1CCBD: g_hash_table_new_full (ghash.c:711) > > by 0x406196: connection_new (spicy.c:1693) > > by 0x405BFE: main (spicy.c:1852) > > --- > > src/spicy.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/src/spicy.c b/src/spicy.c > > index 0475530..d19b95a 100644 > > --- a/src/spicy.c > > +++ b/src/spicy.c > > @@ -1715,6 +1715,7 @@ static void connection_disconnect(spice_connection > > *conn) > > static void connection_destroy(spice_connection *conn) > > { > > g_object_unref(conn->session); > > +g_hash_table_unref(conn->transfers); > > free(conn); > > > > connections--; > > -- > > 2.5.5 > > > > ___ > > Spice-devel mailing list > > Spice-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/spice-devel > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk PATCH v4] Usbredir: enable lz4 compression
Hi Snir, it is also needed to increase required version of the spice-protocol in configure.ac for the components using new symbols. Currently spice-common requires spice-protocol >= 0.12.10 spice-gtk requires spice-protocol >= 0.12.11 spice-server requires spice-protocol >= 0.12.11 And the new symbols (SPICE_DATA_COMPRESSION_*, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, SPICE_SPICEVMC_CA P_DATA_COMPRESS_LZ4) are going to be in spice-protocol >= 0.12.12 Pavel On Thu, 2016-05-05 at 14:43 +0300, Snir Sheriber wrote: > Compressed message type is CompressedData which contains compression > type (1 byte) followed by the uncompressed data size (4 bytes) followed > by the compressed data size (4 bytes) followed by the compressed data > > If SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4 capability is available && > data_size > COMPRESS_THRESHOLD data will be sent compressed otherwise > data will be sent uncompressed (as well if compression has failed) > --- > src/channel-usbredir.c | 134 ++ > --- > 1 file changed, 128 insertions(+), 6 deletions(-) > > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c > index c8a2da9..a97dfa0 100644 > --- a/src/channel-usbredir.c > +++ b/src/channel-usbredir.c > @@ -24,6 +24,9 @@ > #ifdef USE_USBREDIR > #include > #include > +#ifdef USE_LZ4 > +#include > +#endif > #ifdef USE_POLKIT > #include "usb-acl-helper.h" > #endif > @@ -32,6 +35,7 @@ > #include "usbutil.h" > #endif > > +#include "common/log.h" > #include "spice-client.h" > #include "spice-common.h" > > @@ -51,6 +55,7 @@ > > #ifdef USE_USBREDIR > > +#define COMPRESS_THRESHOLD 1000 > #define > SPICE_USBREDIR_CHANNEL_GET_PRIVATE(obj) \ > (G_TYPE_INSTANCE_GET_PRIVATE((obj), SPICE_TYPE_USBREDIR_CHANNEL, > SpiceUsbredirChannelPrivate)) > > @@ -233,6 +238,7 @@ static void channel_set_handlers(SpiceChannelClass *klass) > { > static const spice_msg_handler handlers[] = { > [ SPICE_MSG_SPICEVMC_DATA ] = usbredir_handle_msg, > +[ SPICE_MSG_SPICEVMC_COMPRESSED_DATA ] = usbredir_handle_msg, > }; > > spice_channel_set_handlers(klass, handlers, G_N_ELEMENTS(handlers)); > @@ -269,6 +275,9 @@ void > spice_usbredir_channel_set_context(SpiceUsbredirChannel *channel, > #if USBREDIR_VERSION >= 0x000701 > usbredirhost_set_buffered_output_size_cb(priv->host, > usbredir_buffered_output_size_callback); > #endif > +#ifdef USE_LZ4 > +spice_channel_set_capability(channel, > SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4); > +#endif > } > > static gboolean spice_usbredir_channel_open_device( > @@ -632,11 +641,76 @@ static void usbredir_free_write_cb_data(uint8_t *data, > void *user_data) > usbredirhost_free_write_buffer(priv->host, data); > } > > +#ifdef USE_LZ4 > +static void usbredir_free_write_cb_compressed_data(uint8_t *data, void > *user_data) > +{ > +SpiceUsbredirChannel *channel = user_data; > +SpiceUsbredirChannelPrivate *priv = channel->priv; > + > +usbredirhost_free_write_buffer(priv->host, > + (uint8_t*)SPICE_CONTAINEROF(data, > SpiceMsgCompressedData, compressed_data)); > +} > + > +static int try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t > *data, int count) { > +SpiceChannelPrivate *c; > +SpiceMsgOut *msg_out_compressed; > +int bound, compressed_data_count; > +SpiceMsgCompressedData *compressed_data_msg; > + > +c = SPICE_CHANNEL(channel)->priv; > +if (g_socket_get_family(c->sock) == G_SOCKET_FAMILY_UNIX) { > +/* AF_LOCAL socket - data will not be compressed */ > +return FALSE; > +} > +if (count <= COMPRESS_THRESHOLD) { > +/* Not enough data to compress */ > +return FALSE; > +} > +if (!spice_channel_test_capability(SPICE_CHANNEL(channel), > + SPICE_SPICEVMC_CAP_DATA_COMPRESS_LZ4)) > { > +/*No server compressing capability - data will not be compressed*/ > +return FALSE; > +} > +bound = LZ4_compressBound(count); > +if (bound == 0) { > +/*Invalid bound - data will not be compressed*/ > +return FALSE; > +} > +compressed_data_msg = > (SpiceMsgCompressedData*)spice_malloc(sizeof(SpiceMsgCompressedData) + bound); > +compressed_data_msg->uncompressed_size = count; > +compressed_data_msg->type = SPICE_DATA_COMPRESSION_TYPE_LZ4; > +compressed_data_count = LZ4_compress_default((char*)data, > + (char*)compressed_data_msg- > >compressed_data, > + count, > + bound); > +if (compressed_data_count > 0) { > +compressed_data_msg->compressed_size = compressed_data_count; > +msg_out_compressed = spice_msg_out_new(SPICE_CHANNEL(channel), > + SPICE_MSGC_SPICEVMC_COMPRES
Re: [Spice-devel] [spice-common PATCH v4] Add LZ4 data compression and used it in spicevmc channel
Have you measured how much of a gain lz4 compression gives for some use cases? Christophe On Thu, May 05, 2016 at 02:43:32PM +0300, Snir Sheriber wrote: > Compressed message type is CompressedData which contains compression > type (1 byte) followed by the uncompressed data size (4 bytes) followed > by the compressed data size (4 bytes) followed by the compressed data > --- > common/client_marshallers.h | 1 + > common/messages.h | 7 +++ > spice.proto | 15 +++ > 3 files changed, 23 insertions(+) > > diff --git a/common/client_marshallers.h b/common/client_marshallers.h > index 728987e..2074323 100644 > --- a/common/client_marshallers.h > +++ b/common/client_marshallers.h > @@ -33,6 +33,7 @@ SPICE_BEGIN_DECLS > typedef struct { > void (*msg_SpiceMsgEmpty)(SpiceMarshaller *m, SpiceMsgEmpty *msg); > void (*msg_SpiceMsgData)(SpiceMarshaller *m, SpiceMsgData *msg); > +void (*msg_SpiceMsgCompressedData)(SpiceMarshaller *m, > SpiceMsgCompressedData *msg); > void (*msgc_ack_sync)(SpiceMarshaller *m, SpiceMsgcAckSync *msg); > void (*msgc_pong)(SpiceMarshaller *m, SpiceMsgPing *msg); > void (*msgc_disconnecting)(SpiceMarshaller *m, SpiceMsgDisconnect *msg); > diff --git a/common/messages.h b/common/messages.h > index f537950..d001850 100644 > --- a/common/messages.h > +++ b/common/messages.h > @@ -55,6 +55,13 @@ typedef struct SpiceMsgData { > uint8_t data[0]; > } SpiceMsgData; > > +typedef struct SpiceMsgCompressedData { > +uint8_t type; > +uint32_t uncompressed_size; > +uint32_t compressed_size; > +uint8_t compressed_data[0]; > +} SpiceMsgCompressedData; > + > typedef struct SpiceMsgEmpty { > uint8_t padding; > } SpiceMsgEmpty; > diff --git a/spice.proto b/spice.proto > index 4a0778d..ea29fb0 100644 > --- a/spice.proto > +++ b/spice.proto > @@ -120,6 +120,19 @@ message Data { > uint8 data[] @end @ctype(uint8_t); > } @nocopy; > > +enum8 data_compression_type { > +NONE, > +LZ4, > +INVALID, > +}; > + > +message CompressedData { > +data_compression_type type; > +uint32 uncompressed_size; > +uint32 compressed_size; > +uint8 compressed_data[] @end; > +} @ctype(SpiceMsgCompressedData); > + > struct ChannelWait { > uint8 channel_type; > uint8 channel_id; > @@ -1373,8 +1386,10 @@ channel SmartcardChannel : BaseChannel { > channel SpicevmcChannel : BaseChannel { > server: > Data data = 101; > +CompressedData compressed_data = 102; > client: > Data data = 101; > +CompressedData compressed_data = 102; > }; > > channel UsbredirChannel : SpicevmcChannel { > -- > 2.5.5 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH] converts Spice_style.odt to asciidoc spice_style.txt
The conversion try keeps the content as is no matter if updated or not. Asciidoc format is already used for manual. Using a text format make easier to see git diff and send patches. Also it's easier to convert to different format and copy to web pages. Signed-off-by: Frediano Ziglio --- docs/Makefile.am | 7 + docs/Spice_style.odt | Bin 19045 -> 0 bytes docs/spice_style.txt | 406 +++ 3 files changed, 413 insertions(+) delete mode 100644 docs/Spice_style.odt create mode 100644 docs/spice_style.txt diff --git a/docs/Makefile.am b/docs/Makefile.am index 18e785f..8321592 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,3 +1,10 @@ +ASCIIDOC_FLAGS = -a icons -a toc + if BUILD_MANUAL SUBDIRS = manual + +all-local: spice_style.html + +.txt.html: + $(AM_V_GEN) $(ASCIIDOC) $(ASCIIDOC_FLAGS) -o $@ $< endif diff --git a/docs/Spice_style.odt b/docs/Spice_style.odt deleted file mode 100644 index efdcd1a62ba0c4995e470b6a5ec22301f24ab340.. GIT binary patch literal 0 HcmV?d1 literal 19045 zcmbTe1z225vo?wa32wn1g1fuBYj79_8{A!k1$TD{?(P!Y2_d+=Z3s_LrlwN`hnUR|Rk3kih*_UGfr#H&BRflAvt>36X0*PmgFE%% z<*9tBqpJ(+)a0AJZQG_f+hJ{!a=>-*ve$-oc|xvhiFgf5743T?PCDNFPK|nRO^#J^ zPi8#TCMHWZ16iq=wl?~5RM#e)@~NUU9ZgQn4fTr=3H!J7w3NE5$ZE`T?BkbwY(P|* z)Ve+qHXCH}Nwc7Bx807@{ow94YD-MMANdZzhLw=DzS4-^J$gc`*0xa2rv97 ztw0jr)f6Nb;9!I$(N zV>=>TWazkL(fMH6{`m`Y{3bN|R|@e4Y;^ikXc-TP{O{k8we;-Y>*1&BJ#Dw4qhYV6 zG$bobh)z$;^c+bbe>B|WMVBuk2slh~ec=@l%O4DUjYRZybU3j*z234q)}(|A25MTE zYDZf#CX3m%yJKkHe80F`I^C72lw+b{8X`#7wQNjQnZ8|IzR<5q+(N$k;tNq}azlK> z5;9g$XD5G%RwF5p-YGC{we9gOC(#~y{Ng@6KJ;EFvfaZs&v*8vnfQ~SL9IYMa@2|O zY^DZRfzONbUee-Eb^yvGen9KZtb9cHJ6MH25s1FHcZ<6`tn>{a*EGw`cD+Vtb=)GH zD9bvW>+#{}C=>k39pZ5#E4`?2dF!iF`N^^$jqLKYrLp2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S6hD7nne-=znG0P=E6zvRbR zUPlaPut5cM2c72=U
[Spice-devel] [PATCH v2] converts Spice_style.odt to asciidoc spice_style.txt
The conversion try keeps the content as is no matter if updated or not. Asciidoc format is already used for manual. Using a text format make easier to see git diff and send patches. Also it's easier to convert to different format and copy to web pages. Signed-off-by: Frediano Ziglio --- docs/Makefile.am | 7 + docs/Spice_style.odt | Bin 19045 -> 0 bytes docs/spice_style.txt | 450 +++ 3 files changed, 457 insertions(+) delete mode 100644 docs/Spice_style.odt create mode 100644 docs/spice_style.txt Changes since v1: - use different format for sections; - use link instead of section number. diff --git a/docs/Makefile.am b/docs/Makefile.am index 18e785f..f1759f8 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,3 +1,10 @@ +ASCIIDOC_FLAGS = -a icons -a toc + if BUILD_MANUAL SUBDIRS = manual + +all-local: spice_style.html + +spice_style.html: spice_style.txt + $(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $< endif diff --git a/docs/Spice_style.odt b/docs/Spice_style.odt deleted file mode 100644 index efdcd1a62ba0c4995e470b6a5ec22301f24ab340.. GIT binary patch literal 0 HcmV?d1 literal 19045 zcmbTe1z225vo?wa32wn1g1fuBYj79_8{A!k1$TD{?(P!Y2_d+=Z3s_LrlwN`hnUR|Rk3kih*_UGfr#H&BRflAvt>36X0*PmgFE%% z<*9tBqpJ(+)a0AJZQG_f+hJ{!a=>-*ve$-oc|xvhiFgf5743T?PCDNFPK|nRO^#J^ zPi8#TCMHWZ16iq=wl?~5RM#e)@~NUU9ZgQn4fTr=3H!J7w3NE5$ZE`T?BkbwY(P|* z)Ve+qHXCH}Nwc7Bx807@{ow94YD-MMANdZzhLw=DzS4-^J$gc`*0xa2rv97 ztw0jr)f6Nb;9!I$(N zV>=>TWazkL(fMH6{`m`Y{3bN|R|@e4Y;^ikXc-TP{O{k8we;-Y>*1&BJ#Dw4qhYV6 zG$bobh)z$;^c+bbe>B|WMVBuk2slh~ec=@l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#?6(467MEqh-e?+|l;8yJ^?mI}#D}Q5 z!dEY?cxaSCEmpVAa%o7_t#TXzgW0dbQTDSDZ_+BcEtuI=b8frF7+VUDG8Fj5+O8GT z$tWrlM*i++BxfqKbOrd&un}L_EqfiLl#Rk^m79&5hjz+7WlY63I!*3C&{km@#o3L| z@tnzpdzerU(*knvSXiJ?^rWe#_M
Re: [Spice-devel] [PATCH v2] converts Spice_style.odt to asciidoc spice_style.txt
Hi Frediano, Thanks! You can add Related: https://bugs.freedesktop.org/show_bug.cgi?id=95258 And the generated file should be removed on clean. Also make distcheck is failing for me: No rule to make target 'spice_style.txt', needed by 'spice_style.html'. Stop. Thanks, Pavel On Tue, 2016-05-10 at 13:16 +0100, Frediano Ziglio wrote: > The conversion try keeps the content as is no matter if updated or not. > Asciidoc format is already used for manual. > Using a text format make easier to see git diff and send patches. > Also it's easier to convert to different format and copy to web pages. > > Signed-off-by: Frediano Ziglio > --- > docs/Makefile.am | 7 + > docs/Spice_style.odt | Bin 19045 -> 0 bytes > docs/spice_style.txt | 450 > +++ > 3 files changed, 457 insertions(+) > delete mode 100644 docs/Spice_style.odt > create mode 100644 docs/spice_style.txt > > Changes since v1: > - use different format for sections; > - use link instead of section number. > > diff --git a/docs/Makefile.am b/docs/Makefile.am > index 18e785f..f1759f8 100644 > --- a/docs/Makefile.am > +++ b/docs/Makefile.am > @@ -1,3 +1,10 @@ > +ASCIIDOC_FLAGS = -a icons -a toc > + > if BUILD_MANUAL > SUBDIRS = manual > + > +all-local: spice_style.html > + > +spice_style.html: spice_style.txt > + $(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $< > endif > diff --git a/docs/Spice_style.odt b/docs/Spice_style.odt > deleted file mode 100644 > index > efdcd1a62ba0c4995e470b6a5ec22301f24ab340.. > > GIT binary patch > literal 0 > HcmV?d1 > > literal 19045 > zcmbTe1z225vo?wa32wn1g1fuBYj79_8{A!k1$TD{?(P!Y2_d+ zpL6d#(>=Z3s_L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vtK%V`TeX}=gYI3IFYF8;bv^Y > zQuJ9<_{t4#5~5Hun>dL72C9 z3O)y!`IF|?8^$A)qAk9<`c4-)L$&PtQkx$#
Re: [Spice-devel] [spice v13 11/29] server: Avoid copying the input frame in the GStreamer encoder
On Tue, Apr 19, 2016 at 09:49:44AM +0200, Francois Gouget wrote: > Note that we can only avoid copies for the first 1 Mpixels or so. > That's because Spice splits larger frames into more chunks than we can > fit GstMemory fragments in a GStreamer buffer. So if there are more > pixels we will avoid copies for the first 3840 KB and copy the rest. > Furthermore, while in practice the GStreamer encoder will only modify > the RedDrawable refcount during the encode_frame(), in theory the > refcount could be decremented from the GStreamer thread after > encode_frame() returns. > > Signed-off-by: Francois Gouget > --- > server/dcc-send.c | 13 +-- > server/gstreamer-encoder.c | 199 > + > server/mjpeg-encoder.c | 5 +- > server/stream.c| 16 +++- > server/video-encoder.h | 25 +- > 5 files changed, 231 insertions(+), 27 deletions(-) > > diff --git a/server/dcc-send.c b/server/dcc-send.c > index a2aea2a..68b026e 100644 > --- a/server/dcc-send.c > +++ b/server/dcc-send.c > @@ -1656,12 +1656,12 @@ static void red_release_video_encoder_buffer(uint8_t > *data, void *opaque) > } > > static int red_marshall_stream_data(RedChannelClient *rcc, > -SpiceMarshaller *base_marshaller, > Drawable *drawable) > +SpiceMarshaller *base_marshaller, > +Drawable *drawable) > { > DisplayChannelClient *dcc = RCC_TO_DCC(rcc); > DisplayChannel *display = DCC_TO_DC(dcc); > Stream *stream = drawable->stream; > -SpiceImage *image; > uint32_t frame_mm_time; > int width, height; > int ret; > @@ -1670,10 +1670,10 @@ static int red_marshall_stream_data(RedChannelClient > *rcc, > spice_assert(drawable->sized_stream); > stream = drawable->sized_stream; > } > -spice_assert(drawable->red_drawable->type == QXL_DRAW_COPY); > - > -image = drawable->red_drawable->u.copy.src_bitmap; > +RedDrawable *red_drawable = drawable->red_drawable; > +spice_assert(red_drawable->type == QXL_DRAW_COPY); > > +SpiceImage *image = red_drawable->u.copy.src_bitmap; > if (image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP) { > return FALSE; > } > @@ -1715,7 +1715,8 @@ static int red_marshall_stream_data(RedChannelClient > *rcc, > frame_mm_time, > &image->u.bitmap, width, height, > > &drawable->red_drawable->u.copy.src_area, > - stream->top_down, &outbuf); > + stream->top_down, red_drawable, > + &outbuf); > switch (ret) { > case VIDEO_ENCODER_FRAME_DROP: > spice_assert(dcc->use_video_encoder_rate_control); > diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c > index f9b3579..7929dd8 100644 > --- a/server/gstreamer-encoder.c > +++ b/server/gstreamer-encoder.c > @@ -30,6 +30,8 @@ > > #define SPICE_GST_DEFAULT_FPS 30 > > +#define DO_ZERO_COPY > + Why do we want to make it possible to compile out? I believe the implementation is more robust now that it initially was? Do you still expect some people will want to disable it? > > typedef struct { > SpiceBitmapFmt spice_format; > @@ -46,6 +48,14 @@ typedef struct SpiceGstVideoBuffer { > typedef struct SpiceGstEncoder { > VideoEncoder base; > > +/* Callbacks to adjust the refcount of the bitmap being encoded. */ > +bitmap_ref_t bitmap_ref; > +bitmap_unref_t bitmap_unref; > + > +#ifdef DO_ZERO_COPY > +GAsyncQueue *unused_bitmap_opaques; > +#endif > + > /* Rate control callbacks */ > VideoEncoderRateControlCbs cbs; > > @@ -483,12 +493,109 @@ static inline int line_copy(SpiceGstEncoder *encoder, > const SpiceBitmap *bitmap, > return TRUE; > } > > +#ifdef DO_ZERO_COPY > +typedef struct { > +gint refs; > +SpiceGstEncoder *encoder; > +gpointer opaque; > +} BitmapWrapper; > + > +static void clear_zero_copy_queue(SpiceGstEncoder *encoder, gboolean > unref_queue) > +{ > +gpointer bitmap_opaque; > +while ((bitmap_opaque = > g_async_queue_try_pop(encoder->unused_bitmap_opaques))) { > +encoder->bitmap_unref(bitmap_opaque); > +} > +if (unref_queue) { > +g_async_queue_unref(encoder->unused_bitmap_opaques); > +} > +} > + > +static BitmapWrapper *bitmap_wrapper_new(SpiceGstEncoder *encoder, gpointer > bitmap_opaque) > +{ > +BitmapWrapper *wrapper = spice_new(BitmapWrapper, 1); > +wrapper->refs = 1; > +wrapper->encoder = encoder; > +wrapper->opaque = bitmap_opaque; > +encoder->bitmap_ref(bitmap_opaque); > +return wrapper; > +} > + > +static void bitmap_wrapper_unref(gpointer data) > +{ > +BitmapWrapper *wrapper = da
Re: [Spice-devel] [PATCH v2] converts Spice_style.odt to asciidoc spice_style.txt
On Tue, May 10, 2016 at 02:27:42PM +0200, Pavel Grunt wrote: > Hi Frediano, > > Thanks! You can add > Related: https://bugs.freedesktop.org/show_bug.cgi?id=95258 > > And the generated file should be removed on clean. Also make distcheck is > failing for me: > > No rule to make target 'spice_style.txt', needed by 'spice_style.html'. Stop. I think it's because spice_style.txt is missing from EXTRA_DIST, so is not shipped in the tarball. Christophe signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH 0/2 v3] converts Spice_style.odt to asciidoc spice_style.txt
Changes since v2: - split conversion and cleanup; - fixed make distcheck distributing files. Frediano Ziglio (2): converts Spice_style.odt to asciidoc spice_style.txt removed converted Spice_style.odf docs/Makefile.am | 13 ++ docs/Spice_style.odt | Bin 19045 -> 0 bytes docs/spice_style.txt | 450 +++ 3 files changed, 463 insertions(+) delete mode 100644 docs/Spice_style.odt create mode 100644 docs/spice_style.txt -- 2.5.5 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH 1/2 v3] converts Spice_style.odt to asciidoc spice_style.txt
The conversion try keeps the content as is no matter if updated or not. Asciidoc format is already used for manual. Using a text format make easier to see git diff and send patches. Also it's easier to convert to different format and copy to web pages. Signed-off-by: Frediano Ziglio --- docs/Makefile.am | 13 ++ docs/spice_style.txt | 450 +++ 2 files changed, 463 insertions(+) create mode 100644 docs/spice_style.txt diff --git a/docs/Makefile.am b/docs/Makefile.am index 18e785f..a3e418a 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,3 +1,16 @@ +NULL = +ASCIIDOC_FLAGS = -a icons -a toc + +EXTRA_DIST = \ + spice_style.html\ + spice_style.txt \ + $(NULL) + if BUILD_MANUAL SUBDIRS = manual + +all-local: spice_style.html + +spice_style.html: spice_style.txt + $(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $< endif diff --git a/docs/spice_style.txt b/docs/spice_style.txt new file mode 100644 index 000..895126a --- /dev/null +++ b/docs/spice_style.txt @@ -0,0 +1,450 @@ +Spice project coding style and coding conventions += + +Draft 2 + +Copyright (C) 2009 Red Hat, Inc. +Licensed under a Creative Commons Attribution-Share Alike 3.0 +United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/legalcode). + + +C and C++ style +--- + +All of the following are applicable for both c and c+\+, except for <>. + +Source Files + + +Names +~ + +Use lower case and separate words using underscore (e.g., file_name.c, header.h). + +Use cpp file extension for c\++ source files and hpp extension for c++ template files. Use standard file extension for c source and header files. + +Line width +~~ + +No more then 100 character on a single line + +Tabs + + +Tabs are not allowed, use 4 spaces instead + +White spaces + + +Trailing white spaces are not allowed + +New Line + + +Use Unix style line ending (i.e., LF) + +New line (i.e., EOL) must be the last char in the file + +Comparing +- + +Use right-hand comparison style. + +Examples: + + use `(var == 7)` instead of `(7 == var)` + + use `(function(var) > 7)` instead of `(7 < function(var))` + +TRUE, FALSE and NULL + + +Use TRUE FALSE and NULL instead of 1 and 0 in order to improve code readability. TRUE FALSE is not relevant for c++, in c++ use the built-in bool type. + +Static storage initialization +- + +To improve code readability, explicitly initialize variables that depend on default initialization with zero/null. + +Fixme and todo +-- + +Comments that are prefixed with `fixme` describe a bug that need to be fixed. Generally, it is not allowed to commit new code having `fixme` comment. Committing `fixme` is allowed only for existing bugs. Comments that are prefixed with `todo` describe further features, optimization or code improvements, and they are allowed to be committed along with the relevant code. + +ASSERT +-- + +Use it freely. ASSERT helps testing function arguments and function results validity. ASSERT helps detecting bugs and improve code readability and stability. + +sizeof +-- + +Apply function style to `sizeof` (i.e., use `sizeof(x)`) + +const +- + +Use const keyword when applicable to improve code reliability and celerity. + +goto + + +Using goto is allowed in c code for error handling. In any other case it will be used only as a special exception. + +Defining Constant values + + +Use defines for constant values for improving readability and ease of changes. Alternatively, use global `const` variables. + +void argument +- + +Don't add explicitly void argument in functions without arguments. (i.e., void function_name() is OK) + +Short functions +--- + +Try to split code to short functions, each having simple functionality, in order to improve code readability and re-usability. Prefix with inline short functions or functions that were splitted for readability reason. + +Return on if + + +Try to return immediately on if in places that can reduce indentation level. + +Example: + +prefer +[source,c] + +void function(int *n) +{ +if (!n) { +return; +} +... +} + +on +[source,c] + +void function(int *n) +{ +if (!n) { +return; +} else { +... +} +} + + +Names +- + +* Don't underestimate the importance of name choosing. Good names make the code more easy to understand and reduce the required level of code documentation. When choosing names, prefer long meaningful names over short vague name. +* Variable and Function names - use lower case and separate words using underscore (e.g., sample_variable_name) +* Structures, class and enum names -
[Spice-devel] [PATCH 2/2 v3] removed converted Spice_style.odf
Signed-off-by: Frediano Ziglio --- docs/Spice_style.odt | Bin 19045 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/Spice_style.odt diff --git a/docs/Spice_style.odt b/docs/Spice_style.odt deleted file mode 100644 index efdcd1a62ba0c4995e470b6a5ec22301f24ab340.. GIT binary patch literal 0 HcmV?d1 literal 19045 zcmbTe1z225vo?wa32wn1g1fuBYj79_8{A!k1$TD{?(P!Y2_d+=Z3s_LrlwN`hnUR|Rk3kih*_UGfr#H&BRflAvt>36X0*PmgFE%% z<*9tBqpJ(+)a0AJZQG_f+hJ{!a=>-*ve$-oc|xvhiFgf5743T?PCDNFPK|nRO^#J^ zPi8#TCMHWZ16iq=wl?~5RM#e)@~NUU9ZgQn4fTr=3H!J7w3NE5$ZE`T?BkbwY(P|* z)Ve+qHXCH}Nwc7Bx807@{ow94YD-MMANdZzhLw=DzS4-^J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sbHh8jL7PJxf3iJ6@^G4P8hNM?Hugo&NMVA%c8y&fES-h9ZhMv za$#s{w07JL*?+hyV2+J;m>J9N5h0&`ue|t~KFNFZyXf`yQ$NA}Tso)mIZI{aM!9
[Spice-devel] [PATCH] fix "spice--gtk" typo in configure.ac
Signed-off-by: Frediano Ziglio --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8419508..524e845 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,7 @@ dnl Check optional features SPICE_CHECK_SMARTCARD AC_ARG_ENABLE([automated_tests], - AS_HELP_STRING([--enable-automated-tests], [Enable automated tests using spicy-screenshot (part of spice--gtk)]),, + AS_HELP_STRING([--enable-automated-tests], [Enable automated tests using spicy-screenshot (part of spice-gtk)]),, [enable_automated_tests="no"]) AS_IF([test x"$enable_automated_tests" != "xno"], [enable_automated_tests="yes"]) AM_CONDITIONAL(HAVE_AUTOMATED_TESTS, test "x$enable_automated_tests" != "xno") -- 2.5.5 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH] fix "spice--gtk" typo in configure.ac
Acked-by: Christophe Fergeau On Tue, May 10, 2016 at 01:57:19PM +0100, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio > --- > configure.ac | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index 8419508..524e845 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -70,7 +70,7 @@ dnl Check optional features > SPICE_CHECK_SMARTCARD > > AC_ARG_ENABLE([automated_tests], > - AS_HELP_STRING([--enable-automated-tests], [Enable automated > tests using spicy-screenshot (part of spice--gtk)]),, > + AS_HELP_STRING([--enable-automated-tests], [Enable automated > tests using spicy-screenshot (part of spice-gtk)]),, >[enable_automated_tests="no"]) > AS_IF([test x"$enable_automated_tests" != "xno"], > [enable_automated_tests="yes"]) > AM_CONDITIONAL(HAVE_AUTOMATED_TESTS, test "x$enable_automated_tests" != > "xno") > -- > 2.5.5 > > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH v2 2/2] fix crash if agent interface is removed
Hey, On Mon, May 09, 2016 at 11:20:00AM -0400, Frediano Ziglio wrote: > > > > Hey, > > > > On Mon, May 09, 2016 at 10:03:03AM +0100, Frediano Ziglio wrote: > > > Removing an interface cause SpiceBaseInstance->st to be set to NULL. > > > This pointer was then deferenced in agent code. > > > As SpiceBaseInstance should not be used after this call make sure > > > we don't keep pointers to it. > > > > I guess it cannot hurt... However, it would be a good time to document > > how we expect char_device_attach/remove to behave wrt to the lifetime of > > the various instances we have (char device, sin, vdagent, ...). > > > > Christophe > > > > Do you have any suggestion on where to document this? Some new text file in a docs/ subdirectory? > Do you think this is a stopover for the patch? If these 'rules' are fairly clear in your mind as you just worked on it, it would be good to do a braindump now yeah as it will be more work later. If you already don't quite remember, then no big deal. > Do you think the fix should be done in another way? Unfortunately it has been a long time that I looked at that code, so I don't really have alternative suggestions :( Christophe signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH 1/2] unify header include order
Use this style for include headers inside headers: #include #include #include #include #include "spice_server.h" Signed-off-by: Frediano Ziglio --- server/cache-item.h | 3 ++- server/dcc-encoders.h | 1 + server/dispatcher.h | 1 + server/display-channel.h| 1 - server/glz-encoder.h| 3 ++- server/image-cache.h| 1 - server/main-channel.h | 1 + server/main-dispatcher.h| 2 +- server/memslot.h| 4 ++-- server/migration-protocol.h | 1 + server/red-channel.h| 1 - server/red-common.h | 4 ++-- server/red-parse-qxl.h | 1 + server/red-record-qxl.h | 1 + server/red-replay-qxl.h | 3 ++- server/reds-stream.h| 9 - server/reds.h | 4 +--- server/stream.h | 3 ++- server/tree.h | 1 + 19 files changed, 25 insertions(+), 20 deletions(-) diff --git a/server/cache-item.h b/server/cache-item.h index f72c0ff..d14e9a3 100644 --- a/server/cache-item.h +++ b/server/cache-item.h @@ -18,9 +18,10 @@ #ifndef CACHE_ITEM_H_ # define CACHE_ITEM_H_ -#include "red-channel.h" #include +#include "red-channel.h" + typedef struct RedCacheItem RedCacheItem; struct RedCacheItem { diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 14759c5..84f9f93 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -21,6 +21,7 @@ #include #include #include + #include "red-channel.h" #include "red-parse-qxl.h" #include "image-cache.h" diff --git a/server/dispatcher.h b/server/dispatcher.h index caaebc5..07b1137 100644 --- a/server/dispatcher.h +++ b/server/dispatcher.h @@ -19,6 +19,7 @@ #define DISPATCHER_H #include + #include "red-common.h" #define TYPE_DISPATCHER dispatcher_get_type() diff --git a/server/display-channel.h b/server/display-channel.h index 1d20be0..76668de 100644 --- a/server/display-channel.h +++ b/server/display-channel.h @@ -19,7 +19,6 @@ # define DISPLAY_CHANNEL_H_ #include - #include #include diff --git a/server/glz-encoder.h b/server/glz-encoder.h index 6f4f44d..acc32b2 100644 --- a/server/glz-encoder.h +++ b/server/glz-encoder.h @@ -20,8 +20,9 @@ /* Manging the lz encoding using a dictionary that is shared among encoders */ -#include "red-common.h" #include + +#include "red-common.h" #include "glz-encoder-dict.h" struct GlzEncoderUsrContext { diff --git a/server/image-cache.h b/server/image-cache.h index f61aeb4..38a318e 100644 --- a/server/image-cache.h +++ b/server/image-cache.h @@ -19,7 +19,6 @@ #define IMAGE_CACHE_H_ #include - #include #include #include diff --git a/server/main-channel.h b/server/main-channel.h index 473ed6f..4eb9a9c 100644 --- a/server/main-channel.h +++ b/server/main-channel.h @@ -21,6 +21,7 @@ #include #include #include + #include "red-channel.h" // TODO: Defines used to calculate receive buffer size, and also by reds.c diff --git a/server/main-dispatcher.h b/server/main-dispatcher.h index ffe82c8..9a425de 100644 --- a/server/main-dispatcher.h +++ b/server/main-dispatcher.h @@ -18,7 +18,7 @@ #ifndef MAIN_DISPATCHER_H #define MAIN_DISPATCHER_H -#include +#include "spice.h" #include "dispatcher.h" #include "red-channel.h" diff --git a/server/memslot.h b/server/memslot.h index 0caa627..a29837c 100644 --- a/server/memslot.h +++ b/server/memslot.h @@ -19,10 +19,10 @@ #ifndef MEMSLOT_H_ #define MEMSLOT_H_ -#include "red-common.h" - #include +#include "red-common.h" + typedef struct MemSlot { int generation; unsigned long virt_start_addr; diff --git a/server/migration-protocol.h b/server/migration-protocol.h index c1d97ef..16eafbe 100644 --- a/server/migration-protocol.h +++ b/server/migration-protocol.h @@ -20,6 +20,7 @@ #include #include + #include "glz-encoder-dict.h" /* diff --git a/server/red-channel.h b/server/red-channel.h index bc225c6..03e6407 100644 --- a/server/red-channel.h +++ b/server/red-channel.h @@ -24,7 +24,6 @@ #include #include - #include #include diff --git a/server/red-common.h b/server/red-common.h index 3a63f04..b92bbee 100644 --- a/server/red-common.h +++ b/server/red-common.h @@ -18,14 +18,14 @@ #ifndef _H_RED_COMMON #define _H_RED_COMMON -#include - #include #include #include #include #include +#include + #include #include #include diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h index 9c30572..0749b88 100644 --- a/server/red-parse-qxl.h +++ b/server/red-parse-qxl.h @@ -20,6 +20,7 @@ #define RED_ABI_TRANSLATE_H #include + #include "red-common.h" #include "memslot.h" diff --git a/server/red-record-qxl.h b/server/red-record-qxl.h index 21f0bc9..d5eaaa0 100644 --- a/server/red-record-qxl.h +++ b/server/red-record-qxl.h @@ -20,6 +20,7 @@ #define RED_ABI_RECORD_H #include + #include "red-common.h" #include "memslot.h" diff --git a/server/red-replay-qxl.h b/server/red-replay
[Spice-devel] [PATCH 2/2] EXP: try to minimize header dependencies
Different headers changes: - every header must be auto sufficient; - include an header only if definitions are necessary (ie: don't include just to use some structure pointers). Signed-off-by: Frediano Ziglio --- server/agent-msg-filter.h | 9 ++--- server/cache-item.h | 3 +-- server/char-device.h| 3 +-- server/cursor-channel.h | 3 --- server/dcc-encoders.h | 41 +++-- server/dcc-send.c | 8 +--- server/dcc.c| 2 ++ server/dcc.h| 10 ++ server/demarshallers.h | 3 +++ server/dispatcher.c | 2 ++ server/dispatcher.h | 3 +-- server/display-channel.c| 3 +++ server/display-channel.h| 24 ++-- server/glz-encoder-priv.h | 5 - server/glz-encoder.h| 1 - server/inputs-channel.h | 2 ++ server/main-dispatcher.h| 1 - server/memslot.c| 3 +-- server/memslot.h| 2 -- server/migration-protocol.h | 1 + server/pixmap-cache.c | 1 + server/pixmap-cache.h | 10 +++--- server/red-channel.h| 4 +--- server/red-parse-qxl.h | 8 +--- server/red-pipe-item.h | 1 + server/red-qxl.h| 1 - server/red-record-qxl.h | 7 --- server/red-replay-qxl.h | 2 +- server/red-worker.c | 3 +++ server/red-worker.h | 3 +-- server/reds-private.h | 5 + server/reds-stream.h| 3 --- server/reds.h | 3 +-- server/smartcard.h | 2 ++ server/sound.h | 6 -- server/spice-bitmap-utils.h | 5 - server/stat.h | 2 ++ server/stream.c | 2 ++ server/stream.h | 1 - server/tests/replay.c | 1 + server/tests/test-qxl-parsing.c | 1 + server/tree.h | 3 +-- server/utils.h | 3 ++- server/video-encoder.h | 3 +++ server/zlib-encoder.h | 2 ++ 45 files changed, 117 insertions(+), 94 deletions(-) diff --git a/server/agent-msg-filter.h b/server/agent-msg-filter.h index 836ddbd..e7eef1a 100644 --- a/server/agent-msg-filter.h +++ b/server/agent-msg-filter.h @@ -21,6 +21,9 @@ #ifndef _H_AGENT_MSG_FILTER #define _H_AGENT_MSG_FILTER +#include +#include + /* Possible return values for agent_msg_filter_process_data */ enum { AGENT_MSG_FILTER_OK, @@ -39,14 +42,14 @@ typedef struct AgentMsgFilter { gboolean discard_all; } AgentMsgFilter; -void agent_msg_filter_init(struct AgentMsgFilter *filter, +void agent_msg_filter_init(AgentMsgFilter *filter, gboolean copy_paste, gboolean file_xfer, gboolean use_client_monitors_config, gboolean discard_all); -void agent_msg_filter_config(struct AgentMsgFilter *filter, +void agent_msg_filter_config(AgentMsgFilter *filter, gboolean copy_paste, gboolean file_xfer, gboolean use_client_monitors_config); -int agent_msg_filter_process_data(struct AgentMsgFilter *filter, +int agent_msg_filter_process_data(AgentMsgFilter *filter, uint8_t *data, uint32_t len); #endif diff --git a/server/cache-item.h b/server/cache-item.h index d14e9a3..f13a69a 100644 --- a/server/cache-item.h +++ b/server/cache-item.h @@ -19,8 +19,7 @@ # define CACHE_ITEM_H_ #include - -#include "red-channel.h" +#include "red-pipe-item.h" typedef struct RedCacheItem RedCacheItem; diff --git a/server/char-device.h b/server/char-device.h index 3ac28fd..2f8048a 100644 --- a/server/char-device.h +++ b/server/char-device.h @@ -20,9 +20,8 @@ #include -#include "spice.h" -#include "red-channel.h" #include "migration-protocol.h" +#include "red-channel.h" #define RED_TYPE_CHAR_DEVICE red_char_device_get_type() diff --git a/server/cursor-channel.h b/server/cursor-channel.h index 4dad4b6..3b56824 100644 --- a/server/cursor-channel.h +++ b/server/cursor-channel.h @@ -18,10 +18,7 @@ #ifndef CURSOR_CHANNEL_H_ # define CURSOR_CHANNEL_H_ -#include "spice.h" -#include "reds.h" #include "red-worker.h" -#include "red-parse-qxl.h" typedef struct CursorChannel CursorChannel; typedef struct CursorChannelClient CursorChannelClient; diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h index 84f9f93..5f2f519 100644 --- a/server/dcc-encoders.h +++ b/server/dcc-encoders.h @@ -19,12 +19,13 @@ #define DCC_ENCODERS_H_ #include + #include #include +#include +#include -#include "red-channel.h" #include "red-parse-qxl.h" -#include "image-cache.h" #include "glz-encoder.h" #include "jpeg-encoder.h" #ifdef USE_LZ4 @@ -32,21 +33,25 @@ #endif #include "zlib-encoder.h" +struct RedClient; +struct Drawab
Re: [Spice-devel] [PATCH v2 2/2] fix crash if agent interface is removed
> > Hey, > > On Mon, May 09, 2016 at 11:20:00AM -0400, Frediano Ziglio wrote: > > > > > > Hey, > > > > > > On Mon, May 09, 2016 at 10:03:03AM +0100, Frediano Ziglio wrote: > > > > Removing an interface cause SpiceBaseInstance->st to be set to NULL. > > > > This pointer was then deferenced in agent code. > > > > As SpiceBaseInstance should not be used after this call make sure > > > > we don't keep pointers to it. > > > > > > I guess it cannot hurt... However, it would be a good time to document > > > how we expect char_device_attach/remove to behave wrt to the lifetime of > > > the various instances we have (char device, sin, vdagent, ...). > > > > > > Christophe > > > > > > > Do you have any suggestion on where to document this? > > Some new text file in a docs/ subdirectory? > Personally I prefer to use Doxygen, external documentation tend to be out of date compared to inline documentation. I know we use some gnome inline documentation style but honestly I think it's much less powerful than Doxygen (or I don't know gnome documentation that much). > > Do you think this is a stopover for the patch? > > If these 'rules' are fairly clear in your mind as you just worked on it, > it would be good to do a braindump now yeah as it will be more work > later. If you already don't quite remember, then no big deal. > The lifespan of a "SpiceBaseInterface" for spice-server is from spice_server_add_interface to spice_server_remove_interface. > > Do you think the fix should be done in another way? > > Unfortunately it has been a long time that I looked at that code, so I > don't really have alternative suggestions :( > > Christophe > I'll post another version with code comment(s). Frediano ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH v3] fix crash if agent interface is removed
Removing an interface cause SpiceBaseInstance->st to be set to NULL. This pointer was then deferenced in agent code. As SpiceBaseInstance should not be used after this call make sure we don't keep pointers to it. Signed-off-by: Frediano Ziglio --- server/reds.c | 1 + server/spice-server.h | 5 + 2 files changed, 6 insertions(+) Changes from v2: - added a comment to spice_server_remove_interface. diff --git a/server/reds.c b/server/reds.c index f54534a..34de3b0 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3264,6 +3264,7 @@ static void spice_server_char_device_remove_interface(RedsState *reds, SpiceBase if (strcmp(char_device->subtype, SUBTYPE_VDAGENT) == 0) { if (reds->vdagent) { reds_agent_remove(reds); + red_char_device_reset_dev_instance(RED_CHAR_DEVICE(reds->agent_dev), NULL); } } #ifdef USE_SMARTCARD diff --git a/server/spice-server.h b/server/spice-server.h index d309f18..ebfa90e 100644 --- a/server/spice-server.h +++ b/server/spice-server.h @@ -67,6 +67,11 @@ int spice_server_add_ssl_client(SpiceServer *s, int socket, int skip_auth); int spice_server_add_interface(SpiceServer *s, SpiceBaseInstance *sin); +/** + * Remove an interface from SpiceServer. + * SpiceServer won't be use the interface anymore so can + * be freed or reused. + */ int spice_server_remove_interface(SpiceBaseInstance *sin); // Needed for backward API compatibility -- 2.5.5 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH v3] fix crash if agent interface is removed
On 05/10/2016 10:38 AM, Frediano Ziglio wrote: > Removing an interface cause SpiceBaseInstance->st to be set to NULL. > This pointer was then deferenced in agent code. > As SpiceBaseInstance should not be used after this call make sure > we don't keep pointers to it. > > Signed-off-by: Frediano Ziglio > --- > server/reds.c | 1 + > server/spice-server.h | 5 + > 2 files changed, 6 insertions(+) > > Changes from v2: > - added a comment to spice_server_remove_interface. > > diff --git a/server/reds.c b/server/reds.c > index f54534a..34de3b0 100644 > --- a/server/reds.c > +++ b/server/reds.c > @@ -3264,6 +3264,7 @@ static void > spice_server_char_device_remove_interface(RedsState *reds, SpiceBase > if (strcmp(char_device->subtype, SUBTYPE_VDAGENT) == 0) { > if (reds->vdagent) { > reds_agent_remove(reds); > + > red_char_device_reset_dev_instance(RED_CHAR_DEVICE(reds->agent_dev), NULL); > } > } > #ifdef USE_SMARTCARD > diff --git a/server/spice-server.h b/server/spice-server.h > index d309f18..ebfa90e 100644 > --- a/server/spice-server.h > +++ b/server/spice-server.h > @@ -67,6 +67,11 @@ int spice_server_add_ssl_client(SpiceServer *s, int > socket, int skip_auth); > > int spice_server_add_interface(SpiceServer *s, > SpiceBaseInstance *sin); > +/** > + * Remove an interface from SpiceServer. > + * SpiceServer won't be use the interface anymore so can > + * be freed or reused. > + */ Maybe you wanted to say: "... won't be using the interface anymore, so it can..." > int spice_server_remove_interface(SpiceBaseInstance *sin); > > // Needed for backward API compatibility > -- Eduardo de Barros Lima (Etrunko) Software Engineer - RedHat etru...@redhat.com ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 1/2] spice-gtk-session: Add sync modifiers property
Acked-by: Frediano Ziglio Frediano > > It will help in cases where syncing modifiers keys is complicated: > * not working leds for modifiers keys > * different keyboard layout on the guest side > --- > src/spice-gtk-session.c | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c > index 27623f0..bbcbeeb 100644 > --- a/src/spice-gtk-session.c > +++ b/src/spice-gtk-session.c > @@ -65,6 +65,7 @@ struct _SpiceGtkSessionPrivate { > gbooleanpointer_grabbed; > gbooleankeyboard_has_focus; > gbooleanmouse_has_pointer; > +gbooleansync_modifiers; > }; > > /** > @@ -118,6 +119,7 @@ enum { > PROP_AUTO_CLIPBOARD, > PROP_AUTO_USBREDIR, > PROP_POINTER_GRABBED, > +PROP_SYNC_MODIFIERS, > }; > > static guint32 get_keyboard_lock_modifiers(void) > @@ -185,6 +187,11 @@ static void > spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSessio > > g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs)); > > +if (SPICE_IS_GTK_SESSION(self) && !self->priv->sync_modifiers) { > +SPICE_DEBUG("Syncing modifiers is disabled"); > +return; > +} > + > g_object_get(inputs, "key-modifiers", &guest_modifiers, NULL); > client_modifiers = get_keyboard_lock_modifiers(); > > @@ -332,6 +339,9 @@ static void spice_gtk_session_get_property(GObject > *gobject, > case PROP_POINTER_GRABBED: > g_value_set_boolean(value, s->pointer_grabbed); > break; > +case PROP_SYNC_MODIFIERS: > +g_value_set_boolean(value, s->sync_modifiers); > +break; > default: > G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > break; > @@ -379,6 +389,9 @@ static void spice_gtk_session_set_property(GObject > *gobject, > } > break; > } > +case PROP_SYNC_MODIFIERS: > +s->sync_modifiers = g_value_get_boolean(value); > +break; > default: > G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > break; > @@ -467,6 +480,23 @@ static void > spice_gtk_session_class_init(SpiceGtkSessionClass *klass) >G_PARAM_READABLE | >G_PARAM_STATIC_STRINGS)); > > +/** > + * SpiceGtkSession:sync-modifiers: > + * > + * Automatically sync modifiers (Caps, Num and Scroll locks) with the > guest. > + * > + * Since: 0.32 > + **/ > +g_object_class_install_property > +(gobject_class, PROP_SYNC_MODIFIERS, > + g_param_spec_boolean("sync-modifiers", > + "Sync modifiers", > + "Automatically sync modifiers", > + TRUE, > + G_PARAM_READWRITE | > + G_PARAM_CONSTRUCT | > + G_PARAM_STATIC_STRINGS)); > + > g_type_class_add_private(klass, sizeof(SpiceGtkSessionPrivate)); > } > ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 2/2] spicy: Add option to control syncing modifiers
Acked-by: Frediano Ziglio Frediano > > --- > src/spicy.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/src/spicy.c b/src/spicy.c > index 0475530..0826c03 100644 > --- a/src/spicy.c > +++ b/src/spicy.c > @@ -712,6 +712,7 @@ static const char *spice_display_properties[] = { > static const char *spice_gtk_session_properties[] = { > "auto-clipboard", > "auto-usbredir", > +"sync-modifiers", > }; > > static const GtkToggleActionEntry tentries[] = { > @@ -736,6 +737,10 @@ static const GtkToggleActionEntry tentries[] = { > .label = "Disable inputs", > .callback= G_CALLBACK(menu_cb_bool_prop), > },{ > +.name= "sync-modifiers", > +.label = "Sync modifiers", > +.callback= G_CALLBACK(menu_cb_bool_prop), > +},{ > .name= "auto-clipboard", > .label = "Automatic clipboard sharing between host and guest", > .callback= G_CALLBACK(menu_cb_bool_prop), > @@ -821,6 +826,7 @@ static char ui_xml[] = > " \n" > " \n" > " \n" > +" \n" > " \n" > " \n" > " \n" ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH v4] fix crash if agent interface is removed
Removing an interface cause SpiceBaseInstance->st to be set to NULL. This pointer was then deferenced in agent code. As SpiceBaseInstance should not be used after this call make sure we don't keep pointers to it. Signed-off-by: Frediano Ziglio --- server/reds.c | 1 + server/spice-server.h | 5 + 2 files changed, 6 insertions(+) Changes from v3: - improved comment. diff --git a/server/reds.c b/server/reds.c index f54534a..34de3b0 100644 --- a/server/reds.c +++ b/server/reds.c @@ -3264,6 +3264,7 @@ static void spice_server_char_device_remove_interface(RedsState *reds, SpiceBase if (strcmp(char_device->subtype, SUBTYPE_VDAGENT) == 0) { if (reds->vdagent) { reds_agent_remove(reds); + red_char_device_reset_dev_instance(RED_CHAR_DEVICE(reds->agent_dev), NULL); } } #ifdef USE_SMARTCARD diff --git a/server/spice-server.h b/server/spice-server.h index d309f18..87c5c59 100644 --- a/server/spice-server.h +++ b/server/spice-server.h @@ -67,6 +67,11 @@ int spice_server_add_ssl_client(SpiceServer *s, int socket, int skip_auth); int spice_server_add_interface(SpiceServer *s, SpiceBaseInstance *sin); +/** + * Remove an interface from SpiceServer. + * SpiceServer won't be using the interface anymore, so it can + * be freed or reused. + */ int spice_server_remove_interface(SpiceBaseInstance *sin); // Needed for backward API compatibility -- 2.5.5 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH] reset pointer to RedCharDeviceWriteBuffer calling red_char_device_write_buffer_release
Acked-by: Christophe Fergeau On Mon, May 09, 2016 at 02:21:04PM +0100, Frediano Ziglio wrote: > This code make easier to be sure we don't have dangling pointers > resetting in the function which free the structure. > > Signed-off-by: Frediano Ziglio > --- > server/char-device.c | 21 ++--- > server/char-device.h | 2 +- > server/reds.c| 3 ++- > server/smartcard.c | 3 +-- > server/spicevmc.c| 17 ++--- > 5 files changed, 20 insertions(+), 26 deletions(-) > > diff --git a/server/char-device.c b/server/char-device.c > index 055b232..b67e192 100644 > --- a/server/char-device.c > +++ b/server/char-device.c > @@ -506,9 +506,7 @@ static int red_char_device_write_to_device(RedCharDevice > *dev) > total += n; > write_len -= n; > if (!write_len) { > -RedCharDeviceWriteBuffer *release_buf = dev->priv->cur_write_buf; > -dev->priv->cur_write_buf = NULL; > -red_char_device_write_buffer_release(dev, release_buf); > +red_char_device_write_buffer_release(dev, > &dev->priv->cur_write_buf); > continue; > } > dev->priv->cur_write_buf_pos += n; > @@ -650,8 +648,14 @@ void red_char_device_write_buffer_add(RedCharDevice *dev, > } > > void red_char_device_write_buffer_release(RedCharDevice *dev, > - RedCharDeviceWriteBuffer > *write_buf) > + RedCharDeviceWriteBuffer > **p_write_buf) > { > +RedCharDeviceWriteBuffer *write_buf = *p_write_buf; > +if (!write_buf) { > +return; > +} > +*p_write_buf = NULL; > + > int buf_origin = write_buf->origin; > uint32_t buf_token_price = write_buf->token_price; > RedClient *client = write_buf->client; > @@ -835,14 +839,9 @@ void red_char_device_reset(RedCharDevice *dev) > ring_remove(item); > buf = SPICE_CONTAINEROF(item, RedCharDeviceWriteBuffer, link); > /* tracking the tokens */ > -red_char_device_write_buffer_release(dev, buf); > -} > -if (dev->priv->cur_write_buf) { > -RedCharDeviceWriteBuffer *release_buf = dev->priv->cur_write_buf; > - > -dev->priv->cur_write_buf = NULL; > -red_char_device_write_buffer_release(dev, release_buf); > +red_char_device_write_buffer_release(dev, &buf); > } > +red_char_device_write_buffer_release(dev, &dev->priv->cur_write_buf); > > RING_FOREACH(client_item, &dev->priv->clients) { > RedCharDeviceClient *dev_client; > diff --git a/server/char-device.h b/server/char-device.h > index d05b1fd..ff43baa 100644 > --- a/server/char-device.h > +++ b/server/char-device.h > @@ -228,7 +228,7 @@ RedCharDeviceWriteBuffer > *red_char_device_write_buffer_get_server_no_token( > void red_char_device_write_buffer_add(RedCharDevice *dev, > RedCharDeviceWriteBuffer *write_buf); > void red_char_device_write_buffer_release(RedCharDevice *dev, > -RedCharDeviceWriteBuffer > *write_buf); > + RedCharDeviceWriteBuffer > **p_write_buf); > > /* api for specific char devices */ > > diff --git a/server/reds.c b/server/reds.c > index f54534a..f0ebf0c 100644 > --- a/server/reds.c > +++ b/server/reds.c > @@ -1131,9 +1131,10 @@ void reds_release_agent_data_buffer(RedsState *reds, > uint8_t *buf) > } > > spice_assert(buf == dev->priv->recv_from_client_buf->buf + > sizeof(VDIChunkHeader)); > +/* if we pushed the buffer the buffer is attached to the channel so > don't free it */ > if (!dev->priv->recv_from_client_buf_pushed) { > > red_char_device_write_buffer_release(RED_CHAR_DEVICE(reds->agent_dev), > - > dev->priv->recv_from_client_buf); > + > &dev->priv->recv_from_client_buf); > } > dev->priv->recv_from_client_buf = NULL; > dev->priv->recv_from_client_buf_pushed = FALSE; > diff --git a/server/smartcard.c b/server/smartcard.c > index a42bcd8..e483eec 100644 > --- a/server/smartcard.c > +++ b/server/smartcard.c > @@ -420,8 +420,7 @@ static void > smartcard_channel_release_msg_rcv_buf(RedChannelClient *rcc, > } else { > if (scc->write_buf) { /* msg hasn't been pushed to the guest */ > spice_assert(scc->write_buf->buf == msg); > - > red_char_device_write_buffer_release(RED_CHAR_DEVICE(scc->smartcard), > scc->write_buf); > -scc->write_buf = NULL; > + > red_char_device_write_buffer_release(RED_CHAR_DEVICE(scc->smartcard), > &scc->write_buf); > } > } > } > diff --git a/server/spicevmc.c b/server/spicevmc.c > index 283a8f0..bdaa3c3 100644 > --- a/server/spicevmc.c > +++ b/server/spicevmc.c > @@ -224,10 +224,8 @@ static void > spicevmc_red_channel_client_on_disconnect(RedChan
Re: [Spice-devel] [PATCH 06/14] Replace RedClient::channels with GList
Hey, On Tue, May 03, 2016 at 03:00:22PM -0500, Jonathon Jongsma wrote: > @@ -2086,30 +2083,33 @@ void red_client_set_migration_seamless(RedClient > *client) // dest > > void red_client_migrate(RedClient *client) > { > -RingItem *link, *next; > +GList *link, *next; > RedChannelClient *rcc; > > -spice_printerr("migrate client with #channels %d", client->channels_num); > +spice_printerr("migrate client with #channels %d", > g_list_length(client->channels)); > if (!pthread_equal(pthread_self(), client->thread_id)) { > spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)." >"If one of the threads is != io-thread && != > vcpu-thread," >" this might be a BUG", >client->thread_id, pthread_self()); > } > -RING_FOREACH_SAFE(link, next, &client->channels) { > -rcc = SPICE_CONTAINEROF(link, RedChannelClient, client_link); > +link = client->channels; > +while (link) { When replacing RING_FOREACH_SAFE, you could declare 'next' in the loop block rather than at the same time as 'link'. Christophe > +next = link->next; > +rcc = link->data; > if (red_channel_client_is_connected(rcc)) { > rcc->channel->client_cbs.migrate(rcc); > } > +link = next; > } > } > > void red_client_destroy(RedClient *client) > { > -RingItem *link, *next; > +GList *link, *next; > RedChannelClient *rcc; > > -spice_printerr("destroy client %p with #channels=%d", client, > client->channels_num); > +spice_printerr("destroy client %p with #channels=%d", client, > g_list_length(client->channels)); > if (!pthread_equal(pthread_self(), client->thread_id)) { > spice_warning("client->thread_id (0x%lx) != pthread_self (0x%lx)." >"If one of the threads is != io-thread && != > vcpu-thread," > @@ -2117,10 +2117,12 @@ void red_client_destroy(RedClient *client) >client->thread_id, >pthread_self()); > } > -RING_FOREACH_SAFE(link, next, &client->channels) { > +link = client->channels; > +while (link) { > +next = link->next; > // some channels may be in other threads, so disconnection > // is not synchronous. > -rcc = SPICE_CONTAINEROF(link, RedChannelClient, client_link); > +rcc = link->data; > rcc->destroying = 1; > // some channels may be in other threads. However we currently > // assume disconnect is synchronous (we changed the dispatcher > @@ -2132,6 +2134,7 @@ void red_client_destroy(RedClient *client) > spice_assert(rcc->pipe_size == 0); > spice_assert(rcc->send_data.size == 0); > red_channel_client_destroy(rcc); > +link = next; > } > red_client_unref(client); > } > @@ -2139,12 +2142,12 @@ void red_client_destroy(RedClient *client) > /* client->lock should be locked */ > static RedChannelClient *red_client_get_channel(RedClient *client, int type, > int id) > { > -RingItem *link; > +GList *link; > RedChannelClient *rcc; > RedChannelClient *ret = NULL; > > -RING_FOREACH(link, &client->channels) { > -rcc = SPICE_CONTAINEROF(link, RedChannelClient, client_link); > +for (link = client->channels; link != NULL; link = link->next) { > +rcc = link->data; > if (rcc->channel->type == type && rcc->channel->id == id) { > ret = rcc; > break; > @@ -2157,12 +2160,11 @@ static RedChannelClient > *red_client_get_channel(RedClient *client, int type, int > static void red_client_add_channel(RedClient *client, RedChannelClient *rcc) > { > spice_assert(rcc && client); > -ring_add(&client->channels, &rcc->client_link); > +client->channels = g_list_append(client->channels, rcc); > if (client->during_target_migrate && client->seamless_migrate) { > if (red_channel_client_set_migration_seamless(rcc)) > client->num_migrated_channels++; > } > -client->channels_num++; > } > > MainChannelClient *red_client_get_main(RedClient *client) { > @@ -2175,7 +2177,7 @@ void red_client_set_main(RedClient *client, > MainChannelClient *mcc) { > > void red_client_semi_seamless_migrate_complete(RedClient *client) > { > -RingItem *link, *next; > +GList *link, *next; > > pthread_mutex_lock(&client->lock); > if (!client->during_target_migrate || client->seamless_migrate) { > @@ -2184,12 +2186,15 @@ void > red_client_semi_seamless_migrate_complete(RedClient *client) > return; > } > client->during_target_migrate = FALSE; > -RING_FOREACH_SAFE(link, next, &client->channels) { > -RedChannelClient *rcc = SPICE_CONTAINEROF(link, RedChannelClient, > client_link); > +link = client->channels; > +while (link) { > +next = link->next; > +RedChannel
Re: [Spice-devel] [PATCH 04/14] Replace RedChannel::clients with GList
Hey, This patch mostly looks good to me, a few minor comments: On Tue, May 03, 2016 at 03:00:20PM -0500, Jonathon Jongsma wrote: > Instead of using a Ring, use a GList to store the list of channel > clients. This allows us to iterate the clients without poking inside of > the client struct to get the channel_link. This is required in order to > make the RedChannelClient struct private. > --- > server/display-channel.c | 64 > server/display-channel.h | 16 ++-- > server/main-channel.c| 42 +-- > server/red-channel.c | 193 > --- > server/red-channel.h | 3 +- > server/red-worker.c | 8 +- > server/red-worker.h | 15 ++-- > server/stream.c | 23 +++--- > 8 files changed, 163 insertions(+), 201 deletions(-) > > diff --git a/server/display-channel.c b/server/display-channel.c > index 1f4d66f..8c040d7 100644 > --- a/server/display-channel.c > +++ b/server/display-channel.c > @@ -1200,9 +1198,9 @@ int > display_channel_wait_for_migrate_data(DisplayChannel *display) > } > > spice_debug(NULL); > -spice_warn_if_fail(channel->clients_num == 1); > +spice_warn_if_fail(g_list_length(channel->clients) == 1); > > -rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients), > RedChannelClient, channel_link); > +rcc = channel->clients->data; There are various places in the patch which access directly clients->data, sometimes we assert first that there is a single item in that list, sometimes note. I'd use g_list_nth_data(clients, 0); rather than directly accessing 'clients', this way it's more explicit that we are only dealing with one item in the list. > diff --git a/server/red-worker.c b/server/red-worker.c > index f21fefb..5b6bc7b 100644 > --- a/server/red-worker.c > +++ b/server/red-worker.c > @@ -501,8 +501,8 @@ static void guest_set_client_capabilities(RedWorker > *worker) > int i; > DisplayChannelClient *dcc; > RedChannelClient *rcc; > -RingItem *link, *next; > -uint8_t caps[SPICE_CAPABILITIES_SIZE] = { 0 }; > +GList *link, *next; > +uint8_t caps[58] = { 0 }; /* FIXME: 58?? */ This looks like the 'caps' line shouldn't have been modified. Christophe signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-common 1/3] Remove GL support
There are still some GL_CANVAS occurrences in canvas_base.c after this patch. Apart from that, looks good to me. Christophe On Fri, May 06, 2016 at 05:14:50PM +0200, Pavel Grunt wrote: > It is not needed since spice-server commit > c5c176a5c7718177f23b07981556b5d460627498 signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH 0/2 v4] converts Spice_style.odt to asciidoc spice_style.txt
Changes since v3: - added a comment; - remove another fixed section number in the documentation using a link. Changes since v2: - split conversion and cleanup; - fixed make distcheck distributing files. Frediano Ziglio (2): converts Spice_style.odt to asciidoc spice_style.txt removed converted Spice_style.odf docs/Makefile.am | 13 ++ docs/Spice_style.odt | Bin 19045 -> 0 bytes docs/spice_style.txt | 451 +++ 3 files changed, 464 insertions(+) delete mode 100644 docs/Spice_style.odt create mode 100644 docs/spice_style.txt -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH 2/2 v4] removed converted Spice_style.odf
Signed-off-by: Frediano Ziglio --- docs/Spice_style.odt | Bin 19045 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/Spice_style.odt diff --git a/docs/Spice_style.odt b/docs/Spice_style.odt deleted file mode 100644 index efdcd1a62ba0c4995e470b6a5ec22301f24ab340.. GIT binary patch literal 0 HcmV?d1 literal 19045 zcmbTe1z225vo?wa32wn1g1fuBYj79_8{A!k1$TD{?(P!Y2_d+=Z3s_LrlwN`hnUR|Rk3kih*_UGfr#H&BRflAvt>36X0*PmgFE%% z<*9tBqpJ(+)a0AJZQG_f+hJ{!a=>-*ve$-oc|xvhiFgf5743T?PCDNFPK|nRO^#J^ zPi8#TCMHWZ16iq=wl?~5RM#e)@~NUU9ZgQn4fTr=3H!J7w3NE5$ZE`T?BkbwY(P|* z)Ve+qHXCH}Nwc7Bx807@{ow94YD-MMANdZzhLw=DzS4-^J$gc`*0xa2rv97 ztw0jr)f6Nb;9!I$(N zV>=>TWazkL(fMH6{`m`Y{3bN|R|@e4Y;^ikXc-TP{O{k8we;-Y>*1&BJ#Dw4qhYV6 zG$bobh)z$;^c+bbe>B|WMVBuk2slh~ec=@l%O4DUjYRZybU3j*z234q)}(|A25MTE zYDZf#CX3m%yJKkHe80F`I^C72lw+b{8X`#7wQNjQnZ8|IzR<5q+(N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b8frF7+VUDG8Fj5+O8GT z$tWrlM*i++BxfqKbOrd&un}L_EqfiLl#Rk^m79&5hjz+7WlY63I!*3C&{km@#o3L| z@tnzpdzerU(*knvSXiJ?^rWe#_M?xrmgjKP}?YS_chi%Q@`Bfkw}f=YTMJrt{5 z)uBGZCr?;a0;&O+EMaz6JIPH&+bjJu*E)p?M7}Mpr6S6hD7nne-=znG0P=E6zvRbR zUPlaPut5cM2c72=UMco$-(3-k-dFhB*?T|VjLKu;ihg5#l>w-IB4I)6wsZHvL^D!s zc7BpMMiJkjqbn(rf*=Q*J{q~s2 zcC$x~89WX&A18L5?7Xbx%}XGsPUB?P7u^7VT$1` zRz=FJb;o9!F2|6mgvHrIgBA#4vy(03kjEVQ^R)ch{o4DH_vOmdn!|V8cYp>p+^VE} z?gthF{rDA&lL>7cr2jbHsYr;sV0d-&yNz5X7yL4sMAZ3DhZgf3dr_@Py?j@tYJlAi z&ASOK9)Ls7TDEr++f1T83=+l?>Uf>r-j`@154I@l7bCZygA0O@e_^C)Sl#rD5!|8^X z6&a~J5@*b#BKnjKpy49L4wOU|8+*f2Rsjdw8J;oj`~)-(zD)R1&m;UnGsko{uG}B} zIz-6)E|eIi*rOST`Q9HXLw!9Zm^&Zp5j`=)NObD+HIfoVU0~#q~m3%B9D$v zzQdWy%JfLev5%bgI_nmNL9C13<#k7&OBA6{3p09s8mex-0=inu)MD@PC@;Ia?)o{1 zK7%O*+bX4t`*qIKaWZWe3Vj;8qi*rIb$~$%?ztbst&^u+^=b8xHibtSPQj6e2)E0| zk;d*_t}vKrY*WhnsbHh8jL7PJxf3iJ6@^G4P8hNM?Hugo&NMVA%c8y&fES-h9ZhMv za$#s{w07JL*?+hyV2+J;m>J9N5h0&`ue|t~KFNFZyXf`yQ$NA}Tso)mIZI{aM!9
[Spice-devel] [PATCH 1/2 v4] converts Spice_style.odt to asciidoc spice_style.txt
The conversion try keeps the content as is no matter if updated or not. Asciidoc format is already used for manual. Using a text format make easier to see git diff and send patches. Also it's easier to convert to different format and copy to web pages. Related: https://bugs.freedesktop.org/show_bug.cgi?id=95258 Signed-off-by: Frediano Ziglio --- docs/Makefile.am | 13 ++ docs/spice_style.txt | 451 +++ 2 files changed, 464 insertions(+) create mode 100644 docs/spice_style.txt diff --git a/docs/Makefile.am b/docs/Makefile.am index 18e785f..a3e418a 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,3 +1,16 @@ +NULL = +ASCIIDOC_FLAGS = -a icons -a toc + +EXTRA_DIST = \ + spice_style.html\ + spice_style.txt \ + $(NULL) + if BUILD_MANUAL SUBDIRS = manual + +all-local: spice_style.html + +spice_style.html: spice_style.txt + $(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $< endif diff --git a/docs/spice_style.txt b/docs/spice_style.txt new file mode 100644 index 000..f354c30 --- /dev/null +++ b/docs/spice_style.txt @@ -0,0 +1,451 @@ +Spice project coding style and coding conventions += + +Draft 2 + +Copyright (C) 2009 Red Hat, Inc. +Licensed under a Creative Commons Attribution-Share Alike 3.0 +United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/legalcode). + + +C and C++ style +--- + +All of the following are applicable for both c and c+\+, except for <> section. + +Source Files + + +Names +~ + +Use lower case and separate words using underscore (e.g., file_name.c, header.h). + +Use cpp file extension for c\++ source files and hpp extension for c++ template files. Use standard file extension for c source and header files. + +Line width +~~ + +No more then 100 character on a single line + +Tabs + + +Tabs are not allowed, use 4 spaces instead + +White spaces + + +Trailing white spaces are not allowed + +New Line + + +Use Unix style line ending (i.e., LF) + +New line (i.e., EOL) must be the last char in the file + +Comparing +- + +Use right-hand comparison style. + +Examples: + + use `(var == 7)` instead of `(7 == var)` + + use `(function(var) > 7)` instead of `(7 < function(var))` + +TRUE, FALSE and NULL + + +Use TRUE FALSE and NULL instead of 1 and 0 in order to improve code readability. TRUE FALSE is not relevant for c++, in c++ use the built-in bool type. + +Static storage initialization +- + +To improve code readability, explicitly initialize variables that depend on default initialization with zero/null. + +Fixme and todo +-- + +Comments that are prefixed with `fixme` describe a bug that need to be fixed. Generally, it is not allowed to commit new code having `fixme` comment. Committing `fixme` is allowed only for existing bugs. Comments that are prefixed with `todo` describe further features, optimization or code improvements, and they are allowed to be committed along with the relevant code. + +ASSERT +-- + +Use it freely. ASSERT helps testing function arguments and function results validity. ASSERT helps detecting bugs and improve code readability and stability. + +sizeof +-- + +Apply function style to `sizeof` (i.e., use `sizeof(x)`) + +const +- + +Use const keyword when applicable to improve code reliability and celerity. + +goto + + +Using goto is allowed in c code for error handling. In any other case it will be used only as a special exception. + +Defining Constant values + + +Use defines for constant values for improving readability and ease of changes. Alternatively, use global `const` variables. + +void argument +- + +Don't add explicitly void argument in functions without arguments. (i.e., void function_name() is OK) + +Short functions +--- + +Try to split code to short functions, each having simple functionality, in order to improve code readability and re-usability. Prefix with inline short functions or functions that were splitted for readability reason. + +Return on if + + +Try to return immediately on if in places that can reduce indentation level. + +Example: + +prefer +[source,c] + +void function(int *n) +{ +if (!n) { +return; +} +... +} + +on +[source,c] + +void function(int *n) +{ +if (!n) { +return; +} else { +... +} +} + + +Names +- + +* Don't underestimate the importance of name choosing. Good names make the code more easy to understand and reduce the required level of code documentation. When choosing names, prefer long meaningful names over short vague name. +* Variable and Function names - use lower case and separate words using underscor
Re: [Spice-devel] [PATCH 1/2 v4] converts Spice_style.odt to asciidoc spice_style.txt
Hi, something like this can be added for `make clean` in docs: diff --git a/docs/Makefile.am b/docs/Makefile.am index a3e418a..3dba2c3 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -14,3 +14,6 @@ all-local: spice_style.html spice_style.html: spice_style.txt $(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $< endif + +clean-local: + rm -f spice_style.html Ack with the change, Pavel On Tue, 2016-05-10 at 17:24 +0100, Frediano Ziglio wrote: > The conversion try keeps the content as is no matter if updated or not. > Asciidoc format is already used for manual. > Using a text format make easier to see git diff and send patches. > Also it's easier to convert to different format and copy to web pages. > > Related: https://bugs.freedesktop.org/show_bug.cgi?id=95258 > > Signed-off-by: Frediano Ziglio > --- > docs/Makefile.am | 13 ++ > docs/spice_style.txt | 451 > +++ > 2 files changed, 464 insertions(+) > create mode 100644 docs/spice_style.txt > > diff --git a/docs/Makefile.am b/docs/Makefile.am > index 18e785f..a3e418a 100644 > --- a/docs/Makefile.am > +++ b/docs/Makefile.am > @@ -1,3 +1,16 @@ > +NULL = > +ASCIIDOC_FLAGS = -a icons -a toc > + > +EXTRA_DIST = \ > + spice_style.html\ > + spice_style.txt \ > + $(NULL) > + > if BUILD_MANUAL > SUBDIRS = manual > + > +all-local: spice_style.html > + > +spice_style.html: spice_style.txt > + $(AM_V_GEN) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $< > endif > diff --git a/docs/spice_style.txt b/docs/spice_style.txt > new file mode 100644 > index 000..f354c30 > --- /dev/null > +++ b/docs/spice_style.txt > @@ -0,0 +1,451 @@ > +Spice project coding style and coding conventions > += > + > +Draft 2 > + > +Copyright (C) 2009 Red Hat, Inc. > +Licensed under a Creative Commons Attribution-Share Alike 3.0 > +United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/l > egalcode). > + > + > +C and C++ style > +--- > + > +All of the following are applicable for both c and c+\+, except for < C++>> section. > + > +Source Files > + > + > +Names > +~ > + > +Use lower case and separate words using underscore (e.g., file_name.c, > header.h). > + > +Use cpp file extension for c\++ source files and hpp extension for c++ > template files. Use standard file extension for c source and header files. > + > +Line width > +~~ > + > +No more then 100 character on a single line > + > +Tabs > + > + > +Tabs are not allowed, use 4 spaces instead > + > +White spaces > + > + > +Trailing white spaces are not allowed > + > +New Line > + > + > +Use Unix style line ending (i.e., LF) > + > +New line (i.e., EOL) must be the last char in the file > + > +Comparing > +- > + > +Use right-hand comparison style. > + > +Examples: + > + use `(var == 7)` instead of `(7 == var)` + > + use `(function(var) > 7)` instead of `(7 < function(var))` > + > +TRUE, FALSE and NULL > + > + > +Use TRUE FALSE and NULL instead of 1 and 0 in order to improve code > readability. TRUE FALSE is not relevant for c++, in c++ use the built-in bool > type. > + > +Static storage initialization > +- > + > +To improve code readability, explicitly initialize variables that depend on > default initialization with zero/null. > + > +Fixme and todo > +-- > + > +Comments that are prefixed with `fixme` describe a bug that need to be fixed. > Generally, it is not allowed to commit new code having `fixme` comment. > Committing `fixme` is allowed only for existing bugs. Comments that are > prefixed with `todo` describe further features, optimization or code > improvements, and they are allowed to be committed along with the relevant > code. > + > +ASSERT > +-- > + > +Use it freely. ASSERT helps testing function arguments and function results > validity. ASSERT helps detecting bugs and improve code readability and > stability. > + > +sizeof > +-- > + > +Apply function style to `sizeof` (i.e., use `sizeof(x)`) > + > +const > +- > + > +Use const keyword when applicable to improve code reliability and celerity. > + > +goto > + > + > +Using goto is allowed in c code for error handling. In any other case it will > be used only as a special exception. > + > +Defining Constant values > + > + > +Use defines for constant values for improving readability and ease of > changes. Alternatively, use global `const` variables. > + > +void argument > +- > + > +Don't add explicitly void argument in functions without arguments. (i.e., > void function_name() is OK) > + > +Short functions > +--- > + > +Try to split code to short functions, each having simple functionality, in > order to improve code readability and re-usability. P
Re: [Spice-devel] [PATCH 2/2 v4] removed converted Spice_style.odf
Hi, just a typo in the commit s/odf/odt Acked-by: Pavel Grunt On Tue, 2016-05-10 at 17:24 +0100, Frediano Ziglio wrote: > Signed-off-by: Frediano Ziglio > --- > docs/Spice_style.odt | Bin 19045 -> 0 bytes > 1 file changed, 0 insertions(+), 0 deletions(-) > delete mode 100644 docs/Spice_style.odt > > diff --git a/docs/Spice_style.odt b/docs/Spice_style.odt > deleted file mode 100644 > index > efdcd1a62ba0c4995e470b6a5ec22301f24ab340.. > > GIT binary patch > literal 0 > HcmV?d1 > > literal 19045 > zcmbTe1z225vo?wa32wn1g1fuBYj79_8{A!k1$TD{?(P!Y2_d+ zpL6d#(>=Z3s_LrlwN`hnUR|Rk3kih*_UGfr#H&BRf z3Iqf=foyFUU2KdQYyplSM+RFv6B}b&ptH4!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o28 > zq)Z!7U-kql)!SERF(3(Sqnj5o6;PL}S`=4oMrgfa9{BA1Aru3nQB0#mTql
[Spice-devel] [PATCH 1/2] style: remove documentation for C++
C++ use was removed many time ago. Signed-off-by: Frediano Ziglio --- docs/spice_style.txt | 120 +-- 1 file changed, 2 insertions(+), 118 deletions(-) diff --git a/docs/spice_style.txt b/docs/spice_style.txt index f354c30..74aae0c 100644 --- a/docs/spice_style.txt +++ b/docs/spice_style.txt @@ -8,11 +8,6 @@ Licensed under a Creative Commons Attribution-Share Alike 3.0 United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/legalcode). -C and C++ style - -All of the following are applicable for both c and c+\+, except for <> section. - Source Files @@ -21,7 +16,7 @@ Names Use lower case and separate words using underscore (e.g., file_name.c, header.h). -Use cpp file extension for c\++ source files and hpp extension for c++ template files. Use standard file extension for c source and header files. +Use standard file extension for C source and header files. Line width ~~ @@ -57,7 +52,7 @@ Examples: + TRUE, FALSE and NULL -Use TRUE FALSE and NULL instead of 1 and 0 in order to improve code readability. TRUE FALSE is not relevant for c++, in c++ use the built-in bool type. +Use `TRUE`, `FALSE` and `NULL` instead of 1 and 0 in order to improve code readability. Static storage initialization - @@ -320,117 +315,6 @@ char *array[] = { "item_3", }; -[[cpp]] -C++ - -C++ style extends C Coding style - -One super -~ - -Avoid having more then one super class. Inherit from one super class and multiple interfaces (abstract class) for having multiple inheritance. - -Data members - - -Prefix all protected and private data members with underscore (i.e., _member_name). - -Using public data members is allowed only as an exception. Use getters and setters instead. - -Object reference - - -For code clarity use object reference (i.e., Type& var) in places where it is not allow to have null pointer and is not permitted to release the object. - -Templates -~ - -The use of c++ templates is limited to simple containers. - -'*' and '&' -~~~ - -'\*' and '&' , should be directly connected with the *type names*. - -Example: - -[source,c] -void function(int* i, int& n); - -Class indentation -~ - -[source,c] - -class ClassName: public SuperClass, public FirstInterface, - public SecondInterface { -public: -ClassName(); -virtual ~ClassName(); - -type public_function_1(type var); -type public_function_2(); -... - -protected: -type protected_function_1(type var); -type protected_function_2(); -... - -private: -type private_function_1(type var); -type private_function_2(); -... - -public: -type public_member_1; -type public_member_2; -... - -protected: -type _protected_member_1; -type _protected_member_2; -... - -private: -type _private_member_1; -type _private_member_2; -... -}; - - -Constructor indentation -~~~ - -[source,c] - -ClassName::ClassName(type1 arg1, type2 arg2,type3 arg3, - type4 arg4) -: SuperClass(arg1, arg2) -, _member_1 (arg3) -, _member_2 (arg4) -... -{ -... -} - - -bool - - -Use built-in bool `true` and `false` instead of `TRUE` and `FALSE`. - -Operator overloading - - -Avoid using operator overloading. It is only allowed as an exception. - -AutoRef and AutoPtr -~~~ - -Use `AutoRef` and `AutoPtr` style object for automatic object release. Using those objects simplify function cleanups and exception handling. - Spice client -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH 2/2] style: remove spice client section
Spice client is no more in this repository and also the style was changed Signed-off-by: Frediano Ziglio --- docs/spice_style.txt | 19 --- 1 file changed, 19 deletions(-) diff --git a/docs/spice_style.txt b/docs/spice_style.txt index 74aae0c..8966365 100644 --- a/docs/spice_style.txt +++ b/docs/spice_style.txt @@ -314,22 +314,3 @@ char *array[] = { "item_2", "item_3", }; - -Spice client - - -#ifdef PLATFORM -~~~ - -Use #ifdef only in cases of different logic that depends on platform. In all other case add common interface (e.g., in platform.h) and keep specific platform implementation in platform directory (e.g.,windows). - -Use standard macros -~~~ - LOG_INFO - LOG_WARN - LOG_ERROR - ASSERT - PANIC - DBG - THROW - THROW_ERR -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel