Wrap spice.h in order to do some adjustment

Instead of including spice.h directly include an header that wraps
it. This allows to remove the SPICE_SERVER_INTERNAL define.
Currently is used to rename SpiceCharDeviceInstance to RedCharDevice
and reduce its visibility to hidden. This remove some warnings
and some weird code in the source.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2020-03-08 12:51:07 +00:00 committed by Frediano Ziglio
parent be5bda4d4f
commit f6f998004b
19 changed files with 58 additions and 19 deletions

View File

@ -170,6 +170,7 @@ libserver_la_SOURCES = \
spice-bitmap-utils.c \
spice-bitmap-utils.h \
spicevmc.cpp \
spice-wrapped.h \
stat-file.c \
stat-file.h \
stat.h \

View File

@ -1090,7 +1090,7 @@ red_char_device_class_init(RedCharDeviceClass *klass)
SPICE_GNUC_VISIBLE void spice_server_port_event(SpiceCharDeviceInstance *sin, uint8_t event)
{
if (sin->st == NULL) {
spice_warning("no SpiceCharDeviceState attached to instance %p", sin);
spice_warning("no RedCharDevice attached to instance %p", sin);
return;
}

View File

@ -21,7 +21,7 @@
#include <glib-object.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "red-channel.h"
#include "migration-protocol.h"
@ -35,8 +35,7 @@ SPICE_BEGIN_DECLS
#define RED_IS_CHAR_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RED_TYPE_CHAR_DEVICE))
#define RED_CHAR_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), RED_TYPE_CHAR_DEVICE, RedCharDeviceClass))
/* SpiceCharDeviceState is public API, but internally we use RedCharDevice */
typedef struct SpiceCharDeviceState RedCharDevice;
struct RedCharDevice;
struct RedCharDeviceClass;
struct RedCharDevicePrivate;
struct RedCharDeviceClientOpaque;
@ -154,8 +153,7 @@ struct RedCharDeviceWriteBuffer {
/* 'SpiceCharDeviceState' name is used for consistency with what spice-char.h exports */
struct SpiceCharDeviceState: public GObject
struct RedCharDevice: public GObject
{
void reset_dev_instance(SpiceCharDeviceInstance *sin);
/* only one client is supported */

View File

@ -27,7 +27,7 @@
#include <common/generated_server_marshallers.h>
#include <common/demarshallers.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "red-common.h"
#include "reds.h"
#include "red-stream.h"

View File

@ -19,7 +19,7 @@
#ifndef MAIN_DISPATCHER_H_
#define MAIN_DISPATCHER_H_
#include "spice.h"
#include "spice-wrapped.h"
#include "dispatcher.h"
#include "red-channel.h"

View File

@ -128,6 +128,7 @@ spice_server_sources = [
'spice-bitmap-utils.c',
'spice-bitmap-utils.h',
'spicevmc.cpp',
'spice-wrapped.h',
'stat-file.c',
'stat-file.h',
'stat.h',

View File

@ -27,7 +27,7 @@
#include <common/marshaller.h>
#include <common/demarshallers.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "red-common.h"
#include "red-stream.h"
#include "stat.h"

View File

@ -32,7 +32,7 @@
#include <common/draw.h>
#include <common/verify.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "utils.h"
#include "sys-socket.h"

View File

@ -28,7 +28,7 @@
#include <common/quic.h>
#include <common/sw_canvas.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "red-worker.h"
#include "reds.h"
#include "dispatcher.h"

View File

@ -20,7 +20,7 @@
#include <openssl/ssl.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "red-common.h"
SPICE_BEGIN_DECLS

View File

@ -41,7 +41,7 @@
#include "display-channel.h"
#include "video-stream.h"
#include "spice.h"
#include "spice-wrapped.h"
#include "red-worker.h"
#include "red-qxl.h"
#include "cursor-channel.h"

View File

@ -112,7 +112,7 @@ struct RedsState {
SpiceTimer *mig_timer;
int vm_running;
red::safe_list<SpiceCharDeviceState*> char_devices;
red::safe_list<RedCharDevice*> char_devices;
int seamless_migration_enabled; /* command line arg */
SSL_CTX *ctx;

View File

@ -53,7 +53,7 @@
#include <common/generated_server_marshallers.h>
#include <common/ring.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "reds.h"
#include "agent-msg-filter.h"
#include "inputs-channel.h"

View File

@ -25,7 +25,7 @@
#include <common/messages.h>
#include "char-device.h"
#include "spice.h"
#include "spice-wrapped.h"
#include "red-channel.h"
#include "video-encoder.h"
#include "main-dispatcher.h"

View File

@ -31,7 +31,7 @@
#include <common/generated_server_marshallers.h>
#include <common/snd_codec.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "red-common.h"
#include "main-channel.h"
#include "reds.h"

35
server/spice-wrapped.h Normal file
View File

@ -0,0 +1,35 @@
/*
Copyright (C) 2020 Red Hat, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#undef SPICE_SERVER_INTERNAL
#include <spice/macros.h>
#undef SPICE_GNUC_DEPRECATED
#define SPICE_GNUC_DEPRECATED
#define SpiceCharDeviceState RedCharDevice
#include "push-visibility.h"
struct RedCharDevice;
struct SpiceCharDeviceInstance;
#include "pop-visibility.h"
#include "spice.h"
#undef SpiceCharDeviceState

View File

@ -21,7 +21,7 @@
#include <stdint.h>
#include <glib.h>
#include "spice.h"
#include "spice-wrapped.h"
#include "stat-file.h"
SPICE_BEGIN_DECLS

View File

@ -29,7 +29,7 @@
#include <getopt.h>
#include <pthread.h>
#include "spice.h"
#include "spice-wrapped.h"
#include <spice/qxl_dev.h>
#include "test-display-base.h"

View File

@ -19,6 +19,8 @@
#include "char-device.h"
#include "push-visibility.h"
typedef struct VmcEmu VmcEmu;
struct VmcEmu {
@ -49,3 +51,5 @@ VmcEmu *vmc_emu_new(const char *subtype, const char *portname);
void vmc_emu_destroy(VmcEmu *vmc);
void vmc_emu_reset(VmcEmu *vmc);
void vmc_emu_add_read_till(VmcEmu *vmc, uint8_t *end);
#include "pop-visibility.h"