thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Pablo Greco e6a3ae
From 88780a41e05b8079cde07466c252b42c113f9e5c Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Miroslav Rezanina <mrezanin@redhat.com>
Pablo Greco e6a3ae
Date: Sun, 9 Jun 2019 09:35:09 +0100
Pablo Greco e6a3ae
Subject: [PATCH 8/8] Disable VXHS support
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
Pablo Greco e6a3ae
Message-id: <1560072909-1725-1-git-send-email-mrezanin@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 88629
Pablo Greco e6a3ae
O-Subject: [RHEL-8 qemu-kvm PATCH] Disable VXHS support
Pablo Greco e6a3ae
Bugzilla: 1714933
Pablo Greco e6a3ae
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
From: Miroslav Rezanina <mrezanin@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1714933
Pablo Greco e6a3ae
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=22065429
Pablo Greco e6a3ae
Branch: rhel-8.1.0
Pablo Greco e6a3ae
Upstream: n/a
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Reverting commit e9aff9d4ab1f9c10a4cb88fc5b92c4835e8b2688 introducing
Pablo Greco e6a3ae
downstream modularizaiton of VXHS driver as we do not need to support
Pablo Greco e6a3ae
VXHS driver anymore.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Patch is not pure revert as we changed way we handle configuration
Pablo Greco e6a3ae
of qemu build after this patch. In addition, reverting downstream only
Pablo Greco e6a3ae
removing of vxhs.o from block/Makefile.obj.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 block/Makefile.objs           |   2 +-
Pablo Greco e6a3ae
 block/vxhs.c                  | 123 ++++--------------------------------
Pablo Greco e6a3ae
 configure                     |  33 +++++++++-
Pablo Greco e6a3ae
 include/block/vxhs_shim.h     | 143 ------------------------------------------
Pablo Greco e6a3ae
 redhat/qemu-kvm.spec.template |   9 ---
Pablo Greco e6a3ae
 5 files changed, 42 insertions(+), 268 deletions(-)
Pablo Greco e6a3ae
 delete mode 100644 include/block/vxhs_shim.h
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/block/Makefile.objs b/block/Makefile.objs
Pablo Greco e6a3ae
index 037c76b..ac7a1f8 100644
Pablo Greco e6a3ae
--- a/block/Makefile.objs
Pablo Greco e6a3ae
+++ b/block/Makefile.objs
Pablo Greco e6a3ae
@@ -29,7 +29,7 @@ block-obj-$(CONFIG_LIBNFS) += nfs.o
Pablo Greco e6a3ae
 block-obj-$(CONFIG_CURL) += curl.o
Pablo Greco e6a3ae
 block-obj-$(CONFIG_RBD) += rbd.o
Pablo Greco e6a3ae
 block-obj-$(CONFIG_GLUSTERFS) += gluster.o
Pablo Greco e6a3ae
-#block-obj-$(CONFIG_VXHS) += vxhs.o
Pablo Greco e6a3ae
+block-obj-$(CONFIG_VXHS) += vxhs.o
Pablo Greco e6a3ae
 block-obj-$(CONFIG_LIBSSH2) += ssh.o
Pablo Greco e6a3ae
 block-obj-y += accounting.o dirty-bitmap.o
Pablo Greco e6a3ae
 block-obj-y += write-threshold.o
Pablo Greco e6a3ae
diff --git a/block/vxhs.c b/block/vxhs.c
Pablo Greco e6a3ae
index 25fea7f..d2a1f4e 100644
Pablo Greco e6a3ae
--- a/block/vxhs.c
Pablo Greco e6a3ae
+++ b/block/vxhs.c
Pablo Greco e6a3ae
@@ -9,8 +9,7 @@
Pablo Greco e6a3ae
  */
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #include "qemu/osdep.h"
Pablo Greco e6a3ae
-#include "block/vxhs_shim.h"
Pablo Greco e6a3ae
-#include <gmodule.h>
Pablo Greco e6a3ae
+#include <qnio/qnio_api.h>
Pablo Greco e6a3ae
 #include <sys/param.h>
Pablo Greco e6a3ae
 #include "block/block_int.h"
Pablo Greco e6a3ae
 #include "block/qdict.h"
