[Spice-devel] [PATCH spice-server 3/3] Move stuff only related to RedChannelClient into red-channel-client.c
Christophe Fergeau
cfergeau at redhat.com
Wed Feb 15 16:42:24 UTC 2017
I'd change the log to something like:
"rcc: Make some functions/macros private
Some constants/macros/function prototypes are defined in
red-channel-client.h while they are only used by red-channel-client.c.
This commit moves them to the .c file to make them private"
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
(did not check much more than "it compiles")
On Wed, Feb 15, 2017 at 12:49:07PM +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-channel-client.c | 25 ++++++++++++++++++++++++-
> server/red-channel-client.h | 23 -----------------------
> 2 files changed, 24 insertions(+), 24 deletions(-)
>
> diff --git a/server/red-channel-client.c b/server/red-channel-client.c
> index 16e5446..a0e213f 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -37,6 +37,14 @@
> #include "red-client.h"
> #include "glib-compat.h"
>
> +#define CLIENT_ACK_WINDOW 20
> +
> +#define MAX_HEADER_SIZE sizeof(SpiceDataHeader)
> +
> +#ifndef IOV_MAX
> +#define IOV_MAX 1024
> +#endif
> +
> typedef struct SpiceDataHeaderOpaque SpiceDataHeaderOpaque;
>
> typedef uint16_t (*get_msg_type_proc)(SpiceDataHeaderOpaque *header);
> @@ -147,6 +155,21 @@ static const SpiceDataHeaderOpaque mini_header_wrapper;
> static void red_channel_client_clear_sent_item(RedChannelClient *rcc);
> static void red_channel_client_destroy_remote_caps(RedChannelClient* rcc);
> static void red_channel_client_initable_interface_init(GInitableIface *iface);
> +static void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
> +
> +/*
> + * When an error occurs over a channel, we treat it as a warning
> + * for spice-server and shutdown the channel.
> + */
> +#define spice_channel_client_error(rcc, format, ...) \
> + do { \
> + RedChannel *_ch = red_channel_client_get_channel(rcc); \
> + uint32_t _type, _id; \
> + g_object_get(_ch, "channel-type", &_type, "id", &_id, NULL); \
> + spice_warning("rcc %p type %u id %u: " format, rcc, \
> + type, id, ## __VA_ARGS__); \
> + red_channel_client_shutdown(rcc); \
> + } while (0)
>
> G_DEFINE_TYPE_WITH_CODE(RedChannelClient, red_channel_client, G_TYPE_OBJECT,
> G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE,
> @@ -1568,7 +1591,7 @@ uint64_t red_channel_client_get_message_serial(RedChannelClient *rcc)
> return rcc->priv->send_data.last_sent_serial + 1;
> }
>
> -void red_channel_client_set_message_serial(RedChannelClient *rcc, uint64_t serial)
> +static void red_channel_client_set_message_serial(RedChannelClient *rcc, uint64_t serial)
> {
> rcc->priv->send_data.last_sent_serial = serial - 1;
> }
> diff --git a/server/red-channel-client.h b/server/red-channel-client.h
> index 1b0b810..474a5cd 100644
> --- a/server/red-channel-client.h
> +++ b/server/red-channel-client.h
> @@ -20,7 +20,6 @@
>
> #include <glib-object.h>
> #include <gio/gio.h>
> -#include <spice/protocol.h>
> #include <common/marshaller.h>
>
> #include "red-pipe-item.h"
> @@ -29,13 +28,6 @@
>
> G_BEGIN_DECLS
>
> -#define MAX_HEADER_SIZE sizeof(SpiceDataHeader)
> -#define CLIENT_ACK_WINDOW 20
> -
> -#ifndef IOV_MAX
> -#define IOV_MAX 1024
> -#endif
> -
> #define RED_TYPE_CHANNEL_CLIENT red_channel_client_get_type()
>
> #define RED_CHANNEL_CLIENT(obj) \
> @@ -55,20 +47,6 @@ typedef struct RedChannelClientPrivate RedChannelClientPrivate;
>
> GType red_channel_client_get_type(void) G_GNUC_CONST;
>
> -/*
> - * When an error occurs over a channel, we treat it as a warning
> - * for spice-server and shutdown the channel.
> - */
> -#define spice_channel_client_error(rcc, format, ...) \
> - do { \
> - RedChannel *_ch = red_channel_client_get_channel(rcc); \
> - uint32_t _type, _id; \
> - g_object_get(_ch, "channel-type", &_type, "id", &_id, NULL); \
> - spice_warning("rcc %p type %u id %u: " format, rcc, \
> - type, id, ## __VA_ARGS__); \
> - red_channel_client_shutdown(rcc); \
> - } while (0)
> -
> RedChannelClient *red_channel_client_create(RedChannel *channel,
> RedClient *client, RedsStream *stream,
> int monitor_latency,
> @@ -92,7 +70,6 @@ int red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
> void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type);
>
> uint64_t red_channel_client_get_message_serial(RedChannelClient *channel);
> -void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
>
> /* When sending a msg. Should first call red_channel_client_begin_send_message.
> * It will first send the pending urgent data, if there is any, and then
> --
> 2.9.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170215/0753b168/attachment.sig>
More information about the Spice-devel
mailing list