]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-pr-helper: use new libmultipath API
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Oct 2017 18:11:58 +0000 (20:11 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Oct 2017 08:15:09 +0000 (10:15 +0200)
libmultipath has recently changed its API.  The new API supports multi-threaded
clients better.  Unfortunately there is no backwards-compatibility, so we just
switch to the new one.  Running QEMU compiled with the new library on the old
library will likely crash, while doing the opposite will cause QEMU not to
start at all (because udev, get_multipath_config and put_multipath_config
are undefined).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
configure
scsi/qemu-pr-helper.c

index 6587e8014b6b5c5ab5a984eaf1fef8f58c991f29..7766e74125ca3ef7785188d3a55404abd5cb9ee3 100755 (executable)
--- a/configure
+++ b/configure
@@ -3312,9 +3312,17 @@ if test "$mpath" != "no" ; then
 #include <mpath_persist.h>
 unsigned mpath_mx_alloc_len = 1024;
 int logsink;
+static struct config *multipath_conf;
+extern struct udev *udev;
+extern struct config *get_multipath_config(void);
+extern void put_multipath_config(struct config *conf);
+struct udev *udev;
+struct config *get_multipath_config(void) { return multipath_conf; }
+void put_multipath_config(struct config *conf) { }
+
 int main(void) {
-    struct udev *udev = udev_new();
-    mpath_lib_init(udev);
+    udev = udev_new();
+    multipath_conf = mpath_lib_init();
     return 0;
 }
 EOF
index d58184833f19f22b2a41ca53fbf755157aefcb8a..dd9785143bcce87e59ed2be75b001fe80dfe7144 100644 (file)
@@ -276,15 +276,26 @@ static void dm_init(void)
 
 /* Variables required by libmultipath and libmpathpersist.  */
 QEMU_BUILD_BUG_ON(PR_HELPER_DATA_SIZE > MPATH_MAX_PARAM_LEN);
+static struct config *multipath_conf;
 unsigned mpath_mx_alloc_len = PR_HELPER_DATA_SIZE;
 int logsink;
+struct udev *udev;
 
-static void multipath_pr_init(void)
+extern struct config *get_multipath_config(void);
+struct config *get_multipath_config(void)
 {
-    static struct udev *udev;
+    return multipath_conf;
+}
 
+extern void put_multipath_config(struct config *conf);
+void put_multipath_config(struct config *conf)
+{
+}
+
+static void multipath_pr_init(void)
+{
     udev = udev_new();
-    mpath_lib_init(udev);
+    multipath_conf = mpath_lib_init();
 }
 
 static int is_mpath(int fd)