Pablo Greco e6a3ae
@@ -60,97 +59,6 @@ typedef struct BDRVVXHSState {
Pablo Greco e6a3ae
     char *tlscredsid; /* tlscredsid */
Pablo Greco e6a3ae
 } BDRVVXHSState;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-#define LIBVXHS_FULL_PATHNAME "/usr/lib64/qemu/libvxhs.so.1"
Pablo Greco e6a3ae
-static bool libvxhs_loaded;
Pablo Greco e6a3ae
-static GModule *libvxhs_handle;
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-static LibVXHSFuncs libvxhs;
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-typedef struct LibVXHSSymbols {
Pablo Greco e6a3ae
-    const char *name;
Pablo Greco e6a3ae
-    gpointer *addr;
Pablo Greco e6a3ae
-} LibVXHSSymbols;
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-static LibVXHSSymbols libvxhs_symbols[] = {
Pablo Greco e6a3ae
-    {"iio_init",        (gpointer *) &libvxhs.iio_init},
Pablo Greco e6a3ae
-    {"iio_fini",        (gpointer *) &libvxhs.iio_fini},
Pablo Greco e6a3ae
-    {"iio_min_version", (gpointer *) &libvxhs.iio_min_version},
Pablo Greco e6a3ae
-    {"iio_max_version", (gpointer *) &libvxhs.iio_max_version},
Pablo Greco e6a3ae
-    {"iio_open",        (gpointer *) &libvxhs.iio_open},
Pablo Greco e6a3ae
-    {"iio_close",       (gpointer *) &libvxhs.iio_close},
Pablo Greco e6a3ae
-    {"iio_writev",      (gpointer *) &libvxhs.iio_writev},
Pablo Greco e6a3ae
-    {"iio_readv",       (gpointer *) &libvxhs.iio_readv},
Pablo Greco e6a3ae
-    {"iio_ioctl",       (gpointer *) &libvxhs.iio_ioctl},
Pablo Greco e6a3ae
-    {NULL}
Pablo Greco e6a3ae
-};
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-static void bdrv_vxhs_set_funcs(GModule *handle, Error **errp)
Pablo Greco e6a3ae
-{
Pablo Greco e6a3ae
-    int i = 0;
Pablo Greco e6a3ae
-    while (libvxhs_symbols[i].name) {
Pablo Greco e6a3ae
-        const char *name = libvxhs_symbols[i].name;
Pablo Greco e6a3ae
-        if (!g_module_symbol(handle, name, libvxhs_symbols[i].addr)) {
Pablo Greco e6a3ae
-            error_setg(errp, "%s could not be loaded from libvxhs: %s",
Pablo Greco e6a3ae
-                       name, g_module_error());
Pablo Greco e6a3ae
-            return;
Pablo Greco e6a3ae
-        }
Pablo Greco e6a3ae
-        ++i;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-}
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-static void bdrv_vxhs_load_libs(Error **errp)
Pablo Greco e6a3ae
-{
Pablo Greco e6a3ae
-    Error *local_err = NULL;
Pablo Greco e6a3ae
-    int32_t ver;
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    if (libvxhs_loaded) {
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    if (!g_module_supported()) {
Pablo Greco e6a3ae
-        error_setg(errp, "modules are not supported on this platform: %s",
Pablo Greco e6a3ae
-                     g_module_error());
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    libvxhs_handle = g_module_open(LIBVXHS_FULL_PATHNAME,
Pablo Greco e6a3ae
-                                   G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
Pablo Greco e6a3ae
-    if (!libvxhs_handle) {
Pablo Greco e6a3ae
-        error_setg(errp, "The VXHS library from Veritas might not be installed "
Pablo Greco e6a3ae
-                   "correctly (%s)", g_module_error());
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    g_module_make_resident(libvxhs_handle);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    bdrv_vxhs_set_funcs(libvxhs_handle, &local_err);
Pablo Greco e6a3ae
-    if (local_err) {
Pablo Greco e6a3ae
-        error_propagate(errp, local_err);
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    /* Now check to see if the libvxhs we are using here is supported
Pablo Greco e6a3ae
-     * by the loaded version */
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    ver = (*libvxhs.iio_min_version)();
Pablo Greco e6a3ae
-    if (ver > QNIO_VERSION) {
Pablo Greco e6a3ae
-        error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
Pablo Greco e6a3ae
-                         "only %"PRId32" or newer is supported by %s",
Pablo Greco e6a3ae
-                          QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    ver = (*libvxhs.iio_max_version)();
Pablo Greco e6a3ae
-    if (ver < QNIO_VERSION) {
Pablo Greco e6a3ae
-        error_setg(errp, "Trying to use libvxhs version %"PRId32" API, but "
Pablo Greco e6a3ae
-                         "only %"PRId32" or earlier is supported by %s",
Pablo Greco e6a3ae
-                          QNIO_VERSION, ver, LIBVXHS_FULL_PATHNAME);
Pablo Greco e6a3ae
-        return;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    libvxhs_loaded = true;
Pablo Greco e6a3ae
-}
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
 static void vxhs_complete_aio_bh(void *opaque)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     VXHSAIOCB *acb = opaque;
Pablo Greco e6a3ae
@@ -312,7 +220,7 @@ static void vxhs_parse_filename(const char *filename, QDict *options,
Pablo Greco e6a3ae
 static int vxhs_init_and_ref(void)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     if (vxhs_ref++ == 0) {
Pablo Greco e6a3ae
-        if ((*libvxhs.iio_init)(QNIO_VERSION, vxhs_iio_callback)) {
Pablo Greco e6a3ae
+        if (iio_init(QNIO_VERSION, vxhs_iio_callback)) {
Pablo Greco e6a3ae
             return -ENODEV;
Pablo Greco e6a3ae
         }
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
@@ -322,7 +230,7 @@ static int vxhs_init_and_ref(void)
Pablo Greco e6a3ae
 static void vxhs_unref(void)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     if (--vxhs_ref == 0) {
Pablo Greco e6a3ae
-        (*libvxhs.iio_fini)();
Pablo Greco e6a3ae
+        iio_fini();
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -392,17 +300,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
Pablo Greco e6a3ae
     char *client_key = NULL;
Pablo Greco e6a3ae
     char *client_cert = NULL;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    bdrv_vxhs_load_libs(&local_err);
Pablo Greco e6a3ae
-    if (local_err) {
Pablo Greco e6a3ae
-        error_propagate(errp, local_err);
Pablo Greco e6a3ae
-        /* on error, cannot cleanup because the iio_fini() function
Pablo Greco e6a3ae
-         * is not loaded */
Pablo Greco e6a3ae
-        return -EINVAL;
Pablo Greco e6a3ae
-    }
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
     ret = vxhs_init_and_ref();
Pablo Greco e6a3ae
     if (ret < 0) {
Pablo Greco e6a3ae
-        error_setg(&local_err, "libvxhs iio_init() failed");
Pablo Greco e6a3ae
         ret = -EINVAL;
Pablo Greco e6a3ae
         goto out;
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
@@ -487,8 +386,8 @@ static int vxhs_open(BlockDriverState *bs, QDict *options,
Pablo Greco e6a3ae
     /*
Pablo Greco e6a3ae
      * Open qnio channel to storage agent if not opened before
Pablo Greco e6a3ae
      */
Pablo Greco e6a3ae
-    dev_handlep = (*libvxhs.iio_open)(of_vsa_addr, s->vdisk_guid, 0,
Pablo Greco e6a3ae
-                                      cacert, client_key, client_cert);
Pablo Greco e6a3ae
+    dev_handlep = iio_open(of_vsa_addr, s->vdisk_guid, 0,
Pablo Greco e6a3ae
+                           cacert, client_key, client_cert);
Pablo Greco e6a3ae
     if (dev_handlep == NULL) {
Pablo Greco e6a3ae
         trace_vxhs_open_iio_open(of_vsa_addr);
Pablo Greco e6a3ae
         ret = -ENODEV;
Pablo Greco e6a3ae
@@ -552,12 +451,12 @@ static BlockAIOCB *vxhs_aio_rw(BlockDriverState *bs, int64_t sector_num,
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
     switch (iodir) {
Pablo Greco e6a3ae
     case VDISK_AIO_WRITE:
Pablo Greco e6a3ae
-            ret = (*libvxhs.iio_writev)(dev_handle, acb, qiov->iov, qiov->niov,
Pablo Greco e6a3ae
-                                        offset, (uint64_t)size, iio_flags);
Pablo Greco e6a3ae
+            ret = iio_writev(dev_handle, acb, qiov->iov, qiov->niov,
Pablo Greco e6a3ae
+                             offset, (uint64_t)size, iio_flags);
Pablo Greco e6a3ae
             break;
Pablo Greco e6a3ae
     case VDISK_AIO_READ:
Pablo Greco e6a3ae
-            ret = (*libvxhs.iio_readv)(dev_handle, acb, qiov->iov, qiov->niov,
Pablo Greco e6a3ae
-                                       offset, (uint64_t)size, iio_flags);
Pablo Greco e6a3ae
+            ret = iio_readv(dev_handle, acb, qiov->iov, qiov->niov,
Pablo Greco e6a3ae
+                            offset, (uint64_t)size, iio_flags);
Pablo Greco e6a3ae
             break;
Pablo Greco e6a3ae
     default:
Pablo Greco e6a3ae
             trace_vxhs_aio_rw_invalid(iodir);
Pablo Greco e6a3ae
@@ -607,7 +506,7 @@ static void vxhs_close(BlockDriverState *bs)
Pablo Greco e6a3ae
      * Close vDisk device
Pablo Greco e6a3ae
      */
Pablo Greco e6a3ae
     if (s->vdisk_hostinfo.dev_handle) {
Pablo Greco e6a3ae
-        (*libvxhs.iio_close)(s->vdisk_hostinfo.dev_handle);
Pablo Greco e6a3ae
+        iio_close(s->vdisk_hostinfo.dev_handle);
Pablo Greco e6a3ae
         s->vdisk_hostinfo.dev_handle = NULL;
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -629,7 +528,7 @@ static int64_t vxhs_get_vdisk_stat(BDRVVXHSState *s)
Pablo Greco e6a3ae
     int ret = 0;
Pablo Greco e6a3ae
     void *dev_handle = s->vdisk_hostinfo.dev_handle;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    ret = (*libvxhs.iio_ioctl)(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
Pablo Greco e6a3ae
+    ret = iio_ioctl(dev_handle, IOR_VDISK_STAT, &vdisk_size, 0);
Pablo Greco e6a3ae
     if (ret < 0) {
Pablo Greco e6a3ae
         trace_vxhs_get_vdisk_stat_err(s->vdisk_guid, ret, errno);
Pablo Greco e6a3ae
         return -EIO;
Pablo Greco e6a3ae
diff --git a/configure b/configure
Pablo Greco e6a3ae
index 858b456..6d61b14 100755
Pablo Greco e6a3ae
--- a/configure
Pablo Greco e6a3ae
+++ b/configure
Pablo Greco e6a3ae
@@ -3428,7 +3428,7 @@ else
Pablo Greco e6a3ae
     glib_req_ver=2.22
Pablo Greco e6a3ae
 fi
Pablo Greco e6a3ae
 glib_modules=gthread-2.0
Pablo Greco e6a3ae
-if test "$modules" = yes -o "$vxhs" = yes; then
Pablo Greco e6a3ae
+if test "$modules" = yes; then
Pablo Greco e6a3ae
     glib_modules="$glib_modules gmodule-export-2.0"
Pablo Greco e6a3ae
 fi
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -5391,6 +5391,33 @@ if compile_prog "" "" ; then
Pablo Greco e6a3ae
 fi
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 ##########################################
Pablo Greco e6a3ae
+# Veritas HyperScale block driver VxHS
Pablo Greco e6a3ae
+# Check if libvxhs is installed
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+if test "$vxhs" != "no" ; then
Pablo Greco e6a3ae
+  cat > $TMPC <
Pablo Greco e6a3ae
+#include <stdint.h>
Pablo Greco e6a3ae
+#include <qnio/qnio_api.h>
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+void *vxhs_callback;
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+int main(void) {
Pablo Greco e6a3ae
+    iio_init(QNIO_VERSION, vxhs_callback);
Pablo Greco e6a3ae
+    return 0;
Pablo Greco e6a3ae
+}
Pablo Greco e6a3ae
+EOF
Pablo Greco e6a3ae
+  vxhs_libs="-lvxhs -lssl"
Pablo Greco e6a3ae
+  if compile_prog "" "$vxhs_libs" ; then
Pablo Greco e6a3ae
+    vxhs=yes
Pablo Greco e6a3ae
+  else
Pablo Greco e6a3ae
+    if test "$vxhs" = "yes" ; then
Pablo Greco e6a3ae
+      feature_not_found "vxhs block device" "Install libvxhs See github"
Pablo Greco e6a3ae
+    fi
Pablo Greco e6a3ae
+    vxhs=no
Pablo Greco e6a3ae
+  fi
Pablo Greco e6a3ae
+fi
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+##########################################
Pablo Greco e6a3ae
 # check for _Static_assert()
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 have_static_assert=no
Pablo Greco e6a3ae
@@ -6707,8 +6734,8 @@ if test "$pthread_setname_np" = "yes" ; then
Pablo Greco e6a3ae
 fi
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 if test "$vxhs" = "yes" ; then
Pablo Greco e6a3ae
-  echo "CONFIG_VXHS=m" >> $config_host_mak
Pablo Greco e6a3ae
-  echo "VXHS_LIBS= -lssl" >> $config_host_mak
Pablo Greco e6a3ae
+  echo "CONFIG_VXHS=y" >> $config_host_mak
Pablo Greco e6a3ae
+  echo "VXHS_LIBS=$vxhs_libs" >> $config_host_mak
Pablo Greco e6a3ae
 fi
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 if test "$bochs" = "yes" ; then
Pablo Greco e6a3ae
diff --git a/include/block/vxhs_shim.h b/include/block/vxhs_shim.h
Pablo Greco e6a3ae
deleted file mode 100644
Pablo Greco e6a3ae
index 42519ae..0000000
Pablo Greco e6a3ae
--- a/include/block/vxhs_shim.h
Pablo Greco e6a3ae
+++ /dev/null
Pablo Greco e6a3ae
@@ -1,143 +0,0 @@
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * Network IO library for VxHS QEMU block driver (Veritas Technologies)
Pablo Greco e6a3ae
- *
Pablo Greco e6a3ae
- * This work is licensed under the terms of the GNU GPL, version 2.  See
Pablo Greco e6a3ae
- * the COPYING file in the top-level directory.
Pablo Greco e6a3ae
- *
Pablo Greco e6a3ae
- * Contributions after 2014-08-15 are licensed under the terms of the
Pablo Greco e6a3ae
- * GNU GPL, version 2 or (at your option) any later version.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-#ifndef QNIO_API_H
Pablo Greco e6a3ae
-#define QNIO_API_H
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-#include <sys/uio.h>
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * Bump up the version everytime this file is modified
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-#define QNIO_VERSION    34
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * These are the opcodes referenced by callback routine.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-#define IRP_READ_REQUEST                    0x1FFF
Pablo Greco e6a3ae
-#define IRP_WRITE_REQUEST                   0x2FFF
Pablo Greco e6a3ae
-#define IRP_VDISK_CHECK_IO_FAILOVER_READY   2020
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * opcodes for iio_ioctl.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-#define IOR_VDISK_STAT                      1005
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * Error values for iio_cb_t callback function.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-#define QNIOERROR_HUP                       901 /* Retriable error */
Pablo Greco e6a3ae
-#define QNIOERROR_NOCONN                    902 /* Non-retriable error */
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-/* Operation Flags */
Pablo Greco e6a3ae
-#define IIO_FLAG_ASYNC        0x0001   /* Do an async send */
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * INPUT:
Pablo Greco e6a3ae
- *     ctx - opaque context
Pablo Greco e6a3ae
- *     opcode - Operation
Pablo Greco e6a3ae
- *     error - 0 for sucess, non-zero for failure.
Pablo Greco e6a3ae
- * RETURNS:
Pablo Greco e6a3ae
- *     void
Pablo Greco e6a3ae
- * DESCRIPTION:
Pablo Greco e6a3ae
- *     This callback is called, after Async request completes.
Pablo Greco e6a3ae
- *
Pablo Greco e6a3ae
- * CONTEXT:
Pablo Greco e6a3ae
- *     The callback should be wait-free.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-typedef void (*iio_cb_t) (void *ctx, uint32_t opcode, uint32_t error);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-typedef struct LibVXHSFuncs {
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * RETURNS:
Pablo Greco e6a3ae
- *     0 for sucess, non-zero for failure.
Pablo Greco e6a3ae
- * DESCRIPTION:
Pablo Greco e6a3ae
- *     Intilize the library state. This should be called at the
Pablo Greco e6a3ae
- *     begining before issuing any library call.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    int     (*iio_init)(int32_t version, iio_cb_t cb);
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * RETURNS:
Pablo Greco e6a3ae
- *     void
Pablo Greco e6a3ae
- * DESCRIPTION:
Pablo Greco e6a3ae
- *     Relinquish library resources. This should be called on the
Pablo Greco e6a3ae
- *     close of last open device.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    void    (*iio_fini)(void);
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * DESCRIPTION:
Pablo Greco e6a3ae
- *     Returns minimum QNIO API version supported by library.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    int32_t (*iio_min_version)(void);
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * DESCRIPTION:
Pablo Greco e6a3ae
- *     Returns maximum QNIO API version supported by library.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    int32_t (*iio_max_version)(void);
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * INPUT:
Pablo Greco e6a3ae
- *    uri - const string of the format of://<hostname|ip>:port
Pablo Greco e6a3ae
- *    devid - Device ID.
Pablo Greco e6a3ae
- *    flags - currently unused, this must be set to 0
Pablo Greco e6a3ae
- *    cacert - CA certificates file in PEM format
Pablo Greco e6a3ae
- *    client_key - Client private key file in PEM format
Pablo Greco e6a3ae
- *    client_cert - Client certificate file in PEM format
Pablo Greco e6a3ae
- * RETURNS:
Pablo Greco e6a3ae
- *    opeque device handle on success, NULL on failure.
Pablo Greco e6a3ae
- * DESCRIPTION:
Pablo Greco e6a3ae
- *    This call returns device handle on success. Returns NULL on
Pablo Greco e6a3ae
- *    failure with errno set
Pablo Greco e6a3ae
- *    errno can be one of:
Pablo Greco e6a3ae
- *        ENODEV - remote device not found
Pablo Greco e6a3ae
- *        EBADF  - Unable to open communication channel.
Pablo Greco e6a3ae
- *        EBUSY  - The call cannot be completed right now
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    void   *(*iio_open)(const char *uri, const char *devid, uint32_t flags,
Pablo Greco e6a3ae
-                        const char *cacert, const char *client_key,
Pablo Greco e6a3ae
-                        const char *client_cert);
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * Close the device.
Pablo Greco e6a3ae
- *    For every matching iio_open() there should be a matching iio_close()
Pablo Greco e6a3ae
- *    The last close free all data structures associated with the device.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    int32_t (*iio_close)(void *dev_handle);
Pablo Greco e6a3ae
-/*
Pablo Greco e6a3ae
- * INPUT:
Pablo Greco e6a3ae
- *    dev_handle - device descriptor on which read/write needs to be performed
Pablo Greco e6a3ae
- *    ctx - an opaque context that is not interpreted This is set for
Pablo Greco e6a3ae
- *          async calls only. It can be NULL.
Pablo Greco e6a3ae
- *    iov    - an array of iovecs (This is a scatter gather operation)
Pablo Greco e6a3ae
- *    iovcnt  - the number of iovecs
Pablo Greco e6a3ae
- *    offset - an offset to perform the write
Pablo Greco e6a3ae
- *    size   - I/O size
Pablo Greco e6a3ae
- *    flags  - can be one of
Pablo Greco e6a3ae
- *        IIO_FLAG_ASYNC - indicating this is a aio call.
Pablo Greco e6a3ae
- * RETURNS:
Pablo Greco e6a3ae
- *        -1 on error, sets errno
Pablo Greco e6a3ae
- *        EBADF  - the remote fd is bad
Pablo Greco e6a3ae
- *        EBUSY  - The call cannot be completed right now
Pablo Greco e6a3ae
- *        EPIPE  - the channel got disconnected, call back would be called in
Pablo Greco e6a3ae
- *                 addition to this.
Pablo Greco e6a3ae
- */
Pablo Greco e6a3ae
-    int32_t (*iio_writev)(void *dev_handle, void *ctx, struct iovec *iov,
Pablo Greco e6a3ae
-                          int iovcnt, uint64_t offset, uint64_t size,
Pablo Greco e6a3ae
-                          uint32_t flags);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    int32_t (*iio_readv)(void *dev_handle, void *ctx, struct iovec *iov,
Pablo Greco e6a3ae
-                         int iovcnt, uint64_t offset, uint64_t size,
Pablo Greco e6a3ae
-                         uint32_t flags);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-    int32_t (*iio_ioctl)(void *dev_handle, uint32_t opcode, void *opaque,
Pablo Greco e6a3ae
-                         uint32_t flags);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-} LibVXHSFuncs;
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
-#endif
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae