[Spice-devel] [PATCH v2 1/4] vdagentd-proto: define default virtio-port path

Victor Toso victortoso at redhat.com
Tue May 16 17:27:52 UTC 2017


From: Victor Toso <me at victortoso.com>

This adds a #define to avoid hardcoding the path in 2 different
places.

Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
---
 src/vdagent/vdagent.c   | 2 +-
 src/vdagentd-proto.h    | 2 ++
 src/vdagentd/vdagentd.c | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c
index 6f025e8..9900303 100644
--- a/src/vdagent/vdagent.c
+++ b/src/vdagent/vdagent.c
@@ -44,7 +44,7 @@
 #include "x11.h"
 #include "file-xfers.h"
 
-static const char *portdev = "/dev/virtio-ports/com.redhat.spice.0";
+static const char *portdev = DEFAULT_VIRTIO_PORT_PATH;
 static const char *vdagentd_socket = VDAGENTD_SOCKET;
 static int debug = 0;
 static const char *fx_dir = NULL;
diff --git a/src/vdagentd-proto.h b/src/vdagentd-proto.h
index 9815488..f72a890 100644
--- a/src/vdagentd-proto.h
+++ b/src/vdagentd-proto.h
@@ -25,6 +25,8 @@
 
 #define VDAGENTD_SOCKET "/var/run/spice-vdagentd/spice-vdagent-sock"
 
+#define DEFAULT_VIRTIO_PORT_PATH "/dev/virtio-ports/com.redhat.spice.0"
+
 enum {
     VDAGENTD_GUEST_XORG_RESOLUTION, /* client -> daemon, arg1: overall width,
                                        arg2: overall height, data: array of
diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
index f3ac606..800a09c 100644
--- a/src/vdagentd/vdagentd.c
+++ b/src/vdagentd/vdagentd.c
@@ -54,7 +54,7 @@ struct agent_data {
 
 /* variables */
 static const char *pidfilename = "/var/run/spice-vdagentd/spice-vdagentd.pid";
-static const char *portdev = "/dev/virtio-ports/com.redhat.spice.0";
+static const char *portdev = DEFAULT_VIRTIO_PORT_PATH;
 static const char *vdagentd_socket = VDAGENTD_SOCKET;
 static const char *uinput_device = "/dev/uinput";
 static int debug = 0;
-- 
2.13.0



More information about the Spice-devel mailing list