util/vhost-user-server: move header to include/
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 24 Sep 2020 15:15:48 +0000 (16:15 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 23 Oct 2020 12:42:16 +0000 (13:42 +0100)
Headers used by other subsystems are located in include/. Also add the
vhost-user-server and vhost-user-blk-server headers to MAINTAINERS.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200924151549.913737-13-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
MAINTAINERS
block/export/vhost-user-blk-server.c
include/qemu/vhost-user-server.h [new file with mode: 0644]
util/vhost-user-server.c
util/vhost-user-server.h [deleted file]

index 2789952a30ec3da229b4ddac38f001807145bde1..ef6f5c73998488528f44c4d204de1ed775557fe6 100644 (file)
@@ -3073,8 +3073,10 @@ Vhost-user block device backend server
 M: Coiby Xu <Coiby.Xu@gmail.com>
 S: Maintained
 F: block/export/vhost-user-blk-server.c
-F: util/vhost-user-server.c
+F: block/export/vhost-user-blk-server.h
+F: include/qemu/vhost-user-server.h
 F: tests/qtest/libqos/vhost-user-blk.c
+F: util/vhost-user-server.c
 
 Replication
 M: Wen Congyang <wencongyang2@huawei.com>
index 3e5bd6caee8e1417eb50f50fc77a37a1866ee635..f7021cbd7b25902d5f740a96273b303fb1ec0b79 100644 (file)
@@ -13,7 +13,7 @@
 #include "block/block.h"
 #include "contrib/libvhost-user/libvhost-user.h"
 #include "standard-headers/linux/virtio_blk.h"
-#include "util/vhost-user-server.h"
+#include "qemu/vhost-user-server.h"
 #include "vhost-user-blk-server.h"
 #include "qapi/error.h"
 #include "qom/object_interfaces.h"
diff --git a/include/qemu/vhost-user-server.h b/include/qemu/vhost-user-server.h
new file mode 100644 (file)
index 0000000..0da4c2c
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Sharing QEMU devices via vhost-user protocol
+ *
+ * Copyright (c) Coiby Xu <coiby.xu@gmail.com>.
+ * Copyright (c) 2020 Red Hat, Inc.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#ifndef VHOST_USER_SERVER_H
+#define VHOST_USER_SERVER_H
+
+#include "contrib/libvhost-user/libvhost-user.h"
+#include "io/channel-socket.h"
+#include "io/channel-file.h"
+#include "io/net-listener.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
+#include "standard-headers/linux/virtio_blk.h"
+
+/* A kick fd that we monitor on behalf of libvhost-user */
+typedef struct VuFdWatch {
+    VuDev *vu_dev;
+    int fd; /*kick fd*/
+    void *pvt;
+    vu_watch_cb cb;
+    QTAILQ_ENTRY(VuFdWatch) next;
+} VuFdWatch;
+
+/**
+ * VuServer:
+ * A vhost-user server instance with user-defined VuDevIface callbacks.
+ * Vhost-user device backends can be implemented using VuServer. VuDevIface
+ * callbacks and virtqueue kicks run in the given AioContext.
+ */
+typedef struct {
+    QIONetListener *listener;
+    QEMUBH *restart_listener_bh;
+    AioContext *ctx;
+    int max_queues;
+    const VuDevIface *vu_iface;
+
+    /* Protected by ctx lock */
+    VuDev vu_dev;
+    QIOChannel *ioc; /* The I/O channel with the client */
+    QIOChannelSocket *sioc; /* The underlying data channel with the client */
+    QTAILQ_HEAD(, VuFdWatch) vu_fd_watches;
+
+    Coroutine *co_trip; /* coroutine for processing VhostUserMsg */
+} VuServer;
+
+bool vhost_user_server_start(VuServer *server,
+                             SocketAddress *unix_socket,
+                             AioContext *ctx,
+                             uint16_t max_queues,
+                             const VuDevIface *vu_iface,
+                             Error **errp);
+
+void vhost_user_server_stop(VuServer *server);
+
+void vhost_user_server_attach_aio_context(VuServer *server, AioContext *ctx);
+void vhost_user_server_detach_aio_context(VuServer *server);
+
+#endif /* VHOST_USER_SERVER_H */
index 516999b38ac6abad1bd37f1e2aea396c85b8caeb..783d847a6db3021d16fb1048e751167818119b24 100644 (file)
@@ -9,8 +9,8 @@
  */
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
+#include "qemu/vhost-user-server.h"
 #include "block/aio-wait.h"
-#include "vhost-user-server.h"
 
 /*
  * Theory of operation:
diff --git a/util/vhost-user-server.h b/util/vhost-user-server.h
deleted file mode 100644 (file)
index 0da4c2c..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Sharing QEMU devices via vhost-user protocol
- *
- * Copyright (c) Coiby Xu <coiby.xu@gmail.com>.
- * Copyright (c) 2020 Red Hat, Inc.
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or
- * later.  See the COPYING file in the top-level directory.
- */
-
-#ifndef VHOST_USER_SERVER_H
-#define VHOST_USER_SERVER_H
-
-#include "contrib/libvhost-user/libvhost-user.h"
-#include "io/channel-socket.h"
-#include "io/channel-file.h"
-#include "io/net-listener.h"
-#include "qemu/error-report.h"
-#include "qapi/error.h"
-#include "standard-headers/linux/virtio_blk.h"
-
-/* A kick fd that we monitor on behalf of libvhost-user */
-typedef struct VuFdWatch {
-    VuDev *vu_dev;
-    int fd; /*kick fd*/
-    void *pvt;
-    vu_watch_cb cb;
-    QTAILQ_ENTRY(VuFdWatch) next;
-} VuFdWatch;
-
-/**
- * VuServer:
- * A vhost-user server instance with user-defined VuDevIface callbacks.
- * Vhost-user device backends can be implemented using VuServer. VuDevIface
- * callbacks and virtqueue kicks run in the given AioContext.
- */
-typedef struct {
-    QIONetListener *listener;
-    QEMUBH *restart_listener_bh;
-    AioContext *ctx;
-    int max_queues;
-    const VuDevIface *vu_iface;
-
-    /* Protected by ctx lock */
-    VuDev vu_dev;
-    QIOChannel *ioc; /* The I/O channel with the client */
-    QIOChannelSocket *sioc; /* The underlying data channel with the client */
-    QTAILQ_HEAD(, VuFdWatch) vu_fd_watches;
-
-    Coroutine *co_trip; /* coroutine for processing VhostUserMsg */
-} VuServer;
-
-bool vhost_user_server_start(VuServer *server,
-                             SocketAddress *unix_socket,
-                             AioContext *ctx,
-                             uint16_t max_queues,
-                             const VuDevIface *vu_iface,
-                             Error **errp);
-
-void vhost_user_server_stop(VuServer *server);
-
-void vhost_user_server_attach_aio_context(VuServer *server, AioContext *ctx);
-void vhost_user_server_detach_aio_context(VuServer *server);
-
-#endif /* VHOST_USER_SERVER_H */