All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility
@ 2018-12-21 10:16 Yaowei Bai
  2018-12-26  7:59 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Yaowei Bai @ 2018-12-21 10:16 UTC (permalink / raw)
  To: qemu-block, qemu-devel
  Cc: Yaowei Bai, Mike Christie, Amar Tumballi, Prasanna Kalever,
	Paolo Bonzini, Fam Zheng, Xiubo Li

This patch introduces a new utility, qemu-tcmu. Apart from the
underlaying protocol it interacts with the world much like
qemu-nbd. This patch bases on Fam's version.

Qemu-tcmu handles SCSI commands which are passed through userspace
from kernel by LIO subsystem using TCMU protocol. Libtcmu is the
library for processing TCMU protocol in userspace. With qemu-tcmu,
we can export images/formats like qcow2, rbd, etc. that qemu supports
using iSCSI protocol or loopback for remote or local access.

Currently qemu-tcmu implements several SCSI command helper functions
to work. Our goal is to refactor and reuse SCSI code in scsi-disk.

Please refer to docs/tcmu.txt to use qemu-tcmu. We test it on CentOS
7.3.(Please use 3.10.0-514 or lower version kernel, there's one issuse
in higher kernel version we're resolving.)

Cc: Mike Christie <mchristi@redhat.com>
Cc: Amar Tumballi<atumball@redhat.com>
Cc: Prasanna Kalever <pkalever@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 Makefile            |   1 +
 Makefile.objs       |   3 +-
 configure           |  45 ++++
 docs/tcmu.txt       |  91 +++++++
 include/tcmu/tcmu.h |  14 +
 qemu-tcmu.c         | 214 +++++++++++++++
 tcmu/Makefile.objs  |   5 +
 tcmu/helper.c       | 741 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tcmu/helper.h       |  31 +++
 tcmu/tcmu.c         | 598 ++++++++++++++++++++++++++++++++++++++++++
 tcmu/trace-events   |  12 +
 11 files changed, 1754 insertions(+), 1 deletion(-)
 create mode 100644 docs/tcmu.txt
 create mode 100644 include/tcmu/tcmu.h
 create mode 100644 qemu-tcmu.c
 create mode 100644 tcmu/Makefile.objs
 create mode 100644 tcmu/helper.c
 create mode 100644 tcmu/helper.h
 create mode 100644 tcmu/tcmu.c
 create mode 100644 tcmu/trace-events

diff --git a/Makefile b/Makefile
index 038780c..351e9d4 100644
--- a/Makefile
+++ b/Makefile
@@ -483,6 +483,7 @@ qemu-img.o: qemu-img-cmds.h
 qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
+qemu-tcmu$(EXESUF): qemu-tcmu.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
 
 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
 
diff --git a/Makefile.objs b/Makefile.objs
index 56af034..8f96c42 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -26,7 +26,7 @@ block-obj-y += block/ scsi/
 block-obj-y += qemu-io-cmds.o
 block-obj-$(CONFIG_REPLICATION) += replication.o
 
-block-obj-m = block/
+block-obj-m = block/ tcmu/
 
 #######################################################################
 # crypto-obj-y is code used by both qemu system emulation and qemu-img
@@ -196,6 +196,7 @@ trace-events-subdirs += target/mips
 trace-events-subdirs += target/ppc
 trace-events-subdirs += target/s390x
 trace-events-subdirs += target/sparc
+trace-events-subdirs += tcmu
 trace-events-subdirs += ui
 trace-events-subdirs += util
 
diff --git a/configure b/configure
index 224d307..d41e4e9 100755
--- a/configure
+++ b/configure
@@ -346,6 +346,7 @@ fdt=""
 netmap="no"
 sdl=""
 sdlabi=""
+tcmu=""
 virtfs=""
 mpath=""
 vnc="yes"
@@ -1034,6 +1035,10 @@ for opt do
     # configure to be used by RPM and similar macros that set
     # lots of directory switches by default.
   ;;
+  --enable-tcmu) tcmu="yes"
+  ;;
+  --disable-tcmu) tcmu="no"
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-sdl) sdl="yes"
@@ -3607,6 +3612,36 @@ else
 fi
 
 ##########################################
+# tcmu support probe
+
+if test "$tcmu" != "no"; then
+  # Sanity check for gio-unix-2.0 (part of glib2), cannot fail unless something
+  # is very wrong.
+  if ! $pkg_config gio-unix-2.0; then
+    error_exit "glib is required to compile QEMU"
+  fi
+  cat > $TMPC <<EOF
+#include <stdio.h>
+#include <libtcmu.h>
+
+int main(int argc, char **argv)
+{
+  struct tcmulib_context *ctx = tcmulib_initialize(NULL, 0);
+  tcmulib_register(ctx);
+  return ctx != NULL;
+}
+EOF
+  if compile_prog "" "-ltcmu" ; then
+    tcmu=yes
+    tcmu_libs="-ltcmu"
+  elif test "$tcmu" == "yes"; then
+    feature_not_found "libtcmu" "Install libtcmu devel (>=1.0.5)"
+  else
+    tcmu=no
+  fi
+fi
+
+##########################################
 # libmpathpersist probe
 
 if test "$mpath" != "no" ; then
@@ -5756,6 +5791,9 @@ if test "$want_tools" = "yes" ; then
   if [ "$posix" = "yes" ] && [ "$curl" = "yes" ]; then
     tools="elf2dmp $tools"
   fi
+  if [ "$linux" = "yes" -a "$tcmu" = "yes" ] ; then
+    tools="qemu-tcmu\$(EXESUF) $tools"
+  fi
 fi
 if test "$softmmu" = yes ; then
   if test "$linux" = yes; then
@@ -6142,6 +6180,7 @@ echo "capstone          $capstone"
 echo "docker            $docker"
 echo "libpmem support   $libpmem"
 echo "libudev           $libudev"
+echo "tcmu support      $tcmu"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -6782,6 +6821,12 @@ if test "$live_block_migration" = "yes" ; then
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
 fi
 
+if test "$tcmu" = "yes" ; then
+  echo "CONFIG_TCMU=m" >> $config_host_mak
+  echo "TCMU_CFLAGS=$tcmu_cflags" >> $config_host_mak
+  echo "TCMU_LIBS=$tcmu_libs" >> $config_host_mak
+fi
+
 if test "$tpm" = "yes"; then
   echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
   # TPM passthrough support?
diff --git a/docs/tcmu.txt b/docs/tcmu.txt
new file mode 100644
index 0000000..ffe5f85
--- /dev/null
+++ b/docs/tcmu.txt
@@ -0,0 +1,91 @@
+Introduction
+-------------------------
+TCMU is the abbreviation of TCM in Userspace and TCM is another
+name for LIO, an ISCSI target in Linux kernel. TCM can serve
+file, block device, RAM, etc as storage backend for ISCSI target
+totally in kernel. But for userspace storage like Glusterfs and 
+Ceph, it's hard for TCM to handle as backend storage. TCMU is used
+in this situation by utilizing UIO ring buffer to passthrough
+userspace so a userspace program can process SCSI command by handling
+TCMU protocol. Qemu-tcmu is such userspace program which can export
+any format/protocol that QEMU supports as ISCSI target or loopback
+by linking to libtcmu in tcmu-runner(a userspace helper daemon to
+handle TCMU interfaces).
+
+Installation
+--------------------
+Qemu-tcmu depends on libtcmu/tcmu-runner to handle TCMU userspace
+interfaces and targetcli-fb and other utilities to manage ISCSI
+targets.
+
+1. install and config tcmu-runner
+
+   # git clone https://github.com/open-iscsi/tcmu-runner
+   # cd tcmu-runner
+   # cmake -DSUPPORT_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX=/usr
+   # make install
+   # systemctl daemon-reload
+   # systemctl enable tcmu-runner
+   # systemctl start tcmu-runner
+
+2. install rtslib-fb
+
+   # git clone https://github.com/open-iscsi/rtslib-fb.git
+   # cd rtslib-fb
+   # python setup.py install
+
+3. install configshell-fb
+
+   # git clone https://github.com/open-iscsi/configshell-fb.git
+   # cd configshell-fb
+   # python setup.py install
+
+4. install targetcli-fb 
+
+   # git clone https://github.com/open-iscsi/targetcli-fb.git
+   # cd targetcli-fb
+   # python setup.py install
+
+5. install qemu-tcmu
+
+   # git clone https://github.com/qemu/qemu.git
+   # cd qemu
+   # ./configure --target-list=x86_64-softmmu \
+                 --enable-libiscsi \
+                 --enable-tcmu
+   # make -j 
+   # make -j install
+
+Now we can use qemu-tcmu to export images.
+
+1. create backend storage file
+
+   # qemu-img create test.file 1G
+
+2. load TCMU kernel module
+
+   # modprobe target_core_user
+
+3. start qemu-tcmu
+
+   # qemu-tcmu
+
+4. configure ISCSI target via targetcli
+
+   # IQN=iqn.2016-11.org.test:qemu-tcmu-test
+   # targetcli /backstores/user:qemu create qemulun 1G @id=test@file=/root/test.file
+   # targetcli /iscsi create $IQN
+   # targetcli /iscsi/$IQN/tpg1 set attribute \
+                             authentication=0 \
+                             generate_node_acls=1 \
+                             demo_mode_write_protect=0 \
+                             prod_mode_write_protect=0
+   # targetcli /iscsi/$IQN/tpg1/luns create /backstores/user:qemu/qemulun
+
+Then you can connect this exported target on another initiator host.
+
+Others
+------
+More infomation about TCMU and tcmu-runner please refer to
+Documentation/target/tcmu-design.txt in Linux kernel and
+https://github.com/open-iscsi/tcmu-runner.
diff --git a/include/tcmu/tcmu.h b/include/tcmu/tcmu.h
new file mode 100644
index 0000000..656a545
--- /dev/null
+++ b/include/tcmu/tcmu.h
@@ -0,0 +1,14 @@
+#ifndef QEMU_TCMU_H
+#define QEMU_TCMU_H
+
+#include "qemu-common.h"
+
+typedef struct TCMUExport TCMUExport;
+extern QemuOptsList qemu_tcmu_export_opts;
+
+void qemu_tcmu_stop(void);
+void qemu_tcmu_start(const char *subtype, Error **errp);
+TCMUExport *tcmu_export_new(BlockBackend *blk, bool writable, Error **errp);
+int export_init_func(void *opaque, QemuOpts *all_opts, Error **errp);
+
+#endif
diff --git a/qemu-tcmu.c b/qemu-tcmu.c
new file mode 100644
index 0000000..85e348f
--- /dev/null
+++ b/qemu-tcmu.c
@@ -0,0 +1,214 @@
+/*
+ *  Copyright 2016  Red Hat, Inc.
+ *
+ *  TCMU Handler Program
+ *
+ *  Authors:
+ *    Fam Zheng <famz@redhat.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu/cutils.h"
+#include "sysemu/block-backend.h"
+#include "block/block_int.h"
+#include "qemu/main-loop.h"
+#include "qemu/error-report.h"
+#include "qemu/config-file.h"
+#include "qemu/bswap.h"
+#include "qemu/log.h"
+#include "qemu/option.h"
+#include "block/snapshot.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qstring.h"
+#include "qom/object_interfaces.h"
+#include "crypto/init.h"
+#include "trace/control.h"
+#include "tcmu/tcmu.h"
+#include <getopt.h>
+#include "qemu-version.h"
+
+#define QEMU_TCMU_OPT_OBJECT        260
+
+static int verbose;
+static enum { RUNNING, TERMINATING, TERMINATED } state;
+
+static void usage(const char *name)
+{
+    (printf) (
+"Usage:\n" 
+"%s [OPTIONS]\n"
+"QEMU TCMU Handler\n"
+"\n"
+"  -h, --help                display this help and exit\n"
+"  -V, --version             output version information and exit\n"
+"\n"
+"General purpose options:\n"
+"  -v, --verbose             display extra debugging information\n"
+"  -x, --handler-name=NAME   handler name to be used as the subtype for TCMU\n"
+"  --object type,id=ID,...   define an object such as 'secret' for providing\n"
+"                            passwords and/or encryption keys\n"
+"  -T, --trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
+"                            specify tracing options\n"
+"\n"
+"Report bugs to <qemu-devel@nongnu.org>\n"
+    , name);
+}
+
+static void version(const char *name)
+{
+    printf("%s v" QEMU_FULL_VERSION "\n", name);
+}
+
+static void termsig_handler(int signum)
+{
+    atomic_cmpxchg(&state, RUNNING, TERMINATING);
+    qemu_notify_event();
+}
+
+static QemuOptsList qemu_object_opts = {
+    .name = "object",
+    .implied_opt_name = "qom-type",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head),
+    .desc = {
+        { }
+    },
+};
+
+static void qemu_tcmu_shutdown(void)
+{
+    job_cancel_sync_all();
+    bdrv_close_all();
+}
+
+int main(int argc, char **argv)
+{
+    const char *sopt = "hVvx:T:";
+    bool starting = true;
+    struct option lopt[] = {
+        { "help", no_argument, NULL, 'h' },
+        { "version", no_argument, NULL, 'V' },
+        { "verbose", no_argument, NULL, 'v' },
+        { "object", required_argument, NULL, QEMU_TCMU_OPT_OBJECT },
+        { "handler-name", required_argument, NULL, 'x' },
+        { "trace", required_argument, NULL, 'T' },
+        { NULL, 0, NULL, 0 }
+    };
+    int ch;
+    int opt_ind = 0;
+    Error *local_err = NULL;
+    char *trace_file = NULL;
+    const char *subtype = "qemu";
+
+    struct sigaction sa_sigterm;
+    memset(&sa_sigterm, 0, sizeof(sa_sigterm));
+    sa_sigterm.sa_handler = termsig_handler;
+    sigaction(SIGTERM, &sa_sigterm, NULL);
+    sigaction(SIGINT, &sa_sigterm, NULL);
+
+    module_call_init(MODULE_INIT_TRACE);
+    qcrypto_init(&error_fatal);
+
+    module_call_init(MODULE_INIT_QOM);
+    qemu_add_opts(&qemu_object_opts);
+    qemu_add_opts(&qemu_trace_opts);
+    qemu_init_exec_dir(argv[0]);
+
+    while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) {
+        switch (ch) {
+        case 'x':
+            subtype = optarg;
+            break;
+        case 'v':
+            verbose = 1;
+            break;
+        case 'V':
+            version(argv[0]);
+            exit(0);
+            break;
+        case 'h':
+            usage(argv[0]);
+            exit(0);
+            break;
+        case '?':
+            error_report("Try `%s --help' for more information.", argv[0]);
+            exit(EXIT_FAILURE);
+        case QEMU_TCMU_OPT_OBJECT: {
+            QemuOpts *opts;
+            opts = qemu_opts_parse_noisily(&qemu_object_opts,
+                                           optarg, true);
+            if (!opts) {
+                exit(EXIT_FAILURE);
+            }
+        }   break;
+        case 'T':
+            g_free(trace_file);
+            trace_file = trace_opt_parse(optarg);
+            break;
+        }
+    }
+
+    if ((argc - optind) != 0) {
+        error_report("Invalid number of arguments");
+        error_printf("Try `%s --help' for more information.\n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    if (qemu_opts_foreach(&qemu_object_opts,
+                          user_creatable_add_opts_foreach,
+                          NULL, NULL)) {
+        exit(EXIT_FAILURE);
+    }
+
+    if (!trace_init_backends()) {
+        exit(1);
+    }
+    trace_init_file(trace_file);
+    qemu_set_log(LOG_TRACE);
+
+    if (qemu_init_main_loop(&local_err)) {
+        error_report_err(local_err);
+        exit(EXIT_FAILURE);
+    }
+    bdrv_init();
+    atexit(qemu_tcmu_shutdown);
+
+    /* now when the initialization is (almost) complete, chdir("/")
+     * to free any busy filesystems */
+    if (chdir("/") < 0) {
+        error_report("Could not chdir to root directory: %s",
+                     strerror(errno));
+        exit(EXIT_FAILURE);
+    }
+
+    state = RUNNING;
+    do {
+        main_loop_wait(starting);
+        if (starting) {
+            qemu_tcmu_start(subtype, &local_err);
+            if (local_err) {
+                error_report_err(local_err);
+                exit(EXIT_FAILURE);
+            }
+            starting = false;
+        }
+        if (state == TERMINATING) {
+            state = TERMINATED;
+            qemu_tcmu_stop();
+        }
+    } while (state != TERMINATED);
+
+    exit(EXIT_SUCCESS);
+}
diff --git a/tcmu/Makefile.objs b/tcmu/Makefile.objs
new file mode 100644
index 0000000..9ffa5b9
--- /dev/null
+++ b/tcmu/Makefile.objs
@@ -0,0 +1,5 @@
+block-obj-$(CONFIG_TCMU) += tcmu.mo
+
+tcmu.mo-objs       := tcmu.o helper.o
+tcmu.mo-cflags     := $(TCMU_CFLAGS)
+tcmu.mo-libs       := $(TCMU_LIBS)
diff --git a/tcmu/helper.c b/tcmu/helper.c
new file mode 100644
index 0000000..0b86b4d
--- /dev/null
+++ b/tcmu/helper.c
@@ -0,0 +1,741 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc.
+ *
+ * This file is licensed to you under your choice of the GNU Lesser
+ * General Public License, version 2.1 or any later version (LGPLv2.1 or
+ * later), or the Apache License 2.0.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "scsi/constants.h"
+#include "libtcmu.h"
+#include "helper.h"
+
+static int tcmu_emulate_std_inquiry(
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	uint8_t buf[36];
+
+	memset(buf, 0, sizeof(buf));
+
+	buf[2] = 0x05; /* SPC-3 */
+	buf[3] = 0x02; /* response data format */
+
+	/*
+	 * A Third-Party Copy (3PC)
+	 *
+	 * Enable the XCOPY
+	 */
+	buf[5] = 0x08;
+
+	buf[7] = 0x02; /* CmdQue */
+
+	memcpy(&buf[8], "LIO-ORG ", 8);
+	memset(&buf[16], 0x20, 16);
+	memcpy(&buf[16], "TCMU device", 11);
+	memcpy(&buf[32], "0002", 4);
+	buf[4] = 31; /* Set additional length to 31 */
+
+	tcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));
+	return TCMU_STS_OK;
+}
+
+/* This func from CCAN str/hex/hex.c. Public Domain */
+static bool char_to_hex(unsigned char *val, char c)
+{
+	if (c >= '0' && c <= '9') {
+		*val = c - '0';
+		return true;
+	}
+	if (c >= 'a' && c <= 'f') {
+		*val = c - 'a' + 10;
+		return true;
+	}
+	if (c >= 'A' && c <= 'F') {
+		*val = c - 'A' + 10;
+		return true;
+	}
+	return false;
+}
+
+static int tcmu_emulate_evpd_inquiry(
+	struct tcmu_device *dev,
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	switch (cdb[2]) {
+	case 0x0: /* Supported VPD pages */
+	{
+		char data[16];
+
+		memset(data, 0, sizeof(data));
+
+		/* data[1] (page code) already 0 */
+		/*
+		  *  spc4r22 7.7.13 The supported VPD page list shall contain
+		  *  a list of all VPD page codes (see 7.7) implemented by the
+		  *  logical unit in ascending order beginning with page code 00h
+		  */
+		data[4] = 0x00;
+		data[5] = 0x80;
+		data[6] = 0x83;
+		data[7] = 0xb0;
+		data[8] = 0xb1;
+		data[9] = 0xb2;
+
+		data[3] = 6;
+
+		tcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));
+		return TCMU_STS_OK;
+	}
+	break;
+	case 0x80: /* Unit Serial Number */
+	{
+		char data[512];
+		char *wwn;
+		uint32_t len;
+
+		memset(data, 0, sizeof(data));
+
+		data[1] = 0x80;
+
+		wwn = tcmu_cfgfs_dev_get_wwn(dev);
+		if (!wwn)
+			return TCMU_STS_HW_ERR;
+
+		/*
+		 * The maximum length of the unit_serial has limited
+		 * to 254 Bytes in kernel, so here limit to 256 Bytes
+		 * will be enough.
+		 */
+		len = snprintf(&data[4], 256, "%s", wwn);
+		data[3] = len + 1;
+
+		tcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));
+
+		free(wwn);
+		return TCMU_STS_OK;
+	}
+	break;
+	case 0x83: /* Device identification */
+	{
+		char data[512];
+		char *ptr, *p, *wwn;
+		size_t len, used = 0;
+		uint16_t *tot_len = (uint16_t*) &data[2];
+		bool next;
+		int i;
+
+		memset(data, 0, sizeof(data));
+
+		data[1] = 0x83;
+
+		wwn = tcmu_cfgfs_dev_get_wwn(dev);
+		if (!wwn)
+			return TCMU_STS_HW_ERR;
+
+		ptr = &data[4];
+
+		/* 1/5: T10 Vendor id */
+		ptr[0] = 2; /* code set: ASCII */
+		ptr[1] = 1; /* identifier: T10 vendor id */
+		memcpy(&ptr[4], "LIO-ORG ", 8);
+		len = snprintf(&ptr[12], sizeof(data) - 16, "%s", wwn);
+
+		ptr[3] = 8 + len + 1;
+		used += (uint8_t)ptr[3] + 4;
+		ptr += used;
+
+		/* 2/5: NAA binary */
+		ptr[0] = 1; /* code set: binary */
+		ptr[1] = 3; /* identifier: NAA */
+		ptr[3] = 16; /* body length for naa registered extended format */
+
+		/*
+		 * Set type 6 and use OpenFabrics IEEE Company ID: 00 14 05
+		 */
+		ptr[4] = 0x60;
+		ptr[5] = 0x01;
+		ptr[6] = 0x40;
+		ptr[7] = 0x50;
+
+		/*
+		 * Fill in the rest with a binary representation of WWN
+		 *
+		 * This implementation only uses a nibble out of every byte of
+		 * WWN, but this is what the kernel does, and it's nice for our
+		 * values to match.
+		 */
+		next = true;
+		for (p = wwn, i = 7; *p && i < 20; p++) {
+			uint8_t val;
+
+			if (!char_to_hex(&val, *p))
+				continue;
+
+			if (next) {
+				next = false;
+				ptr[i++] |= val;
+			} else {
+				next = true;
+				ptr[i] = val << 4;
+			}
+		}
+
+		used += 20;
+		ptr += 20;
+
+		/* 3/6: Vendor specific */
+		ptr[0] = 2; /* code set: ASCII */
+		ptr[1] = 0; /* identifier: vendor-specific */
+
+		len = snprintf(&ptr[4], sizeof(data) - used - 4, "%s", tcmu_dev_get_cfgstring(dev));
+		ptr[3] = len + 1;
+
+		used += (uint8_t)ptr[3] + 4;
+		ptr += (uint8_t)ptr[3] + 4;
+
+		/* Done with descriptor list */
+
+		*tot_len = htobe16(used);
+
+		tcmu_memcpy_into_iovec(iovec, iov_cnt, data, used + 4);
+
+		free(wwn);
+		wwn = NULL;
+
+		return TCMU_STS_OK;
+	}
+	break;
+	case 0xb0: /* Block Limits */
+	{
+		char data[64];
+		uint32_t max_xfer_length;
+		uint16_t val16;
+		uint32_t val32;
+
+		memset(data, 0, sizeof(data));
+
+		data[1] = 0xb0;
+
+		val16 = htobe16(0x3c);
+		memcpy(&data[2], &val16, 2);
+
+		/* WSNZ = 1: the device server won't support a value of zero
+		 * in the NUMBER OF LOGICAL BLOCKS field in the WRITE SAME
+		 * command CDBs
+		 */
+		data[4] = 0x01;
+
+		/*
+		 * Daemons like runner may override the user requested
+		 * value due to device specific limits.
+		 */
+		max_xfer_length = tcmu_dev_get_max_xfer_len(dev);
+
+		val32 = htobe32(max_xfer_length);
+		/* Max xfer length */
+		memcpy(&data[8], &val32, 4);
+		/* Optimal xfer length */
+		memcpy(&data[12], &val32, 4);
+
+		tcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));
+
+		return TCMU_STS_OK;
+	}
+	break;
+	case 0xb1: /* Block Device Characteristics VPD page */
+	{
+		char data[64];
+		uint16_t val16;
+
+		memset(data, 0, sizeof(data));
+
+		/*
+		 * From spc-5 Revision 14, section 6.7.2 Standard INQUIRY data
+		 * set the devive type to Direct access block device.
+		 */
+		data[0] = 0x00;
+
+		/* PAGE CODE (B1h) */
+		data[1] = 0xb1;
+
+		/* PAGE LENGTH (003Ch)*/
+		val16 = htobe16(0x003c);
+		memcpy(&data[2], &val16, 2);
+
+		if (tcmu_dev_get_solid_state_media(dev)) {
+			val16 = htobe16(0x0001);
+			memcpy(&data[4], &val16, 2);
+		}
+
+		tcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));
+		return TCMU_STS_OK;
+	}
+	break;
+	case 0xb2: /* Logical Block Provisioning VPD page */
+	{
+		char data[64];
+		uint16_t val16;
+
+		memset(data, 0, sizeof(data));
+
+		/*
+		 * From spc-5 Revision 14, section 6.7.2 Standard INQUIRY data
+		 * set the device type to Direct access block device.
+		 */
+		data[0] = 0x00;
+
+		/* PAGE CODE (B2h) */
+		data[1] = 0xb2;
+
+		/*
+		 * PAGE LENGTH field: PROVISIONING GROUP DESCRIPTOR field will be
+		 * not present.
+		 */
+		val16 = htobe16(0x0004);
+		memcpy(&data[2], &val16, 2);
+
+		/*
+		 * The logical block provisioning read zeros (LBPRZ) field.
+		 *
+		 * The logical block data represented by unmapped LBAs is set to zeros
+		 */
+		data[5] = 0x04;
+
+		tcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));
+		return TCMU_STS_OK;
+	}
+	break;
+	default:
+		error_report("Vital product data page code 0x%x not support\n",
+			     cdb[2]);
+		return TCMU_STS_INVALID_CDB;
+	}
+}
+
+/*
+ * Emulate INQUIRY(0x12)
+ */
+int tcmu_emulate_inquiry(
+	struct tcmu_device *dev,
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	if (!(cdb[1] & 0x01)) {
+		if (!cdb[2])
+			return tcmu_emulate_std_inquiry(cdb, iovec,
+							iov_cnt);
+		else
+			return TCMU_STS_INVALID_CDB;
+	} else {
+		return tcmu_emulate_evpd_inquiry(dev, cdb, iovec, iov_cnt);
+	}
+}
+
+int tcmu_emulate_test_unit_ready(
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	return TCMU_STS_OK;
+}
+
+int tcmu_emulate_read_capacity_10(
+	uint64_t num_lbas,
+	uint32_t block_size,
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	uint8_t buf[8];
+	uint32_t val32;
+
+	memset(buf, 0, sizeof(buf));
+
+	if (num_lbas < 0x100000000ULL) {
+		// Return the LBA of the last logical block, so subtract 1.
+		val32 = htobe32(num_lbas-1);
+	} else {
+		// This lets the initiator know that he needs to use
+		// Read Capacity(16).
+		val32 = 0xffffffff;
+	}
+
+	memcpy(&buf[0], &val32, 4);
+
+	val32 = htobe32(block_size);
+	memcpy(&buf[4], &val32, 4);
+
+	/* all else is zero */
+
+	tcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));
+
+	return TCMU_STS_OK;
+}
+
+int tcmu_emulate_read_capacity_16(
+	uint64_t num_lbas,
+	uint32_t block_size,
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	uint8_t buf[32];
+	uint64_t val64;
+	uint32_t val32;
+
+	memset(buf, 0, sizeof(buf));
+
+	// Return the LBA of the last logical block, so subtract 1.
+	val64 = htobe64(num_lbas-1);
+	memcpy(&buf[0], &val64, 8);
+
+	val32 = htobe32(block_size);
+	memcpy(&buf[8], &val32, 4);
+
+	/*
+	 * Logical Block Provisioning Management Enabled (LBPME) bit
+	 *
+	 * The LBPME bit sets to one and then the logical unit implements
+	 * logical block provisioning management
+	 */
+	buf[14] = 0x80;
+
+	/*
+	 * The logical block provisioning read zeros (LBPRZ) bit shall be
+	 * set to one if the LBPRZ field is set to xx1b in VPD B2. The
+	 * LBPRZ bit shall be set to zero if the LBPRZ field is not set
+	 * to xx1b.
+	 */
+	buf[14] |= 0x40;
+
+	/* all else is zero */
+
+	tcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));
+
+	return TCMU_STS_OK;
+}
+
+static void copy_to_response_buf(uint8_t *to_buf, size_t to_len,
+				 uint8_t *from_buf, size_t from_len)
+{
+	if (!to_buf)
+		return;
+	/*
+	 * SPC 4r37: 4.3.5.6 Allocation length:
+	 *
+	 * The device server shall terminate transfers to the Data-In Buffer
+	 * when the number of bytes or blocks specified by the ALLOCATION
+	 * LENGTH field have been transferred or when all available data
+	 * have been transferred, whichever is less.
+	 */
+	memcpy(to_buf, from_buf, to_len > from_len ? from_len : to_len);
+}
+
+static int handle_rwrecovery_page(struct tcmu_device *dev, uint8_t *ret_buf,
+			   size_t ret_buf_len)
+{
+	uint8_t buf[12];
+
+	memset(buf, 0, sizeof(buf));
+	buf[0] = 0x1;
+	buf[1] = 0xa;
+
+	copy_to_response_buf(ret_buf, ret_buf_len, buf, 12);
+	return 12;
+}
+
+static int handle_cache_page(struct tcmu_device *dev, uint8_t *ret_buf,
+		      size_t ret_buf_len)
+{
+	uint8_t buf[20];
+
+	memset(buf, 0, sizeof(buf));
+	buf[0] = 0x8;
+	buf[1] = 0x12;
+
+	/*
+	 * If device supports a writeback cache then set writeback
+	 * cache enable (WCE)
+	 */
+	if (tcmu_dev_get_write_cache_enabled(dev))
+		buf[2] = 0x4;
+
+	copy_to_response_buf(ret_buf, ret_buf_len, buf, 20);
+	return 20;
+}
+
+static int handle_control_page(struct tcmu_device *dev, uint8_t *ret_buf,
+			       size_t ret_buf_len)
+{
+	uint8_t buf[12];
+
+	memset(buf, 0, sizeof(buf));
+	buf[0] = 0x0a;
+	buf[1] = 0x0a;
+
+	/* From spc4r31, section 7.5.7 Control mode Page
+	 *
+	 * GLTSD = 1: because we don't implicitly save log parameters
+	 *
+	 * A global logging target save disable (GLTSD) bit set to
+	 * zero specifies that the logical unit implicitly saves, at
+	 * vendor specific intervals, each log parameter in which the
+	 * TSD bit (see 7.3) is set to zero. A GLTSD bit set to one
+	 * specifies that the logical unit shall not implicitly save
+	 * any log parameters.
+	 */
+	buf[2] = 0x02;
+
+	/* From spc4r31, section 7.5.7 Control mode Page
+	 *
+	 * TAS = 1: Currently not settable by tcmu. Using the LIO default
+	 *
+	 * A task aborted status (TAS) bit set to zero specifies that
+	 * aborted commands shall be terminated by the device server
+	 * without any response to the application client. A TAS bit
+	 * set to one specifies that commands aborted by the actions
+	 * of an I_T nexus other than the I_T nexus on which the command
+	 * was received shall be completed with TASK ABORTED status
+	 */
+	buf[5] = 0x40;
+
+	/* From spc4r31, section 7.5.7 Control mode Page
+	 *
+	 * BUSY TIMEOUT PERIOD: Currently is unlimited
+	 *
+	 * The BUSY TIMEOUT PERIOD field specifies the maximum time, in
+	 * 100 milliseconds increments, that the application client allows
+	 * for the device server to return BUSY status for unanticipated
+	 * conditions that are not a routine part of commands from the
+	 * application client. This value may be rounded down as defined
+	 * in 5.4(the Parameter rounding section).
+	 *
+	 * A 0000h value in this field is undefined by this standard.
+	 * An FFFFh value in this field is defined as an unlimited period.
+	 */
+	buf[8] = 0xff;
+	buf[9] = 0xff;
+
+	copy_to_response_buf(ret_buf, ret_buf_len, buf, 12);
+	return 12;
+}
+
+
+static struct mode_sense_handler {
+	uint8_t page;
+	uint8_t subpage;
+	int (*get)(struct tcmu_device *dev, uint8_t *buf, size_t buf_len);
+} modesense_handlers[] = {
+	{0x1, 0, handle_rwrecovery_page},
+	{0x8, 0, handle_cache_page},
+	{0xa, 0, handle_control_page},
+};
+
+static ssize_t handle_mode_sense(struct tcmu_device *dev,
+				 struct mode_sense_handler *handler,
+				 uint8_t **buf, size_t alloc_len,
+				 size_t *used_len, bool sense_ten)
+{
+	int ret;
+
+	ret = handler->get(dev, *buf, alloc_len - *used_len);
+
+	if  (!sense_ten && (*used_len + ret >= 255))
+		return -EINVAL;
+
+	/*
+	 * SPC 4r37: 4.3.5.6 Allocation length:
+	 *
+	 * If the information being transferred to the Data-In Buffer includes
+	 * fields containing counts of the number of bytes in some or all of
+	 * the data (e.g., the PARAMETER DATA LENGTH field, the PAGE LENGTH
+	 * field, the DESCRIPTOR LENGTH field, the AVAILABLE DATA field),
+	 * then the contents of these fields shall not be altered to reflect
+	 * the truncation, if any, that results from an insufficient
+	 * ALLOCATION LENGTH value
+	 */
+	/*
+	 * Setup the buffer so to still loop over the handlers, but just
+	 * increment the used_len so we can return the
+	 * final value.
+	 */
+	if (*buf && (*used_len + ret >= alloc_len))
+		*buf = NULL;
+
+	*used_len += ret;
+	if (*buf)
+		*buf += ret;
+	return ret;
+}
+
+/*
+ * Handle MODE_SENSE(6) and MODE_SENSE(10).
+ *
+ * For TYPE_DISK only.
+ */
+int tcmu_emulate_mode_sense(
+	struct tcmu_device *dev,
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	bool sense_ten = (cdb[0] == MODE_SENSE_10);
+	uint8_t page_code = cdb[2] & 0x3f;
+	uint8_t subpage_code = cdb[3];
+	size_t alloc_len = tcmu_dev_get_max_xfer_len(dev);
+	int i;
+	int ret;
+	size_t used_len;
+	uint8_t *buf;
+	uint8_t *orig_buf = NULL;
+
+	if (!alloc_len)
+		return TCMU_STS_OK;
+
+	/* Mode parameter header. Mode data length filled in at the end. */
+	used_len = sense_ten ? 8 : 4;
+	if (used_len > alloc_len)
+		goto fail;
+
+	buf = calloc(1, alloc_len);
+	if (!buf)
+		return TCMU_STS_NO_RESOURCE;
+
+	orig_buf = buf;
+	buf += used_len;
+
+	/* Don't fill in device-specific parameter */
+	/* This helper fn doesn't support sw write protect (SWP) */
+
+	/* Don't report block descriptors */
+
+	if (page_code == 0x3f) {
+		for (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {
+			ret = handle_mode_sense(dev, &modesense_handlers[i],
+						&buf, alloc_len, &used_len,
+						sense_ten);
+			if (ret < 0)
+				goto free_buf;
+		}
+	} else {
+		ret = 0;
+
+		for (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {
+			if (page_code == modesense_handlers[i].page &&
+			    subpage_code == modesense_handlers[i].subpage) {
+				ret = handle_mode_sense(dev,
+							&modesense_handlers[i],
+							&buf, alloc_len,
+							&used_len, sense_ten);
+				break;
+			}
+		}
+
+		if (ret <= 0)
+			goto free_buf;
+	}
+
+	if (sense_ten) {
+		uint16_t *ptr = (uint16_t*) orig_buf;
+		*ptr = htobe16(used_len - 2);
+	}
+	else {
+		orig_buf[0] = used_len - 1;
+	}
+
+	tcmu_memcpy_into_iovec(iovec, iov_cnt, orig_buf, alloc_len);
+	free(orig_buf);
+	return TCMU_STS_OK;
+
+free_buf:
+	free(orig_buf);
+fail:
+	return TCMU_STS_INVALID_CDB;
+}
+
+/*
+ * Handle MODE_SELECT(6) and MODE_SELECT(10).
+ *
+ * For TYPE_DISK only.
+ */
+int tcmu_emulate_mode_select(
+	struct tcmu_device *dev,
+	uint8_t *cdb,
+	struct iovec *iovec,
+	size_t iov_cnt)
+{
+	bool select_ten = (cdb[0] == MODE_SELECT_10);
+	uint8_t page_code = cdb[2] & 0x3f;
+	uint8_t subpage_code = cdb[3];
+	size_t alloc_len = tcmu_dev_get_max_xfer_len(dev);
+	int i;
+	int ret = 0;
+	size_t hdr_len = select_ten ? 8 : 4;
+	uint8_t buf[512];
+	uint8_t in_buf[512];
+	bool got_sense = false;
+
+	if (!alloc_len)
+		return TCMU_STS_OK;
+
+	if (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))
+		return TCMU_STS_INVALID_PARAM_LIST_LEN;
+
+	/* Abort if !pf or sp */
+	if (!(cdb[1] & 0x10) || (cdb[1] & 0x01))
+		return TCMU_STS_INVALID_CDB;
+
+	memset(buf, 0, sizeof(buf));
+	for (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {
+		if (page_code == modesense_handlers[i].page
+		    && subpage_code == modesense_handlers[i].subpage) {
+			ret = modesense_handlers[i].get(dev, &buf[hdr_len],
+							sizeof(buf) - hdr_len);
+			if (ret <= 0)
+				return TCMU_STS_INVALID_CDB;
+
+			if  (!select_ten && (hdr_len + ret >= 255))
+				return TCMU_STS_INVALID_CDB;
+
+			got_sense = true;
+			break;
+		}
+	}
+
+	if (!got_sense)
+		return TCMU_STS_INVALID_CDB;
+
+	if (alloc_len < (hdr_len + ret))
+		return TCMU_STS_INVALID_PARAM_LIST_LEN;
+
+	/* Verify what was selected is identical to what sense returns, since we
+	   don't support actually setting anything. */
+	if (memcmp(&buf[hdr_len], &in_buf[hdr_len], ret))
+		return TCMU_STS_INVALID_PARAM_LIST;
+
+	return TCMU_STS_OK;
+}
+
+int tcmu_emulate_start_stop(struct tcmu_device *dev, uint8_t *cdb)
+{
+	if ((cdb[4] >> 4) & 0xf)
+		return TCMU_STS_INVALID_CDB;
+
+	/* Currently, we don't allow ejecting the medium, so we're
+	 * ignoring the FBO_PREV_EJECT flag, but it may turn out that
+	 * initiators do not handle this well, so we may have to change
+	 * this behavior.
+	 */
+
+	if (!(cdb[4] & 0x01))
+		return TCMU_STS_INVALID_CDB;
+
+	return TCMU_STS_OK;
+}
diff --git a/tcmu/helper.h b/tcmu/helper.h
new file mode 100644
index 0000000..bbbc2be
--- /dev/null
+++ b/tcmu/helper.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc.
+ *
+ * This file is licensed to you under your choice of the GNU Lesser
+ * General Public License, version 2.1 or any later version (LGPLv2.1 or
+ * later), or the Apache License 2.0.
+ */
+
+/*
+ * APIs for both libtcmu users and tcmu-runner plugins to use.
+ */
+
+#ifndef __TCMU_HELPER_H
+#define __TCMU_HELPER_H
+
+#include <stdbool.h>
+
+/* Basic implementations of mandatory SCSI commands */
+int tcmu_emulate_inquiry(struct tcmu_device *dev, uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);
+int tcmu_emulate_start_stop(struct tcmu_device *dev, uint8_t *cdb);
+int tcmu_emulate_test_unit_ready(uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);
+int tcmu_emulate_read_capacity_10(uint64_t num_lbas, uint32_t block_size, uint8_t *cdb,
+				  struct iovec *iovec, size_t iov_cnt);
+int tcmu_emulate_read_capacity_16(uint64_t num_lbas, uint32_t block_size, uint8_t *cdb,
+				  struct iovec *iovec, size_t iov_cnt);
+int tcmu_emulate_mode_sense(struct tcmu_device *dev, uint8_t *cdb,
+			    struct iovec *iovec, size_t iov_cnt);
+int tcmu_emulate_mode_select(struct tcmu_device *dev, uint8_t *cdb,
+			     struct iovec *iovec, size_t iov_cnt);
+
+#endif
diff --git a/tcmu/tcmu.c b/tcmu/tcmu.c
new file mode 100644
index 0000000..70b9a91
--- /dev/null
+++ b/tcmu/tcmu.c
@@ -0,0 +1,598 @@
+/*
+ *  A TCMU userspace handler for QEMU block drivers.
+ *
+ *  Copyright (C) 2016 Red Hat, Inc.
+ *
+ *  Authors:
+ *      Fam Zheng <famz@redhat.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; under version 2 of the License.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "libtcmu.h"
+#include "helper.h"
+#include "qapi/qmp/qerror.h"
+#include "qemu/error-report.h"
+#include "sysemu/block-backend.h"
+#include "sysemu/blockdev.h"
+#include "block/aio.h"
+#include "block/qdict.h"
+#include "scsi/constants.h"
+#include "tcmu/tcmu.h"
+#include "qemu/main-loop.h"
+#include "qemu/option.h"
+#include "qapi/qapi-commands.h"
+#include "qapi/qmp/qstring.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/error.h"
+
+#include "qemu/compiler.h"
+#include "trace.h"
+
+typedef struct TCMUExport TCMUExport;
+
+struct TCMUExport {
+    BlockBackend *blk;
+    struct tcmu_device *tcmu_dev;
+    bool writable;
+    QLIST_ENTRY(TCMUExport) next;
+};
+
+typedef struct {
+    struct tcmulib_context *tcmulib_ctx;
+} TCMUHandlerState;
+
+static QLIST_HEAD(, TCMUExport) tcmu_exports =
+    QLIST_HEAD_INITIALIZER(tcmu_exports);
+
+static TCMUHandlerState *handler_state;
+
+/* This's temporary, will use scsi/utils.c code */
+#define ASCQ_INVALID_FIELD_IN_CDB 0x2400
+
+typedef struct {
+    struct tcmulib_cmd *cmd;
+    TCMUExport *exp;
+    QEMUIOVector *qiov;
+} TCMURequest;
+
+static void qemu_tcmu_aio_cb(void *opaque, int ret)
+{
+    TCMURequest *req = opaque;
+
+    trace_qemu_tcmu_aio_cb();
+    tcmulib_command_complete(req->exp->tcmu_dev, req->cmd,
+                             ret ? CHECK_CONDITION : GOOD);
+    tcmulib_processing_complete(req->exp->tcmu_dev);
+    g_free(req->qiov);
+    g_free(req);
+}
+
+static inline TCMURequest *qemu_tcmu_req_new(TCMUExport *exp,
+                                             struct tcmulib_cmd *cmd,
+                                             QEMUIOVector *qiov)
+{
+    TCMURequest *req = g_new(TCMURequest, 1);
+    *req = (TCMURequest) {
+        .exp = exp,
+        .cmd = cmd,
+        .qiov = qiov,
+    };
+    return req;
+}
+
+static int qemu_tcmu_handle_cmd(TCMUExport *exp, struct tcmulib_cmd *cmd)
+{
+
+    uint8_t *cdb = cmd->cdb;
+    /* TODO: block size? */
+    uint64_t offset = tcmu_cdb_get_lba(cdb) << BDRV_SECTOR_BITS;
+    QEMUIOVector *qiov;
+
+    trace_qemu_tcmu_handle_cmd(cdb[0]);
+    switch (cdb[0]) {
+    case INQUIRY:
+        return tcmu_emulate_inquiry(exp->tcmu_dev, cdb,
+                                    cmd->iovec, cmd->iov_cnt);
+    case TEST_UNIT_READY:
+        return tcmu_emulate_test_unit_ready(cdb, cmd->iovec, cmd->iov_cnt);
+    case SERVICE_ACTION_IN_16:
+        if (cdb[1] == SAI_READ_CAPACITY_16) {
+            return tcmu_emulate_read_capacity_16(blk_getlength(exp->blk) / 512,
+                                                 512,
+                                                 cmd->cdb, cmd->iovec,
+                                                 cmd->iov_cnt);
+        } else {
+            return TCMU_STS_NOT_HANDLED;
+        }
+    case MODE_SENSE:
+    case MODE_SENSE_10:
+        return tcmu_emulate_mode_sense(exp->tcmu_dev, cdb, cmd->iovec,
+                                       cmd->iov_cnt);
+    case MODE_SELECT:
+    case MODE_SELECT_10:
+        return tcmu_emulate_mode_select(exp->tcmu_dev, cdb, cmd->iovec,
+                                        cmd->iov_cnt);
+    case SYNCHRONIZE_CACHE:
+    case SYNCHRONIZE_CACHE_16:
+        if (cdb[1] & 0x2) {
+            return tcmu_sense_set_data(cmd->sense_buf, ILLEGAL_REQUEST,
+                                       ASCQ_INVALID_FIELD_IN_CDB);
+        } else {
+            blk_aio_flush(exp->blk, qemu_tcmu_aio_cb,
+                          qemu_tcmu_req_new(exp, cmd, NULL));
+            return TCMU_STS_ASYNC_HANDLED;
+        }
+        break;
+    case READ_6:
+    case READ_10:
+    case READ_12:
+    case READ_16:
+        qiov = g_new(QEMUIOVector, 1);
+        qemu_iovec_init_external(qiov, cmd->iovec, cmd->iov_cnt);
+        trace_qemu_tcmu_handle_cmd_read(offset);
+        blk_aio_preadv(exp->blk, offset, qiov, 0, qemu_tcmu_aio_cb,
+                       qemu_tcmu_req_new(exp, cmd, qiov));
+        return TCMU_STS_ASYNC_HANDLED;
+
+    case WRITE_6:
+    case WRITE_10:
+    case WRITE_12:
+    case WRITE_16:
+        qiov = g_new(QEMUIOVector, 1);
+        qemu_iovec_init_external(qiov, cmd->iovec, cmd->iov_cnt);
+        trace_qemu_tcmu_handle_cmd_write(offset);
+        blk_aio_pwritev(exp->blk, offset, qiov, 0, qemu_tcmu_aio_cb,
+                        qemu_tcmu_req_new(exp, cmd, qiov));
+        return TCMU_STS_ASYNC_HANDLED;
+
+    default:
+        trace_qemu_tcmu_handle_cmd_unknown_cmd(cdb[0]);
+        return TCMU_STS_NOT_HANDLED;
+    }
+}
+
+static void qemu_tcmu_dev_event_handler(void *opaque)
+{
+    TCMUExport *exp = opaque;
+    struct tcmulib_cmd *cmd;
+    struct tcmu_device *dev = exp->tcmu_dev;
+
+    tcmulib_processing_start(dev);
+
+    while ((cmd = tcmulib_get_next_command(dev)) != NULL) {
+        int ret = qemu_tcmu_handle_cmd(exp, cmd);
+        if (ret != TCMU_STS_ASYNC_HANDLED) {
+            tcmulib_command_complete(dev, cmd, ret);
+        }
+    }
+
+    tcmulib_processing_complete(dev);
+}
+
+static TCMUExport *tcmu_export_lookup(const BlockBackend *blk)
+{
+    TCMUExport *exp;
+
+    QLIST_FOREACH(exp, &tcmu_exports, next) {
+        if (exp->blk == blk) {
+            return exp;
+        }
+    }
+    return NULL;
+}
+static TCMUExport *parse_cfgstr(const char *cfgstr,
+                                          Error **errp);
+static bool check_cfgstr(const char *cfgstr,
+                                          Error **errp);
+
+QemuOptsList qemu_tcmu_common_export_opts = {
+    .name = "export",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_tcmu_common_export_opts.head),
+    .desc = {
+        {
+            .name = "snapshot",
+            .type = QEMU_OPT_BOOL,
+            .help = "enable/disable snapshot mode",
+        },{
+            .name = "aio",
+            .type = QEMU_OPT_STRING,
+            .help = "host AIO implementation (threads, native)",
+        },{
+            .name = "format",
+            .type = QEMU_OPT_STRING,
+            .help = "disk format (raw, qcow2, ...)",
+        },{
+            .name = "file",
+            .type = QEMU_OPT_STRING,
+            .help = "file name",
+        },
+        { /* end of list */ }
+    },
+};
+
+QemuOptsList qemu_tcmu_export_opts = {
+    .name = "export",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_tcmu_export_opts.head),
+    .desc = {
+        /* no elements => accept any params */
+        { /* end of list */ }
+    },
+};
+
+int export_init_func(void *opaque, QemuOpts *all_opts, Error **errp)
+{
+    int flags = BDRV_O_RDWR;
+    const char *buf;
+    int ret = 0;
+    bool writethrough;
+    BlockBackend *blk;
+    int snapshot = 0;
+    Error *local_err = NULL;
+    QemuOpts *common_opts;
+    const char *id;
+    const char *aio;
+    const char *value;
+    QDict *bs_opts;
+    bool read_only = false;
+    const char *file;
+    TCMUExport *exp;
+
+    value = qemu_opt_get(all_opts, "cache");
+    if (value) {
+        if (bdrv_parse_cache_mode(value, &flags, &writethrough) != 0) {
+            error_report("invalid cache option");
+            ret = -1;
+            goto err_too_early;
+        }
+        /* Specific options take precedence */
+        if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_DIRECT)) {
+            qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_DIRECT,
+                              !!(flags & BDRV_O_NOCACHE), &error_abort);
+        }
+        if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_NO_FLUSH)) {
+            qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_NO_FLUSH,
+                              !!(flags & BDRV_O_NO_FLUSH), &error_abort);
+        }
+        qemu_opt_unset(all_opts, "cache");
+    }
+
+    bs_opts = qdict_new();
+    /* all_opts->id also copied into one option in bs_opts */
+    qemu_opts_to_qdict(all_opts, bs_opts);
+
+    id = qdict_get_try_str(bs_opts, "id");
+    common_opts = qemu_opts_create(&qemu_tcmu_common_export_opts, id, 1,
+                                   &local_err);
+    if (local_err) {
+        error_report_err(local_err);
+        ret = -1;
+        goto err_no_opts;
+    }
+
+    trace_export_init_func();
+
+    qemu_opts_absorb_qdict(common_opts, bs_opts, &local_err);
+    if (local_err) {
+        error_report_err(local_err);
+        ret = -1;
+        goto early_err;
+    }
+
+    if (id) {
+        qdict_del(bs_opts, "id");
+    }
+
+    if ((aio = qemu_opt_get(common_opts, "aio")) != NULL) {
+            if (!strcmp(aio, "native")) {
+                flags |= BDRV_O_NATIVE_AIO;
+            } else if (!strcmp(aio, "threads")) {
+                /* this is the default */
+            } else {
+               error_report("invalid aio option");
+               ret = -1;
+               goto early_err;
+            }
+    }
+
+    if ((buf = qemu_opt_get(common_opts, "format")) != NULL) {
+        if (qdict_haskey(bs_opts, "driver")) {
+            error_report("Cannot specify both 'driver' and 'format'");
+            ret = -1;
+            goto early_err;
+        }
+        qdict_put_str(bs_opts, "driver", buf);
+    }
+
+    snapshot = qemu_opt_get_bool(common_opts, "snapshot", 0);
+    if (snapshot) {
+        flags |= BDRV_O_SNAPSHOT;
+    }
+
+    read_only = qemu_opt_get_bool(common_opts, BDRV_OPT_READ_ONLY, false);
+    if (read_only)
+        flags &= ~BDRV_O_RDWR;
+
+    /* bdrv_open() defaults to the values in bdrv_flags (for compatibility
+     * with other callers) rather than what we want as the real defaults
+     * Apply the defaults here instead. */
+    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_DIRECT, "off");
+    qdict_set_default_str(bs_opts, BDRV_OPT_CACHE_NO_FLUSH, "off");
+    qdict_set_default_str(bs_opts, BDRV_OPT_READ_ONLY,
+                              read_only ? "on" : "off");
+
+    /* if (qemu_opts_id(all_opts) == NULL) */
+
+    file = qemu_opt_get(common_opts, "file");
+    blk = blk_new_open(file, NULL, bs_opts, flags, &local_err);
+    bs_opts = NULL;
+    if (!blk) {
+        error_report_err(local_err);
+        ret = -1;
+        goto err_no_bs_opts;
+    }
+
+    blk_set_enable_write_cache(blk, !writethrough);
+
+    id = qemu_opts_id(common_opts);
+    if (!monitor_add_blk(blk, id, &local_err)) {
+        error_report_err(local_err);
+        blk_unref(blk);
+        ret = -1;
+        goto err_no_bs_opts;
+    }
+
+    exp = tcmu_export_new(blk, flags & BDRV_O_RDWR, &local_err);
+    if (!exp) {
+        error_reportf_err(local_err, "Failed to create export: ");
+        ret = -1;
+        monitor_remove_blk(blk);
+    }
+
+err_no_bs_opts:
+early_err:
+    qemu_opts_del(common_opts);
+err_no_opts:
+    qobject_unref(bs_opts);
+err_too_early:
+    return ret;
+}
+
+static bool qemu_tcmu_check_config(const char *cfgstr, char **reason)
+{
+    Error *local_err = NULL;
+
+    if (!check_cfgstr(cfgstr, &local_err) && local_err) {
+        *reason = strdup(error_get_pretty(local_err));
+        error_free(local_err);
+        return false;
+    }
+    return true;
+}
+
+static int qemu_tcmu_added(struct tcmu_device *dev)
+{
+    TCMUExport *exp;
+    const char *cfgstr = tcmu_dev_get_cfgstring(dev);
+    Error *local_err = NULL;
+
+    exp = parse_cfgstr(cfgstr, &local_err);
+    if (!exp) {
+        return -1;
+    }
+    exp->tcmu_dev = dev;
+    tcmu_dev_set_private(dev, exp);
+    aio_set_fd_handler(blk_get_aio_context(exp->blk),
+                       tcmu_dev_get_fd(dev),
+                       true, qemu_tcmu_dev_event_handler,
+                       NULL, NULL, exp);
+    return 0;
+}
+
+static void tcmu_export_close(TCMUExport *exp)
+{
+    aio_set_fd_handler(blk_get_aio_context(exp->blk),
+                       tcmu_dev_get_fd(exp->tcmu_dev),
+                       false, NULL,
+                       NULL, NULL, NULL);
+    monitor_remove_blk(exp->blk);
+    blk_unref(exp->blk);
+    QLIST_REMOVE(exp, next);
+    g_free(exp);
+}
+
+static void qemu_tcmu_removed(struct tcmu_device *dev)
+{
+    TCMUExport *exp = tcmu_dev_get_private(dev);
+
+    if(exp)
+        tcmu_export_close(exp);
+}
+
+static void qemu_tcmu_master_read(void *opaque)
+{
+    TCMUHandlerState *s = opaque;
+
+    trace_qemu_tcmu_master_read();
+    tcmulib_master_fd_ready(s->tcmulib_ctx);
+}
+
+static struct tcmulib_handler qemu_tcmu_handler = {
+    .name = "Handler for QEMU block devices",
+    .subtype = NULL, /* Dynamically generated when starting. */
+    .cfg_desc = "Format: device=<name>",
+    .added = qemu_tcmu_added,
+    .removed = qemu_tcmu_removed,
+    .check_config = qemu_tcmu_check_config,
+};
+
+static bool check_cfgstr(const char *cfgstr,
+                                          Error **errp)
+{
+    BlockBackend *blk;
+    const char *dev_str, *id, *device;
+    const char *pr;
+    const char *subtype = qemu_tcmu_handler.subtype;
+    size_t subtype_len;
+    TCMUExport *exp;
+
+    if (!subtype) {
+        error_setg(errp, "TCMU Handler not started");
+    }
+    subtype_len = strlen(subtype);
+    if (strncmp(cfgstr, subtype, subtype_len) ||
+        cfgstr[subtype_len] != '/') {
+        error_report("TCMU: Invalid subtype in device cfgstring: %s", cfgstr);
+        return false;
+    }
+    dev_str = &cfgstr[subtype_len + 1];
+    if (dev_str[0] != '@') {
+        error_report("TCMU: Invalid cfgstring format. Must be @<device_name>");
+        return false;
+    }
+    device = &dev_str[1];
+
+    pr = strchr(device, '@');
+    if (!pr) {
+	id = device;
+    	blk = blk_by_name(id);
+    	if (!blk) {
+        	error_setg(errp, "TCMU: Device not found: %s", id);
+        	return false;
+    	}
+    	exp = tcmu_export_lookup(blk);
+    	if (!exp) {
+        	error_setg(errp, "TCMU: Device not found: %s", id);
+        	return false;
+   	}
+    }// TODO: else to check id?
+
+    return true;
+}
+
+static void tcmu_convert_delim(char *to, const char *opts)
+{
+    while (*opts != '\0') {
+	if (*opts == '@') {
+	    *to = ',';
+	} else
+	    *to = *opts;
+
+	opts++;
+	to++;
+    }
+
+    if(to)
+        *to = '\0';
+}
+static TCMUExport *parse_cfgstr(const char *cfgstr,
+                                          Error **errp)
+{
+    const char *device, *id, *pr;
+    const char *subtype = qemu_tcmu_handler.subtype;
+    size_t subtype_len;
+    TCMUExport *exp = NULL;
+    char *new_device;
+
+    subtype_len = strlen(subtype);
+    device = &cfgstr[subtype_len + 2];
+
+    pr = strchr(device, '@');
+    if (!pr) {
+    	id = device;
+    	exp = tcmu_export_lookup(blk_by_name(id));
+    }
+    else {
+	QemuOpts * export_opts;
+
+	new_device = g_malloc0(strlen(device) + 1);
+	tcmu_convert_delim(new_device, device);
+
+        /* parse new_device into an QemuOpts and link into
+           qemu_tcmu_export_opts with QemuOpts->id set while
+           without an option id in QemuOpts.
+         */
+	export_opts = qemu_opts_parse_noisily(&qemu_tcmu_export_opts,
+					    new_device, false);
+        trace_qemu_tcmu_parse_cfgstr();
+        g_free(new_device);
+
+        if(!export_opts)
+            goto fail;
+
+	if (export_init_func(NULL, export_opts, NULL))
+	    goto fail;
+
+	id = qemu_opts_id(export_opts);
+	exp = tcmu_export_lookup(blk_by_name(id));
+
+        qemu_opts_del(export_opts);
+    }
+
+fail:
+    return exp;
+}
+
+void qemu_tcmu_stop(void)
+{
+    tcmulib_close(handler_state->tcmulib_ctx);
+    g_free(handler_state);
+    handler_state = NULL;
+}
+
+void qemu_tcmu_start(const char *subtype, Error **errp)
+{
+    int fd;
+
+    trace_qemu_tcmu_start();
+    if (handler_state) {
+        error_setg(errp, "TCMU handler already started");
+        return;
+    }
+    assert(!qemu_tcmu_handler.subtype);
+    qemu_tcmu_handler.subtype = g_strdup(subtype);
+    handler_state = g_new0(TCMUHandlerState, 1);
+    handler_state->tcmulib_ctx = tcmulib_initialize(&qemu_tcmu_handler, 1);
+
+    if (!handler_state->tcmulib_ctx) {
+        error_setg(errp, "Failed to initialize tcmulib");
+        goto fail;
+    }
+    fd = tcmulib_get_master_fd(handler_state->tcmulib_ctx);
+    qemu_set_fd_handler(fd, qemu_tcmu_master_read, NULL, handler_state);
+    trace_qemu_tcmu_start_register();
+    tcmulib_register(handler_state->tcmulib_ctx);
+    return;
+
+fail:
+    g_free(handler_state);
+    handler_state = NULL;
+}
+
+TCMUExport *tcmu_export_new(BlockBackend *blk, bool writable, Error **errp)
+{
+    TCMUExport *exp;
+
+    exp = tcmu_export_lookup(blk);
+    if (exp) {
+        error_setg(errp, "Block device already added");
+        return NULL;
+    }
+    exp = g_new0(TCMUExport, 1);
+    exp->blk = blk;
+    blk_ref(blk);
+    exp->writable = writable;
+    QLIST_INSERT_HEAD(&tcmu_exports, exp, next);
+    return exp;
+}
diff --git a/tcmu/trace-events b/tcmu/trace-events
new file mode 100644
index 0000000..62ad30e
--- /dev/null
+++ b/tcmu/trace-events
@@ -0,0 +1,12 @@
+# tcmu/tcmu.c
+
+qemu_tcmu_aio_cb(void) "aio cb"
+qemu_tcmu_handle_cmd(uint8_t cdb) "handle cmd: 0x%x"
+qemu_tcmu_handle_cmd_read(uint64_t offset) "read at %ld"
+qemu_tcmu_handle_cmd_write(uint64_t offset) "write at %ld"
+qemu_tcmu_handle_cmd_unknown_cmd(uint8_t cdb) "unknown cmd: 0x%x"
+qemu_tcmu_master_read(void) "master read"
+qemu_tcmu_start(void) "start"
+qemu_tcmu_start_register(void) "register"
+qemu_tcmu_parse_cfgstr(void) "parse noisily"
+export_init_func(void) "parse common"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility
  2018-12-21 10:16 [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility Yaowei Bai
@ 2018-12-26  7:59 ` no-reply
  2018-12-26  8:19 ` no-reply
  2019-03-06 21:56 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
  2 siblings, 0 replies; 16+ messages in thread
From: no-reply @ 2018-12-26  7:59 UTC (permalink / raw)
  To: baiyaowei
  Cc: fam, qemu-block, qemu-devel, famz, atumball, mchristi, pkalever,
	pbonzini, xiubli

Patchew URL: https://patchew.org/QEMU/1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=8
=== TEST SCRIPT END ===

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/tmp/qemu-test/install --python=/usr/bin/python3 --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=2.0

ERROR: glib is required to compile QEMU

# QEMU configure log Wed Dec 26 07:59:16 UTC 2018
# Configured with: '/tmp/qemu-test/src/configure' '--enable-werror' '--target-list=x86_64-softmmu,aarch64-softmmu' '--prefix=/tmp/qemu-test/install' '--python=/usr/bin/python3' '--cross-prefix=x86_64-w64-mingw32-' '--enable-trace-backends=simple' '--enable-gnutls' '--enable-nettle' '--enable-curl' '--enable-vnc' '--enable-bzip2' '--enable-guest-agent' '--with-sdlabi=2.0'
---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 119 617 634 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:2:2: error: #error __linux__ not defined
 #error __linux__ not defined
  ^~~~~

---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 119 617 686 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:2:2: error: #error __i386__ not defined
 #error __i386__ not defined
  ^~~~~

---
funcs: do_compiler do_cc compile_object check_define main
lines: 92 119 617 689 0
x86_64-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:2:2: error: #error __ILP32__ not defined
 #error __ILP32__ not defined
  ^~~~~

---
lines: 92 125 917 0
x86_64-w64-mingw32-gcc -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -g -liberty
/usr/lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld: cannot find -liberty
collect2: error: ld returned 1 exit status

funcs: do_compiler do_cc compile_object main
lines: 92 119 1817 0
---
funcs: do_compiler do_cc compile_prog cc_has_warning_flag main
lines: 92 125 1899 1903 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Werror -Werror=address-of-packed-member -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
cc1: error: -Werror=address-of-packed-member: no option -Waddress-of-packed-member

funcs: do_compiler do_cc compile_prog cc_has_warning_flag main
lines: 92 125 1899 1903 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Werror -Wstring-plus-int -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
x86_64-w64-mingw32-gcc: error: unrecognized command line option '-Wstring-plus-int'; did you mean '-Wstrict-aliasing'?

funcs: do_compiler do_cc compile_prog cc_has_warning_flag main
lines: 92 125 1899 1903 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Werror -Winitializer-overrides -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
x86_64-w64-mingw32-gcc: error: unrecognized command line option '-Winitializer-overrides'; did you mean '-Wno-suggest-override'?

funcs: do_compiler do_cc compile_prog cc_has_warning_flag main
lines: 92 125 1899 1903 0
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 2170 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
config-temp/qemu-conf.c:1:10: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>
          ^~~~~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 2241 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -llzo2
config-temp/qemu-conf.c:1:10: fatal error: lzo/lzo1x.h: No such file or directory
 #include <lzo/lzo1x.h>
          ^~~~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 2260 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lsnappy
config-temp/qemu-conf.c:1:10: fatal error: snappy-c.h: No such file or directory
 #include <snappy-c.h>
          ^~~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 2297 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -llzfse
config-temp/qemu-conf.c:1:10: fatal error: lzfse.h: No such file or directory
 #include <lzfse.h>
          ^~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 2381 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lxenstore -lxenctrl -lxenguest
config-temp/qemu-conf.c:1:10: fatal error: xenctrl.h: No such file or directory
 #include <xenctrl.h>
          ^~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_object check_include main
lines: 92 119 625 2899 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -c -o config-temp/qemu-conf.o config-temp/qemu-conf.c
config-temp/qemu-conf.c:1:10: fatal error: ifaddrs.h: No such file or directory
 #include <ifaddrs.h>
          ^~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3034 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -Dmain=SDL_main -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/SDL2 -Wno-undef -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
config-temp/qemu-conf.c:5:2: error: #error No x11 support
 #error No x11 support
  ^~~~~
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/SDL2/SDL.h:32:0,
                 from config-temp/qemu-conf.c:1:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/SDL2/SDL_main.h:111:17: error: conflicting types for 'SDL_main'
 #define main    SDL_main
                 ^
config-temp/qemu-conf.c:7:5: note: in expansion of macro 'main'
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3049 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lrdmacm -libverbs -libumad
config-temp/qemu-conf.c:1:10: fatal error: rdma/rdma_cma.h: No such file or directory
 #include <rdma/rdma_cma.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3119 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lsasl2
config-temp/qemu-conf.c:1:10: fatal error: sasl/sasl.h: No such file or directory
 #include <sasl/sasl.h>
          ^~~~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3211 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
config-temp/qemu-conf.c:1:10: fatal error: fnmatch.h: No such file or directory
 #include <fnmatch.h>
          ^~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3227 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
config-temp/qemu-conf.c:2:10: fatal error: xfs/xfs.h: No such file or directory
 #include <xfs/xfs.h>
          ^~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3251 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lvdeplug
config-temp/qemu-conf.c:1:10: fatal error: libvdeplug.h: No such file or directory
 #include <libvdeplug.h>
          ^~~~~~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3301 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lcap-ng
config-temp/qemu-conf.c:1:10: fatal error: cap-ng.h: No such file or directory
 #include <cap-ng.h>
          ^~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3392 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lbrlapi
config-temp/qemu-conf.c:1:10: fatal error: brlapi.h: No such file or directory
 #include <brlapi.h>
          ^~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3434 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -DNCURSES_WIDECHAR -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
config-temp/qemu-conf.c:2:10: fatal error: curses.h: No such file or directory
 #include <curses.h>
          ^~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3434 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -DNCURSES_WIDECHAR -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g -lpdcurses
config-temp/qemu-conf.c:2:10: fatal error: curses.h: No such file or directory
 #include <curses.h>
          ^~~~~~~~~~
compilation terminated.
---
funcs: do_compiler do_cc compile_prog main
lines: 92 125 3487 0
x86_64-w64-mingw32-gcc -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -g
config-temp/qemu-conf.c:1:10: fatal error: bluetooth/bluetooth.h: No such file or directory
 #include <bluetooth/bluetooth.h>
          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.


The full log is available at
http://patchew.org/logs/1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility
  2018-12-21 10:16 [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility Yaowei Bai
  2018-12-26  7:59 ` no-reply
@ 2018-12-26  8:19 ` no-reply
  2019-01-02  1:53   ` Yaowei Bai
  2019-03-06 21:56 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
  2 siblings, 1 reply; 16+ messages in thread
From: no-reply @ 2018-12-26  8:19 UTC (permalink / raw)
  To: baiyaowei
  Cc: fam, qemu-block, qemu-devel, famz, atumball, mchristi, pkalever,
	pbonzini, xiubli

Patchew URL: https://patchew.org/QEMU/1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com
Type: series
Subject: [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
52869e1 tcmu: Introduce qemu-tcmu utility

=== OUTPUT BEGIN ===
Checking PATCH 1/1: tcmu: Introduce qemu-tcmu utility...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#157: 
new file mode 100644

ERROR: trailing whitespace
#329: FILE: qemu-tcmu.c:51:
+"Usage:\n" $

WARNING: Block comments use a leading /* on a separate line
#466: FILE: qemu-tcmu.c:188:
+    /* now when the initialization is (almost) complete, chdir("/")

WARNING: Block comments use a trailing */ on a separate line
#467: FILE: qemu-tcmu.c:189:
+     * to free any busy filesystems */

ERROR: code indent should never use tabs
#525: FILE: tcmu/helper.c:16:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#526: FILE: tcmu/helper.c:17:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#527: FILE: tcmu/helper.c:18:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#529: FILE: tcmu/helper.c:20:
+^Iuint8_t buf[36];$

ERROR: code indent should never use tabs
#531: FILE: tcmu/helper.c:22:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#533: FILE: tcmu/helper.c:24:
+^Ibuf[2] = 0x05; /* SPC-3 */$

ERROR: code indent should never use tabs
#534: FILE: tcmu/helper.c:25:
+^Ibuf[3] = 0x02; /* response data format */$

ERROR: code indent should never use tabs
#536: FILE: tcmu/helper.c:27:
+^I/*$

ERROR: code indent should never use tabs
#537: FILE: tcmu/helper.c:28:
+^I * A Third-Party Copy (3PC)$

ERROR: code indent should never use tabs
#538: FILE: tcmu/helper.c:29:
+^I *$

ERROR: code indent should never use tabs
#539: FILE: tcmu/helper.c:30:
+^I * Enable the XCOPY$

ERROR: code indent should never use tabs
#540: FILE: tcmu/helper.c:31:
+^I */$

ERROR: code indent should never use tabs
#541: FILE: tcmu/helper.c:32:
+^Ibuf[5] = 0x08;$

ERROR: code indent should never use tabs
#543: FILE: tcmu/helper.c:34:
+^Ibuf[7] = 0x02; /* CmdQue */$

ERROR: code indent should never use tabs
#545: FILE: tcmu/helper.c:36:
+^Imemcpy(&buf[8], "LIO-ORG ", 8);$

ERROR: code indent should never use tabs
#546: FILE: tcmu/helper.c:37:
+^Imemset(&buf[16], 0x20, 16);$

ERROR: code indent should never use tabs
#547: FILE: tcmu/helper.c:38:
+^Imemcpy(&buf[16], "TCMU device", 11);$

ERROR: code indent should never use tabs
#548: FILE: tcmu/helper.c:39:
+^Imemcpy(&buf[32], "0002", 4);$

ERROR: code indent should never use tabs
#549: FILE: tcmu/helper.c:40:
+^Ibuf[4] = 31; /* Set additional length to 31 */$

ERROR: code indent should never use tabs
#551: FILE: tcmu/helper.c:42:
+^Itcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));$

ERROR: code indent should never use tabs
#552: FILE: tcmu/helper.c:43:
+^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#558: FILE: tcmu/helper.c:49:
+^Iif (c >= '0' && c <= '9') {$

ERROR: code indent should never use tabs
#559: FILE: tcmu/helper.c:50:
+^I^I*val = c - '0';$

ERROR: code indent should never use tabs
#560: FILE: tcmu/helper.c:51:
+^I^Ireturn true;$

ERROR: code indent should never use tabs
#561: FILE: tcmu/helper.c:52:
+^I}$

ERROR: code indent should never use tabs
#562: FILE: tcmu/helper.c:53:
+^Iif (c >= 'a' && c <= 'f') {$

ERROR: code indent should never use tabs
#563: FILE: tcmu/helper.c:54:
+^I^I*val = c - 'a' + 10;$

ERROR: code indent should never use tabs
#564: FILE: tcmu/helper.c:55:
+^I^Ireturn true;$

ERROR: code indent should never use tabs
#565: FILE: tcmu/helper.c:56:
+^I}$

ERROR: code indent should never use tabs
#566: FILE: tcmu/helper.c:57:
+^Iif (c >= 'A' && c <= 'F') {$

ERROR: code indent should never use tabs
#567: FILE: tcmu/helper.c:58:
+^I^I*val = c - 'A' + 10;$

ERROR: code indent should never use tabs
#568: FILE: tcmu/helper.c:59:
+^I^Ireturn true;$

ERROR: code indent should never use tabs
#569: FILE: tcmu/helper.c:60:
+^I}$

ERROR: code indent should never use tabs
#570: FILE: tcmu/helper.c:61:
+^Ireturn false;$

ERROR: code indent should never use tabs
#574: FILE: tcmu/helper.c:65:
+^Istruct tcmu_device *dev,$

ERROR: code indent should never use tabs
#575: FILE: tcmu/helper.c:66:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#576: FILE: tcmu/helper.c:67:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#577: FILE: tcmu/helper.c:68:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#579: FILE: tcmu/helper.c:70:
+^Iswitch (cdb[2]) {$

ERROR: code indent should never use tabs
#580: FILE: tcmu/helper.c:71:
+^Icase 0x0: /* Supported VPD pages */$

ERROR: code indent should never use tabs
#581: FILE: tcmu/helper.c:72:
+^I{$

ERROR: code indent should never use tabs
#582: FILE: tcmu/helper.c:73:
+^I^Ichar data[16];$

ERROR: code indent should never use tabs
#584: FILE: tcmu/helper.c:75:
+^I^Imemset(data, 0, sizeof(data));$

ERROR: code indent should never use tabs
#586: FILE: tcmu/helper.c:77:
+^I^I/* data[1] (page code) already 0 */$

ERROR: code indent should never use tabs
#587: FILE: tcmu/helper.c:78:
+^I^I/*$

ERROR: code indent should never use tabs
#588: FILE: tcmu/helper.c:79:
+^I^I  *  spc4r22 7.7.13 The supported VPD page list shall contain$

WARNING: Block comments should align the * on each line
#588: FILE: tcmu/helper.c:79:
+               /*
+                 *  spc4r22 7.7.13 The supported VPD page list shall contain

ERROR: code indent should never use tabs
#589: FILE: tcmu/helper.c:80:
+^I^I  *  a list of all VPD page codes (see 7.7) implemented by the$

WARNING: line over 80 characters
#590: FILE: tcmu/helper.c:81:
+                 *  logical unit in ascending order beginning with page code 00h

ERROR: code indent should never use tabs
#590: FILE: tcmu/helper.c:81:
+^I^I  *  logical unit in ascending order beginning with page code 00h$

ERROR: code indent should never use tabs
#591: FILE: tcmu/helper.c:82:
+^I^I  */$

ERROR: code indent should never use tabs
#592: FILE: tcmu/helper.c:83:
+^I^Idata[4] = 0x00;$

ERROR: code indent should never use tabs
#593: FILE: tcmu/helper.c:84:
+^I^Idata[5] = 0x80;$

ERROR: code indent should never use tabs
#594: FILE: tcmu/helper.c:85:
+^I^Idata[6] = 0x83;$

ERROR: code indent should never use tabs
#595: FILE: tcmu/helper.c:86:
+^I^Idata[7] = 0xb0;$

ERROR: code indent should never use tabs
#596: FILE: tcmu/helper.c:87:
+^I^Idata[8] = 0xb1;$

ERROR: code indent should never use tabs
#597: FILE: tcmu/helper.c:88:
+^I^Idata[9] = 0xb2;$

ERROR: code indent should never use tabs
#599: FILE: tcmu/helper.c:90:
+^I^Idata[3] = 6;$

ERROR: code indent should never use tabs
#601: FILE: tcmu/helper.c:92:
+^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$

ERROR: code indent should never use tabs
#602: FILE: tcmu/helper.c:93:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#603: FILE: tcmu/helper.c:94:
+^I}$

ERROR: code indent should never use tabs
#604: FILE: tcmu/helper.c:95:
+^Ibreak;$

ERROR: code indent should never use tabs
#605: FILE: tcmu/helper.c:96:
+^Icase 0x80: /* Unit Serial Number */$

ERROR: code indent should never use tabs
#606: FILE: tcmu/helper.c:97:
+^I{$

ERROR: code indent should never use tabs
#607: FILE: tcmu/helper.c:98:
+^I^Ichar data[512];$

ERROR: code indent should never use tabs
#608: FILE: tcmu/helper.c:99:
+^I^Ichar *wwn;$

ERROR: code indent should never use tabs
#609: FILE: tcmu/helper.c:100:
+^I^Iuint32_t len;$

ERROR: code indent should never use tabs
#611: FILE: tcmu/helper.c:102:
+^I^Imemset(data, 0, sizeof(data));$

ERROR: code indent should never use tabs
#613: FILE: tcmu/helper.c:104:
+^I^Idata[1] = 0x80;$

ERROR: code indent should never use tabs
#615: FILE: tcmu/helper.c:106:
+^I^Iwwn = tcmu_cfgfs_dev_get_wwn(dev);$

ERROR: code indent should never use tabs
#616: FILE: tcmu/helper.c:107:
+^I^Iif (!wwn)$

ERROR: braces {} are necessary for all arms of this statement
#616: FILE: tcmu/helper.c:107:
+               if (!wwn)
[...]

ERROR: code indent should never use tabs
#617: FILE: tcmu/helper.c:108:
+^I^I^Ireturn TCMU_STS_HW_ERR;$

ERROR: code indent should never use tabs
#619: FILE: tcmu/helper.c:110:
+^I^I/*$

ERROR: code indent should never use tabs
#620: FILE: tcmu/helper.c:111:
+^I^I * The maximum length of the unit_serial has limited$

ERROR: code indent should never use tabs
#621: FILE: tcmu/helper.c:112:
+^I^I * to 254 Bytes in kernel, so here limit to 256 Bytes$

ERROR: code indent should never use tabs
#622: FILE: tcmu/helper.c:113:
+^I^I * will be enough.$

ERROR: code indent should never use tabs
#623: FILE: tcmu/helper.c:114:
+^I^I */$

ERROR: code indent should never use tabs
#624: FILE: tcmu/helper.c:115:
+^I^Ilen = snprintf(&data[4], 256, "%s", wwn);$

ERROR: code indent should never use tabs
#625: FILE: tcmu/helper.c:116:
+^I^Idata[3] = len + 1;$

ERROR: code indent should never use tabs
#627: FILE: tcmu/helper.c:118:
+^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$

ERROR: code indent should never use tabs
#629: FILE: tcmu/helper.c:120:
+^I^Ifree(wwn);$

ERROR: code indent should never use tabs
#630: FILE: tcmu/helper.c:121:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#631: FILE: tcmu/helper.c:122:
+^I}$

ERROR: code indent should never use tabs
#632: FILE: tcmu/helper.c:123:
+^Ibreak;$

ERROR: code indent should never use tabs
#633: FILE: tcmu/helper.c:124:
+^Icase 0x83: /* Device identification */$

ERROR: code indent should never use tabs
#634: FILE: tcmu/helper.c:125:
+^I{$

ERROR: code indent should never use tabs
#635: FILE: tcmu/helper.c:126:
+^I^Ichar data[512];$

ERROR: code indent should never use tabs
#636: FILE: tcmu/helper.c:127:
+^I^Ichar *ptr, *p, *wwn;$

ERROR: code indent should never use tabs
#637: FILE: tcmu/helper.c:128:
+^I^Isize_t len, used = 0;$

ERROR: code indent should never use tabs
#638: FILE: tcmu/helper.c:129:
+^I^Iuint16_t *tot_len = (uint16_t*) &data[2];$

ERROR: "(foo*)" should be "(foo *)"
#638: FILE: tcmu/helper.c:129:
+               uint16_t *tot_len = (uint16_t*) &data[2];

ERROR: code indent should never use tabs
#639: FILE: tcmu/helper.c:130:
+^I^Ibool next;$

ERROR: code indent should never use tabs
#640: FILE: tcmu/helper.c:131:
+^I^Iint i;$

ERROR: code indent should never use tabs
#642: FILE: tcmu/helper.c:133:
+^I^Imemset(data, 0, sizeof(data));$

ERROR: code indent should never use tabs
#644: FILE: tcmu/helper.c:135:
+^I^Idata[1] = 0x83;$

ERROR: code indent should never use tabs
#646: FILE: tcmu/helper.c:137:
+^I^Iwwn = tcmu_cfgfs_dev_get_wwn(dev);$

ERROR: code indent should never use tabs
#647: FILE: tcmu/helper.c:138:
+^I^Iif (!wwn)$

ERROR: braces {} are necessary for all arms of this statement
#647: FILE: tcmu/helper.c:138:
+               if (!wwn)
[...]

ERROR: code indent should never use tabs
#648: FILE: tcmu/helper.c:139:
+^I^I^Ireturn TCMU_STS_HW_ERR;$

ERROR: code indent should never use tabs
#650: FILE: tcmu/helper.c:141:
+^I^Iptr = &data[4];$

ERROR: code indent should never use tabs
#652: FILE: tcmu/helper.c:143:
+^I^I/* 1/5: T10 Vendor id */$

ERROR: code indent should never use tabs
#653: FILE: tcmu/helper.c:144:
+^I^Iptr[0] = 2; /* code set: ASCII */$

ERROR: code indent should never use tabs
#654: FILE: tcmu/helper.c:145:
+^I^Iptr[1] = 1; /* identifier: T10 vendor id */$

ERROR: code indent should never use tabs
#655: FILE: tcmu/helper.c:146:
+^I^Imemcpy(&ptr[4], "LIO-ORG ", 8);$

ERROR: code indent should never use tabs
#656: FILE: tcmu/helper.c:147:
+^I^Ilen = snprintf(&ptr[12], sizeof(data) - 16, "%s", wwn);$

ERROR: code indent should never use tabs
#658: FILE: tcmu/helper.c:149:
+^I^Iptr[3] = 8 + len + 1;$

ERROR: code indent should never use tabs
#659: FILE: tcmu/helper.c:150:
+^I^Iused += (uint8_t)ptr[3] + 4;$

ERROR: code indent should never use tabs
#660: FILE: tcmu/helper.c:151:
+^I^Iptr += used;$

ERROR: code indent should never use tabs
#662: FILE: tcmu/helper.c:153:
+^I^I/* 2/5: NAA binary */$

ERROR: code indent should never use tabs
#663: FILE: tcmu/helper.c:154:
+^I^Iptr[0] = 1; /* code set: binary */$

ERROR: code indent should never use tabs
#664: FILE: tcmu/helper.c:155:
+^I^Iptr[1] = 3; /* identifier: NAA */$

WARNING: line over 80 characters
#665: FILE: tcmu/helper.c:156:
+               ptr[3] = 16; /* body length for naa registered extended format */

ERROR: code indent should never use tabs
#665: FILE: tcmu/helper.c:156:
+^I^Iptr[3] = 16; /* body length for naa registered extended format */$

ERROR: code indent should never use tabs
#667: FILE: tcmu/helper.c:158:
+^I^I/*$

ERROR: code indent should never use tabs
#668: FILE: tcmu/helper.c:159:
+^I^I * Set type 6 and use OpenFabrics IEEE Company ID: 00 14 05$

ERROR: code indent should never use tabs
#669: FILE: tcmu/helper.c:160:
+^I^I */$

ERROR: code indent should never use tabs
#670: FILE: tcmu/helper.c:161:
+^I^Iptr[4] = 0x60;$

ERROR: code indent should never use tabs
#671: FILE: tcmu/helper.c:162:
+^I^Iptr[5] = 0x01;$

ERROR: code indent should never use tabs
#672: FILE: tcmu/helper.c:163:
+^I^Iptr[6] = 0x40;$

ERROR: code indent should never use tabs
#673: FILE: tcmu/helper.c:164:
+^I^Iptr[7] = 0x50;$

ERROR: code indent should never use tabs
#675: FILE: tcmu/helper.c:166:
+^I^I/*$

ERROR: code indent should never use tabs
#676: FILE: tcmu/helper.c:167:
+^I^I * Fill in the rest with a binary representation of WWN$

ERROR: code indent should never use tabs
#677: FILE: tcmu/helper.c:168:
+^I^I *$

ERROR: code indent should never use tabs
#678: FILE: tcmu/helper.c:169:
+^I^I * This implementation only uses a nibble out of every byte of$

ERROR: code indent should never use tabs
#679: FILE: tcmu/helper.c:170:
+^I^I * WWN, but this is what the kernel does, and it's nice for our$

ERROR: code indent should never use tabs
#680: FILE: tcmu/helper.c:171:
+^I^I * values to match.$

ERROR: code indent should never use tabs
#681: FILE: tcmu/helper.c:172:
+^I^I */$

ERROR: code indent should never use tabs
#682: FILE: tcmu/helper.c:173:
+^I^Inext = true;$

ERROR: code indent should never use tabs
#683: FILE: tcmu/helper.c:174:
+^I^Ifor (p = wwn, i = 7; *p && i < 20; p++) {$

ERROR: code indent should never use tabs
#684: FILE: tcmu/helper.c:175:
+^I^I^Iuint8_t val;$

ERROR: code indent should never use tabs
#686: FILE: tcmu/helper.c:177:
+^I^I^Iif (!char_to_hex(&val, *p))$

ERROR: braces {} are necessary for all arms of this statement
#686: FILE: tcmu/helper.c:177:
+                       if (!char_to_hex(&val, *p))
[...]

ERROR: code indent should never use tabs
#687: FILE: tcmu/helper.c:178:
+^I^I^I^Icontinue;$

ERROR: code indent should never use tabs
#689: FILE: tcmu/helper.c:180:
+^I^I^Iif (next) {$

ERROR: code indent should never use tabs
#690: FILE: tcmu/helper.c:181:
+^I^I^I^Inext = false;$

ERROR: code indent should never use tabs
#691: FILE: tcmu/helper.c:182:
+^I^I^I^Iptr[i++] |= val;$

ERROR: code indent should never use tabs
#692: FILE: tcmu/helper.c:183:
+^I^I^I} else {$

ERROR: code indent should never use tabs
#693: FILE: tcmu/helper.c:184:
+^I^I^I^Inext = true;$

ERROR: code indent should never use tabs
#694: FILE: tcmu/helper.c:185:
+^I^I^I^Iptr[i] = val << 4;$

ERROR: code indent should never use tabs
#695: FILE: tcmu/helper.c:186:
+^I^I^I}$

ERROR: code indent should never use tabs
#696: FILE: tcmu/helper.c:187:
+^I^I}$

ERROR: code indent should never use tabs
#698: FILE: tcmu/helper.c:189:
+^I^Iused += 20;$

ERROR: code indent should never use tabs
#699: FILE: tcmu/helper.c:190:
+^I^Iptr += 20;$

ERROR: code indent should never use tabs
#701: FILE: tcmu/helper.c:192:
+^I^I/* 3/6: Vendor specific */$

ERROR: code indent should never use tabs
#702: FILE: tcmu/helper.c:193:
+^I^Iptr[0] = 2; /* code set: ASCII */$

ERROR: code indent should never use tabs
#703: FILE: tcmu/helper.c:194:
+^I^Iptr[1] = 0; /* identifier: vendor-specific */$

ERROR: line over 90 characters
#705: FILE: tcmu/helper.c:196:
+               len = snprintf(&ptr[4], sizeof(data) - used - 4, "%s", tcmu_dev_get_cfgstring(dev));

ERROR: code indent should never use tabs
#705: FILE: tcmu/helper.c:196:
+^I^Ilen = snprintf(&ptr[4], sizeof(data) - used - 4, "%s", tcmu_dev_get_cfgstring(dev));$

ERROR: code indent should never use tabs
#706: FILE: tcmu/helper.c:197:
+^I^Iptr[3] = len + 1;$

ERROR: code indent should never use tabs
#708: FILE: tcmu/helper.c:199:
+^I^Iused += (uint8_t)ptr[3] + 4;$

ERROR: code indent should never use tabs
#709: FILE: tcmu/helper.c:200:
+^I^Iptr += (uint8_t)ptr[3] + 4;$

ERROR: code indent should never use tabs
#711: FILE: tcmu/helper.c:202:
+^I^I/* Done with descriptor list */$

ERROR: code indent should never use tabs
#713: FILE: tcmu/helper.c:204:
+^I^I*tot_len = htobe16(used);$

ERROR: code indent should never use tabs
#715: FILE: tcmu/helper.c:206:
+^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, used + 4);$

ERROR: code indent should never use tabs
#717: FILE: tcmu/helper.c:208:
+^I^Ifree(wwn);$

ERROR: code indent should never use tabs
#718: FILE: tcmu/helper.c:209:
+^I^Iwwn = NULL;$

ERROR: code indent should never use tabs
#720: FILE: tcmu/helper.c:211:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#721: FILE: tcmu/helper.c:212:
+^I}$

ERROR: code indent should never use tabs
#722: FILE: tcmu/helper.c:213:
+^Ibreak;$

ERROR: code indent should never use tabs
#723: FILE: tcmu/helper.c:214:
+^Icase 0xb0: /* Block Limits */$

ERROR: code indent should never use tabs
#724: FILE: tcmu/helper.c:215:
+^I{$

ERROR: code indent should never use tabs
#725: FILE: tcmu/helper.c:216:
+^I^Ichar data[64];$

ERROR: code indent should never use tabs
#726: FILE: tcmu/helper.c:217:
+^I^Iuint32_t max_xfer_length;$

ERROR: code indent should never use tabs
#727: FILE: tcmu/helper.c:218:
+^I^Iuint16_t val16;$

ERROR: code indent should never use tabs
#728: FILE: tcmu/helper.c:219:
+^I^Iuint32_t val32;$

ERROR: code indent should never use tabs
#730: FILE: tcmu/helper.c:221:
+^I^Imemset(data, 0, sizeof(data));$

ERROR: code indent should never use tabs
#732: FILE: tcmu/helper.c:223:
+^I^Idata[1] = 0xb0;$

ERROR: code indent should never use tabs
#734: FILE: tcmu/helper.c:225:
+^I^Ival16 = htobe16(0x3c);$

ERROR: code indent should never use tabs
#735: FILE: tcmu/helper.c:226:
+^I^Imemcpy(&data[2], &val16, 2);$

ERROR: code indent should never use tabs
#737: FILE: tcmu/helper.c:228:
+^I^I/* WSNZ = 1: the device server won't support a value of zero$

WARNING: Block comments use a leading /* on a separate line
#737: FILE: tcmu/helper.c:228:
+               /* WSNZ = 1: the device server won't support a value of zero

ERROR: code indent should never use tabs
#738: FILE: tcmu/helper.c:229:
+^I^I * in the NUMBER OF LOGICAL BLOCKS field in the WRITE SAME$

ERROR: code indent should never use tabs
#739: FILE: tcmu/helper.c:230:
+^I^I * command CDBs$

ERROR: code indent should never use tabs
#740: FILE: tcmu/helper.c:231:
+^I^I */$

ERROR: code indent should never use tabs
#741: FILE: tcmu/helper.c:232:
+^I^Idata[4] = 0x01;$

ERROR: code indent should never use tabs
#743: FILE: tcmu/helper.c:234:
+^I^I/*$

ERROR: code indent should never use tabs
#744: FILE: tcmu/helper.c:235:
+^I^I * Daemons like runner may override the user requested$

ERROR: code indent should never use tabs
#745: FILE: tcmu/helper.c:236:
+^I^I * value due to device specific limits.$

ERROR: code indent should never use tabs
#746: FILE: tcmu/helper.c:237:
+^I^I */$

ERROR: code indent should never use tabs
#747: FILE: tcmu/helper.c:238:
+^I^Imax_xfer_length = tcmu_dev_get_max_xfer_len(dev);$

ERROR: code indent should never use tabs
#749: FILE: tcmu/helper.c:240:
+^I^Ival32 = htobe32(max_xfer_length);$

ERROR: code indent should never use tabs
#750: FILE: tcmu/helper.c:241:
+^I^I/* Max xfer length */$

ERROR: code indent should never use tabs
#751: FILE: tcmu/helper.c:242:
+^I^Imemcpy(&data[8], &val32, 4);$

ERROR: code indent should never use tabs
#752: FILE: tcmu/helper.c:243:
+^I^I/* Optimal xfer length */$

ERROR: code indent should never use tabs
#753: FILE: tcmu/helper.c:244:
+^I^Imemcpy(&data[12], &val32, 4);$

ERROR: code indent should never use tabs
#755: FILE: tcmu/helper.c:246:
+^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$

ERROR: code indent should never use tabs
#757: FILE: tcmu/helper.c:248:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#758: FILE: tcmu/helper.c:249:
+^I}$

ERROR: code indent should never use tabs
#759: FILE: tcmu/helper.c:250:
+^Ibreak;$

ERROR: code indent should never use tabs
#760: FILE: tcmu/helper.c:251:
+^Icase 0xb1: /* Block Device Characteristics VPD page */$

ERROR: code indent should never use tabs
#761: FILE: tcmu/helper.c:252:
+^I{$

ERROR: code indent should never use tabs
#762: FILE: tcmu/helper.c:253:
+^I^Ichar data[64];$

ERROR: code indent should never use tabs
#763: FILE: tcmu/helper.c:254:
+^I^Iuint16_t val16;$

ERROR: code indent should never use tabs
#765: FILE: tcmu/helper.c:256:
+^I^Imemset(data, 0, sizeof(data));$

ERROR: code indent should never use tabs
#767: FILE: tcmu/helper.c:258:
+^I^I/*$

ERROR: code indent should never use tabs
#768: FILE: tcmu/helper.c:259:
+^I^I * From spc-5 Revision 14, section 6.7.2 Standard INQUIRY data$

ERROR: code indent should never use tabs
#769: FILE: tcmu/helper.c:260:
+^I^I * set the devive type to Direct access block device.$

ERROR: code indent should never use tabs
#770: FILE: tcmu/helper.c:261:
+^I^I */$

ERROR: code indent should never use tabs
#771: FILE: tcmu/helper.c:262:
+^I^Idata[0] = 0x00;$

ERROR: code indent should never use tabs
#773: FILE: tcmu/helper.c:264:
+^I^I/* PAGE CODE (B1h) */$

ERROR: code indent should never use tabs
#774: FILE: tcmu/helper.c:265:
+^I^Idata[1] = 0xb1;$

ERROR: code indent should never use tabs
#776: FILE: tcmu/helper.c:267:
+^I^I/* PAGE LENGTH (003Ch)*/$

ERROR: code indent should never use tabs
#777: FILE: tcmu/helper.c:268:
+^I^Ival16 = htobe16(0x003c);$

ERROR: code indent should never use tabs
#778: FILE: tcmu/helper.c:269:
+^I^Imemcpy(&data[2], &val16, 2);$

ERROR: code indent should never use tabs
#780: FILE: tcmu/helper.c:271:
+^I^Iif (tcmu_dev_get_solid_state_media(dev)) {$

ERROR: code indent should never use tabs
#781: FILE: tcmu/helper.c:272:
+^I^I^Ival16 = htobe16(0x0001);$

ERROR: code indent should never use tabs
#782: FILE: tcmu/helper.c:273:
+^I^I^Imemcpy(&data[4], &val16, 2);$

ERROR: code indent should never use tabs
#783: FILE: tcmu/helper.c:274:
+^I^I}$

ERROR: code indent should never use tabs
#785: FILE: tcmu/helper.c:276:
+^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$

ERROR: code indent should never use tabs
#786: FILE: tcmu/helper.c:277:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#787: FILE: tcmu/helper.c:278:
+^I}$

ERROR: code indent should never use tabs
#788: FILE: tcmu/helper.c:279:
+^Ibreak;$

ERROR: code indent should never use tabs
#789: FILE: tcmu/helper.c:280:
+^Icase 0xb2: /* Logical Block Provisioning VPD page */$

ERROR: code indent should never use tabs
#790: FILE: tcmu/helper.c:281:
+^I{$

ERROR: code indent should never use tabs
#791: FILE: tcmu/helper.c:282:
+^I^Ichar data[64];$

ERROR: code indent should never use tabs
#792: FILE: tcmu/helper.c:283:
+^I^Iuint16_t val16;$

ERROR: code indent should never use tabs
#794: FILE: tcmu/helper.c:285:
+^I^Imemset(data, 0, sizeof(data));$

ERROR: code indent should never use tabs
#796: FILE: tcmu/helper.c:287:
+^I^I/*$

ERROR: code indent should never use tabs
#797: FILE: tcmu/helper.c:288:
+^I^I * From spc-5 Revision 14, section 6.7.2 Standard INQUIRY data$

ERROR: code indent should never use tabs
#798: FILE: tcmu/helper.c:289:
+^I^I * set the device type to Direct access block device.$

ERROR: code indent should never use tabs
#799: FILE: tcmu/helper.c:290:
+^I^I */$

ERROR: code indent should never use tabs
#800: FILE: tcmu/helper.c:291:
+^I^Idata[0] = 0x00;$

ERROR: code indent should never use tabs
#802: FILE: tcmu/helper.c:293:
+^I^I/* PAGE CODE (B2h) */$

ERROR: code indent should never use tabs
#803: FILE: tcmu/helper.c:294:
+^I^Idata[1] = 0xb2;$

ERROR: code indent should never use tabs
#805: FILE: tcmu/helper.c:296:
+^I^I/*$

WARNING: line over 80 characters
#806: FILE: tcmu/helper.c:297:
+                * PAGE LENGTH field: PROVISIONING GROUP DESCRIPTOR field will be

ERROR: code indent should never use tabs
#806: FILE: tcmu/helper.c:297:
+^I^I * PAGE LENGTH field: PROVISIONING GROUP DESCRIPTOR field will be$

ERROR: code indent should never use tabs
#807: FILE: tcmu/helper.c:298:
+^I^I * not present.$

ERROR: code indent should never use tabs
#808: FILE: tcmu/helper.c:299:
+^I^I */$

ERROR: code indent should never use tabs
#809: FILE: tcmu/helper.c:300:
+^I^Ival16 = htobe16(0x0004);$

ERROR: code indent should never use tabs
#810: FILE: tcmu/helper.c:301:
+^I^Imemcpy(&data[2], &val16, 2);$

ERROR: code indent should never use tabs
#812: FILE: tcmu/helper.c:303:
+^I^I/*$

ERROR: code indent should never use tabs
#813: FILE: tcmu/helper.c:304:
+^I^I * The logical block provisioning read zeros (LBPRZ) field.$

ERROR: code indent should never use tabs
#814: FILE: tcmu/helper.c:305:
+^I^I *$

WARNING: line over 80 characters
#815: FILE: tcmu/helper.c:306:
+                * The logical block data represented by unmapped LBAs is set to zeros

ERROR: code indent should never use tabs
#815: FILE: tcmu/helper.c:306:
+^I^I * The logical block data represented by unmapped LBAs is set to zeros$

ERROR: code indent should never use tabs
#816: FILE: tcmu/helper.c:307:
+^I^I */$

ERROR: code indent should never use tabs
#817: FILE: tcmu/helper.c:308:
+^I^Idata[5] = 0x04;$

ERROR: code indent should never use tabs
#819: FILE: tcmu/helper.c:310:
+^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$

ERROR: code indent should never use tabs
#820: FILE: tcmu/helper.c:311:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#821: FILE: tcmu/helper.c:312:
+^I}$

ERROR: code indent should never use tabs
#822: FILE: tcmu/helper.c:313:
+^Ibreak;$

ERROR: code indent should never use tabs
#823: FILE: tcmu/helper.c:314:
+^Idefault:$

ERROR: code indent should never use tabs
#824: FILE: tcmu/helper.c:315:
+^I^Ierror_report("Vital product data page code 0x%x not support\n",$

ERROR: Error messages should not contain newlines
#824: FILE: tcmu/helper.c:315:
+               error_report("Vital product data page code 0x%x not support\n",

ERROR: code indent should never use tabs
#825: FILE: tcmu/helper.c:316:
+^I^I^I     cdb[2]);$

ERROR: code indent should never use tabs
#826: FILE: tcmu/helper.c:317:
+^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#827: FILE: tcmu/helper.c:318:
+^I}$

ERROR: code indent should never use tabs
#834: FILE: tcmu/helper.c:325:
+^Istruct tcmu_device *dev,$

ERROR: code indent should never use tabs
#835: FILE: tcmu/helper.c:326:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#836: FILE: tcmu/helper.c:327:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#837: FILE: tcmu/helper.c:328:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#839: FILE: tcmu/helper.c:330:
+^Iif (!(cdb[1] & 0x01)) {$

ERROR: code indent should never use tabs
#840: FILE: tcmu/helper.c:331:
+^I^Iif (!cdb[2])$

ERROR: code indent should never use tabs
#841: FILE: tcmu/helper.c:332:
+^I^I^Ireturn tcmu_emulate_std_inquiry(cdb, iovec,$

ERROR: code indent should never use tabs
#842: FILE: tcmu/helper.c:333:
+^I^I^I^I^I^I^Iiov_cnt);$

ERROR: code indent should never use tabs
#843: FILE: tcmu/helper.c:334:
+^I^Ielse$

ERROR: code indent should never use tabs
#844: FILE: tcmu/helper.c:335:
+^I^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#845: FILE: tcmu/helper.c:336:
+^I} else {$

ERROR: code indent should never use tabs
#846: FILE: tcmu/helper.c:337:
+^I^Ireturn tcmu_emulate_evpd_inquiry(dev, cdb, iovec, iov_cnt);$

ERROR: code indent should never use tabs
#847: FILE: tcmu/helper.c:338:
+^I}$

ERROR: code indent should never use tabs
#851: FILE: tcmu/helper.c:342:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#852: FILE: tcmu/helper.c:343:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#853: FILE: tcmu/helper.c:344:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#855: FILE: tcmu/helper.c:346:
+^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#859: FILE: tcmu/helper.c:350:
+^Iuint64_t num_lbas,$

ERROR: code indent should never use tabs
#860: FILE: tcmu/helper.c:351:
+^Iuint32_t block_size,$

ERROR: code indent should never use tabs
#861: FILE: tcmu/helper.c:352:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#862: FILE: tcmu/helper.c:353:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#863: FILE: tcmu/helper.c:354:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#865: FILE: tcmu/helper.c:356:
+^Iuint8_t buf[8];$

ERROR: code indent should never use tabs
#866: FILE: tcmu/helper.c:357:
+^Iuint32_t val32;$

ERROR: code indent should never use tabs
#868: FILE: tcmu/helper.c:359:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#870: FILE: tcmu/helper.c:361:
+^Iif (num_lbas < 0x100000000ULL) {$

ERROR: code indent should never use tabs
#871: FILE: tcmu/helper.c:362:
+^I^I// Return the LBA of the last logical block, so subtract 1.$

ERROR: do not use C99 // comments
#871: FILE: tcmu/helper.c:362:
+               // Return the LBA of the last logical block, so subtract 1.

ERROR: code indent should never use tabs
#872: FILE: tcmu/helper.c:363:
+^I^Ival32 = htobe32(num_lbas-1);$

ERROR: spaces required around that '-' (ctx:VxV)
#872: FILE: tcmu/helper.c:363:
+               val32 = htobe32(num_lbas-1);
                                        ^

ERROR: code indent should never use tabs
#873: FILE: tcmu/helper.c:364:
+^I} else {$

ERROR: code indent should never use tabs
#874: FILE: tcmu/helper.c:365:
+^I^I// This lets the initiator know that he needs to use$

ERROR: do not use C99 // comments
#874: FILE: tcmu/helper.c:365:
+               // This lets the initiator know that he needs to use

ERROR: code indent should never use tabs
#875: FILE: tcmu/helper.c:366:
+^I^I// Read Capacity(16).$

ERROR: do not use C99 // comments
#875: FILE: tcmu/helper.c:366:
+               // Read Capacity(16).

ERROR: code indent should never use tabs
#876: FILE: tcmu/helper.c:367:
+^I^Ival32 = 0xffffffff;$

ERROR: code indent should never use tabs
#877: FILE: tcmu/helper.c:368:
+^I}$

ERROR: code indent should never use tabs
#879: FILE: tcmu/helper.c:370:
+^Imemcpy(&buf[0], &val32, 4);$

ERROR: code indent should never use tabs
#881: FILE: tcmu/helper.c:372:
+^Ival32 = htobe32(block_size);$

ERROR: code indent should never use tabs
#882: FILE: tcmu/helper.c:373:
+^Imemcpy(&buf[4], &val32, 4);$

ERROR: code indent should never use tabs
#884: FILE: tcmu/helper.c:375:
+^I/* all else is zero */$

ERROR: code indent should never use tabs
#886: FILE: tcmu/helper.c:377:
+^Itcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));$

ERROR: code indent should never use tabs
#888: FILE: tcmu/helper.c:379:
+^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#892: FILE: tcmu/helper.c:383:
+^Iuint64_t num_lbas,$

ERROR: code indent should never use tabs
#893: FILE: tcmu/helper.c:384:
+^Iuint32_t block_size,$

ERROR: code indent should never use tabs
#894: FILE: tcmu/helper.c:385:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#895: FILE: tcmu/helper.c:386:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#896: FILE: tcmu/helper.c:387:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#898: FILE: tcmu/helper.c:389:
+^Iuint8_t buf[32];$

ERROR: code indent should never use tabs
#899: FILE: tcmu/helper.c:390:
+^Iuint64_t val64;$

ERROR: code indent should never use tabs
#900: FILE: tcmu/helper.c:391:
+^Iuint32_t val32;$

ERROR: code indent should never use tabs
#902: FILE: tcmu/helper.c:393:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#904: FILE: tcmu/helper.c:395:
+^I// Return the LBA of the last logical block, so subtract 1.$

ERROR: do not use C99 // comments
#904: FILE: tcmu/helper.c:395:
+       // Return the LBA of the last logical block, so subtract 1.

ERROR: code indent should never use tabs
#905: FILE: tcmu/helper.c:396:
+^Ival64 = htobe64(num_lbas-1);$

ERROR: spaces required around that '-' (ctx:VxV)
#905: FILE: tcmu/helper.c:396:
+       val64 = htobe64(num_lbas-1);
                                ^

ERROR: code indent should never use tabs
#906: FILE: tcmu/helper.c:397:
+^Imemcpy(&buf[0], &val64, 8);$

ERROR: code indent should never use tabs
#908: FILE: tcmu/helper.c:399:
+^Ival32 = htobe32(block_size);$

ERROR: code indent should never use tabs
#909: FILE: tcmu/helper.c:400:
+^Imemcpy(&buf[8], &val32, 4);$

ERROR: code indent should never use tabs
#911: FILE: tcmu/helper.c:402:
+^I/*$

ERROR: code indent should never use tabs
#912: FILE: tcmu/helper.c:403:
+^I * Logical Block Provisioning Management Enabled (LBPME) bit$

ERROR: code indent should never use tabs
#913: FILE: tcmu/helper.c:404:
+^I *$

ERROR: code indent should never use tabs
#914: FILE: tcmu/helper.c:405:
+^I * The LBPME bit sets to one and then the logical unit implements$

ERROR: code indent should never use tabs
#915: FILE: tcmu/helper.c:406:
+^I * logical block provisioning management$

ERROR: code indent should never use tabs
#916: FILE: tcmu/helper.c:407:
+^I */$

ERROR: code indent should never use tabs
#917: FILE: tcmu/helper.c:408:
+^Ibuf[14] = 0x80;$

ERROR: code indent should never use tabs
#919: FILE: tcmu/helper.c:410:
+^I/*$

ERROR: code indent should never use tabs
#920: FILE: tcmu/helper.c:411:
+^I * The logical block provisioning read zeros (LBPRZ) bit shall be$

ERROR: code indent should never use tabs
#921: FILE: tcmu/helper.c:412:
+^I * set to one if the LBPRZ field is set to xx1b in VPD B2. The$

ERROR: code indent should never use tabs
#922: FILE: tcmu/helper.c:413:
+^I * LBPRZ bit shall be set to zero if the LBPRZ field is not set$

ERROR: code indent should never use tabs
#923: FILE: tcmu/helper.c:414:
+^I * to xx1b.$

ERROR: code indent should never use tabs
#924: FILE: tcmu/helper.c:415:
+^I */$

ERROR: code indent should never use tabs
#925: FILE: tcmu/helper.c:416:
+^Ibuf[14] |= 0x40;$

ERROR: code indent should never use tabs
#927: FILE: tcmu/helper.c:418:
+^I/* all else is zero */$

ERROR: code indent should never use tabs
#929: FILE: tcmu/helper.c:420:
+^Itcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));$

ERROR: code indent should never use tabs
#931: FILE: tcmu/helper.c:422:
+^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#935: FILE: tcmu/helper.c:426:
+^I^I^I^I uint8_t *from_buf, size_t from_len)$

ERROR: code indent should never use tabs
#937: FILE: tcmu/helper.c:428:
+^Iif (!to_buf)$

ERROR: braces {} are necessary for all arms of this statement
#937: FILE: tcmu/helper.c:428:
+       if (!to_buf)
[...]

ERROR: code indent should never use tabs
#938: FILE: tcmu/helper.c:429:
+^I^Ireturn;$

ERROR: code indent should never use tabs
#939: FILE: tcmu/helper.c:430:
+^I/*$

ERROR: code indent should never use tabs
#940: FILE: tcmu/helper.c:431:
+^I * SPC 4r37: 4.3.5.6 Allocation length:$

ERROR: code indent should never use tabs
#941: FILE: tcmu/helper.c:432:
+^I *$

ERROR: code indent should never use tabs
#942: FILE: tcmu/helper.c:433:
+^I * The device server shall terminate transfers to the Data-In Buffer$

ERROR: code indent should never use tabs
#943: FILE: tcmu/helper.c:434:
+^I * when the number of bytes or blocks specified by the ALLOCATION$

ERROR: code indent should never use tabs
#944: FILE: tcmu/helper.c:435:
+^I * LENGTH field have been transferred or when all available data$

ERROR: code indent should never use tabs
#945: FILE: tcmu/helper.c:436:
+^I * have been transferred, whichever is less.$

ERROR: code indent should never use tabs
#946: FILE: tcmu/helper.c:437:
+^I */$

ERROR: code indent should never use tabs
#947: FILE: tcmu/helper.c:438:
+^Imemcpy(to_buf, from_buf, to_len > from_len ? from_len : to_len);$

ERROR: code indent should never use tabs
#951: FILE: tcmu/helper.c:442:
+^I^I^I   size_t ret_buf_len)$

ERROR: code indent should never use tabs
#953: FILE: tcmu/helper.c:444:
+^Iuint8_t buf[12];$

ERROR: code indent should never use tabs
#955: FILE: tcmu/helper.c:446:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#956: FILE: tcmu/helper.c:447:
+^Ibuf[0] = 0x1;$

ERROR: code indent should never use tabs
#957: FILE: tcmu/helper.c:448:
+^Ibuf[1] = 0xa;$

ERROR: code indent should never use tabs
#959: FILE: tcmu/helper.c:450:
+^Icopy_to_response_buf(ret_buf, ret_buf_len, buf, 12);$

ERROR: code indent should never use tabs
#960: FILE: tcmu/helper.c:451:
+^Ireturn 12;$

ERROR: code indent should never use tabs
#964: FILE: tcmu/helper.c:455:
+^I^I      size_t ret_buf_len)$

ERROR: code indent should never use tabs
#966: FILE: tcmu/helper.c:457:
+^Iuint8_t buf[20];$

ERROR: code indent should never use tabs
#968: FILE: tcmu/helper.c:459:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#969: FILE: tcmu/helper.c:460:
+^Ibuf[0] = 0x8;$

ERROR: code indent should never use tabs
#970: FILE: tcmu/helper.c:461:
+^Ibuf[1] = 0x12;$

ERROR: code indent should never use tabs
#972: FILE: tcmu/helper.c:463:
+^I/*$

ERROR: code indent should never use tabs
#973: FILE: tcmu/helper.c:464:
+^I * If device supports a writeback cache then set writeback$

ERROR: code indent should never use tabs
#974: FILE: tcmu/helper.c:465:
+^I * cache enable (WCE)$

ERROR: code indent should never use tabs
#975: FILE: tcmu/helper.c:466:
+^I */$

ERROR: code indent should never use tabs
#976: FILE: tcmu/helper.c:467:
+^Iif (tcmu_dev_get_write_cache_enabled(dev))$

ERROR: braces {} are necessary for all arms of this statement
#976: FILE: tcmu/helper.c:467:
+       if (tcmu_dev_get_write_cache_enabled(dev))
[...]

ERROR: code indent should never use tabs
#977: FILE: tcmu/helper.c:468:
+^I^Ibuf[2] = 0x4;$

ERROR: code indent should never use tabs
#979: FILE: tcmu/helper.c:470:
+^Icopy_to_response_buf(ret_buf, ret_buf_len, buf, 20);$

ERROR: code indent should never use tabs
#980: FILE: tcmu/helper.c:471:
+^Ireturn 20;$

ERROR: code indent should never use tabs
#984: FILE: tcmu/helper.c:475:
+^I^I^I       size_t ret_buf_len)$

ERROR: code indent should never use tabs
#986: FILE: tcmu/helper.c:477:
+^Iuint8_t buf[12];$

ERROR: code indent should never use tabs
#988: FILE: tcmu/helper.c:479:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#989: FILE: tcmu/helper.c:480:
+^Ibuf[0] = 0x0a;$

ERROR: code indent should never use tabs
#990: FILE: tcmu/helper.c:481:
+^Ibuf[1] = 0x0a;$

ERROR: code indent should never use tabs
#992: FILE: tcmu/helper.c:483:
+^I/* From spc4r31, section 7.5.7 Control mode Page$

WARNING: Block comments use a leading /* on a separate line
#992: FILE: tcmu/helper.c:483:
+       /* From spc4r31, section 7.5.7 Control mode Page

ERROR: code indent should never use tabs
#993: FILE: tcmu/helper.c:484:
+^I *$

ERROR: code indent should never use tabs
#994: FILE: tcmu/helper.c:485:
+^I * GLTSD = 1: because we don't implicitly save log parameters$

ERROR: code indent should never use tabs
#995: FILE: tcmu/helper.c:486:
+^I *$

ERROR: code indent should never use tabs
#996: FILE: tcmu/helper.c:487:
+^I * A global logging target save disable (GLTSD) bit set to$

ERROR: code indent should never use tabs
#997: FILE: tcmu/helper.c:488:
+^I * zero specifies that the logical unit implicitly saves, at$

ERROR: code indent should never use tabs
#998: FILE: tcmu/helper.c:489:
+^I * vendor specific intervals, each log parameter in which the$

ERROR: code indent should never use tabs
#999: FILE: tcmu/helper.c:490:
+^I * TSD bit (see 7.3) is set to zero. A GLTSD bit set to one$

ERROR: code indent should never use tabs
#1000: FILE: tcmu/helper.c:491:
+^I * specifies that the logical unit shall not implicitly save$

ERROR: code indent should never use tabs
#1001: FILE: tcmu/helper.c:492:
+^I * any log parameters.$

ERROR: code indent should never use tabs
#1002: FILE: tcmu/helper.c:493:
+^I */$

ERROR: code indent should never use tabs
#1003: FILE: tcmu/helper.c:494:
+^Ibuf[2] = 0x02;$

ERROR: code indent should never use tabs
#1005: FILE: tcmu/helper.c:496:
+^I/* From spc4r31, section 7.5.7 Control mode Page$

WARNING: Block comments use a leading /* on a separate line
#1005: FILE: tcmu/helper.c:496:
+       /* From spc4r31, section 7.5.7 Control mode Page

ERROR: code indent should never use tabs
#1006: FILE: tcmu/helper.c:497:
+^I *$

ERROR: code indent should never use tabs
#1007: FILE: tcmu/helper.c:498:
+^I * TAS = 1: Currently not settable by tcmu. Using the LIO default$

ERROR: code indent should never use tabs
#1008: FILE: tcmu/helper.c:499:
+^I *$

ERROR: code indent should never use tabs
#1009: FILE: tcmu/helper.c:500:
+^I * A task aborted status (TAS) bit set to zero specifies that$

ERROR: code indent should never use tabs
#1010: FILE: tcmu/helper.c:501:
+^I * aborted commands shall be terminated by the device server$

ERROR: code indent should never use tabs
#1011: FILE: tcmu/helper.c:502:
+^I * without any response to the application client. A TAS bit$

ERROR: code indent should never use tabs
#1012: FILE: tcmu/helper.c:503:
+^I * set to one specifies that commands aborted by the actions$

ERROR: code indent should never use tabs
#1013: FILE: tcmu/helper.c:504:
+^I * of an I_T nexus other than the I_T nexus on which the command$

ERROR: code indent should never use tabs
#1014: FILE: tcmu/helper.c:505:
+^I * was received shall be completed with TASK ABORTED status$

ERROR: code indent should never use tabs
#1015: FILE: tcmu/helper.c:506:
+^I */$

ERROR: code indent should never use tabs
#1016: FILE: tcmu/helper.c:507:
+^Ibuf[5] = 0x40;$

ERROR: code indent should never use tabs
#1018: FILE: tcmu/helper.c:509:
+^I/* From spc4r31, section 7.5.7 Control mode Page$

WARNING: Block comments use a leading /* on a separate line
#1018: FILE: tcmu/helper.c:509:
+       /* From spc4r31, section 7.5.7 Control mode Page

ERROR: code indent should never use tabs
#1019: FILE: tcmu/helper.c:510:
+^I *$

ERROR: code indent should never use tabs
#1020: FILE: tcmu/helper.c:511:
+^I * BUSY TIMEOUT PERIOD: Currently is unlimited$

ERROR: code indent should never use tabs
#1021: FILE: tcmu/helper.c:512:
+^I *$

ERROR: code indent should never use tabs
#1022: FILE: tcmu/helper.c:513:
+^I * The BUSY TIMEOUT PERIOD field specifies the maximum time, in$

ERROR: code indent should never use tabs
#1023: FILE: tcmu/helper.c:514:
+^I * 100 milliseconds increments, that the application client allows$

ERROR: code indent should never use tabs
#1024: FILE: tcmu/helper.c:515:
+^I * for the device server to return BUSY status for unanticipated$

ERROR: code indent should never use tabs
#1025: FILE: tcmu/helper.c:516:
+^I * conditions that are not a routine part of commands from the$

ERROR: code indent should never use tabs
#1026: FILE: tcmu/helper.c:517:
+^I * application client. This value may be rounded down as defined$

ERROR: code indent should never use tabs
#1027: FILE: tcmu/helper.c:518:
+^I * in 5.4(the Parameter rounding section).$

ERROR: code indent should never use tabs
#1028: FILE: tcmu/helper.c:519:
+^I *$

ERROR: code indent should never use tabs
#1029: FILE: tcmu/helper.c:520:
+^I * A 0000h value in this field is undefined by this standard.$

ERROR: code indent should never use tabs
#1030: FILE: tcmu/helper.c:521:
+^I * An FFFFh value in this field is defined as an unlimited period.$

ERROR: code indent should never use tabs
#1031: FILE: tcmu/helper.c:522:
+^I */$

ERROR: code indent should never use tabs
#1032: FILE: tcmu/helper.c:523:
+^Ibuf[8] = 0xff;$

ERROR: code indent should never use tabs
#1033: FILE: tcmu/helper.c:524:
+^Ibuf[9] = 0xff;$

ERROR: code indent should never use tabs
#1035: FILE: tcmu/helper.c:526:
+^Icopy_to_response_buf(ret_buf, ret_buf_len, buf, 12);$

ERROR: code indent should never use tabs
#1036: FILE: tcmu/helper.c:527:
+^Ireturn 12;$

ERROR: code indent should never use tabs
#1041: FILE: tcmu/helper.c:532:
+^Iuint8_t page;$

ERROR: code indent should never use tabs
#1042: FILE: tcmu/helper.c:533:
+^Iuint8_t subpage;$

ERROR: code indent should never use tabs
#1043: FILE: tcmu/helper.c:534:
+^Iint (*get)(struct tcmu_device *dev, uint8_t *buf, size_t buf_len);$

ERROR: code indent should never use tabs
#1045: FILE: tcmu/helper.c:536:
+^I{0x1, 0, handle_rwrecovery_page},$

ERROR: code indent should never use tabs
#1046: FILE: tcmu/helper.c:537:
+^I{0x8, 0, handle_cache_page},$

ERROR: code indent should never use tabs
#1047: FILE: tcmu/helper.c:538:
+^I{0xa, 0, handle_control_page},$

ERROR: code indent should never use tabs
#1051: FILE: tcmu/helper.c:542:
+^I^I^I^I struct mode_sense_handler *handler,$

ERROR: code indent should never use tabs
#1052: FILE: tcmu/helper.c:543:
+^I^I^I^I uint8_t **buf, size_t alloc_len,$

ERROR: code indent should never use tabs
#1053: FILE: tcmu/helper.c:544:
+^I^I^I^I size_t *used_len, bool sense_ten)$

ERROR: code indent should never use tabs
#1055: FILE: tcmu/helper.c:546:
+^Iint ret;$

ERROR: code indent should never use tabs
#1057: FILE: tcmu/helper.c:548:
+^Iret = handler->get(dev, *buf, alloc_len - *used_len);$

ERROR: code indent should never use tabs
#1059: FILE: tcmu/helper.c:550:
+^Iif  (!sense_ten && (*used_len + ret >= 255))$

ERROR: braces {} are necessary for all arms of this statement
#1059: FILE: tcmu/helper.c:550:
+       if  (!sense_ten && (*used_len + ret >= 255))
[...]

ERROR: code indent should never use tabs
#1060: FILE: tcmu/helper.c:551:
+^I^Ireturn -EINVAL;$

ERROR: code indent should never use tabs
#1062: FILE: tcmu/helper.c:553:
+^I/*$

ERROR: code indent should never use tabs
#1063: FILE: tcmu/helper.c:554:
+^I * SPC 4r37: 4.3.5.6 Allocation length:$

ERROR: code indent should never use tabs
#1064: FILE: tcmu/helper.c:555:
+^I *$

ERROR: code indent should never use tabs
#1065: FILE: tcmu/helper.c:556:
+^I * If the information being transferred to the Data-In Buffer includes$

ERROR: code indent should never use tabs
#1066: FILE: tcmu/helper.c:557:
+^I * fields containing counts of the number of bytes in some or all of$

ERROR: code indent should never use tabs
#1067: FILE: tcmu/helper.c:558:
+^I * the data (e.g., the PARAMETER DATA LENGTH field, the PAGE LENGTH$

ERROR: code indent should never use tabs
#1068: FILE: tcmu/helper.c:559:
+^I * field, the DESCRIPTOR LENGTH field, the AVAILABLE DATA field),$

ERROR: code indent should never use tabs
#1069: FILE: tcmu/helper.c:560:
+^I * then the contents of these fields shall not be altered to reflect$

ERROR: code indent should never use tabs
#1070: FILE: tcmu/helper.c:561:
+^I * the truncation, if any, that results from an insufficient$

ERROR: code indent should never use tabs
#1071: FILE: tcmu/helper.c:562:
+^I * ALLOCATION LENGTH value$

ERROR: code indent should never use tabs
#1072: FILE: tcmu/helper.c:563:
+^I */$

ERROR: code indent should never use tabs
#1073: FILE: tcmu/helper.c:564:
+^I/*$

ERROR: code indent should never use tabs
#1074: FILE: tcmu/helper.c:565:
+^I * Setup the buffer so to still loop over the handlers, but just$

ERROR: code indent should never use tabs
#1075: FILE: tcmu/helper.c:566:
+^I * increment the used_len so we can return the$

ERROR: code indent should never use tabs
#1076: FILE: tcmu/helper.c:567:
+^I * final value.$

ERROR: code indent should never use tabs
#1077: FILE: tcmu/helper.c:568:
+^I */$

ERROR: code indent should never use tabs
#1078: FILE: tcmu/helper.c:569:
+^Iif (*buf && (*used_len + ret >= alloc_len))$

ERROR: braces {} are necessary for all arms of this statement
#1078: FILE: tcmu/helper.c:569:
+       if (*buf && (*used_len + ret >= alloc_len))
[...]

ERROR: code indent should never use tabs
#1079: FILE: tcmu/helper.c:570:
+^I^I*buf = NULL;$

ERROR: code indent should never use tabs
#1081: FILE: tcmu/helper.c:572:
+^I*used_len += ret;$

ERROR: code indent should never use tabs
#1082: FILE: tcmu/helper.c:573:
+^Iif (*buf)$

ERROR: braces {} are necessary for all arms of this statement
#1082: FILE: tcmu/helper.c:573:
+       if (*buf)
[...]

ERROR: code indent should never use tabs
#1083: FILE: tcmu/helper.c:574:
+^I^I*buf += ret;$

ERROR: code indent should never use tabs
#1084: FILE: tcmu/helper.c:575:
+^Ireturn ret;$

ERROR: code indent should never use tabs
#1093: FILE: tcmu/helper.c:584:
+^Istruct tcmu_device *dev,$

ERROR: code indent should never use tabs
#1094: FILE: tcmu/helper.c:585:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#1095: FILE: tcmu/helper.c:586:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#1096: FILE: tcmu/helper.c:587:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#1098: FILE: tcmu/helper.c:589:
+^Ibool sense_ten = (cdb[0] == MODE_SENSE_10);$

ERROR: code indent should never use tabs
#1099: FILE: tcmu/helper.c:590:
+^Iuint8_t page_code = cdb[2] & 0x3f;$

ERROR: code indent should never use tabs
#1100: FILE: tcmu/helper.c:591:
+^Iuint8_t subpage_code = cdb[3];$

ERROR: code indent should never use tabs
#1101: FILE: tcmu/helper.c:592:
+^Isize_t alloc_len = tcmu_dev_get_max_xfer_len(dev);$

ERROR: code indent should never use tabs
#1102: FILE: tcmu/helper.c:593:
+^Iint i;$

ERROR: code indent should never use tabs
#1103: FILE: tcmu/helper.c:594:
+^Iint ret;$

ERROR: code indent should never use tabs
#1104: FILE: tcmu/helper.c:595:
+^Isize_t used_len;$

ERROR: code indent should never use tabs
#1105: FILE: tcmu/helper.c:596:
+^Iuint8_t *buf;$

ERROR: code indent should never use tabs
#1106: FILE: tcmu/helper.c:597:
+^Iuint8_t *orig_buf = NULL;$

ERROR: code indent should never use tabs
#1108: FILE: tcmu/helper.c:599:
+^Iif (!alloc_len)$

ERROR: braces {} are necessary for all arms of this statement
#1108: FILE: tcmu/helper.c:599:
+       if (!alloc_len)
[...]

ERROR: code indent should never use tabs
#1109: FILE: tcmu/helper.c:600:
+^I^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#1111: FILE: tcmu/helper.c:602:
+^I/* Mode parameter header. Mode data length filled in at the end. */$

ERROR: code indent should never use tabs
#1112: FILE: tcmu/helper.c:603:
+^Iused_len = sense_ten ? 8 : 4;$

ERROR: code indent should never use tabs
#1113: FILE: tcmu/helper.c:604:
+^Iif (used_len > alloc_len)$

ERROR: braces {} are necessary for all arms of this statement
#1113: FILE: tcmu/helper.c:604:
+       if (used_len > alloc_len)
[...]

ERROR: code indent should never use tabs
#1114: FILE: tcmu/helper.c:605:
+^I^Igoto fail;$

ERROR: code indent should never use tabs
#1116: FILE: tcmu/helper.c:607:
+^Ibuf = calloc(1, alloc_len);$

ERROR: code indent should never use tabs
#1117: FILE: tcmu/helper.c:608:
+^Iif (!buf)$

ERROR: braces {} are necessary for all arms of this statement
#1117: FILE: tcmu/helper.c:608:
+       if (!buf)
[...]

ERROR: code indent should never use tabs
#1118: FILE: tcmu/helper.c:609:
+^I^Ireturn TCMU_STS_NO_RESOURCE;$

ERROR: code indent should never use tabs
#1120: FILE: tcmu/helper.c:611:
+^Iorig_buf = buf;$

ERROR: code indent should never use tabs
#1121: FILE: tcmu/helper.c:612:
+^Ibuf += used_len;$

ERROR: code indent should never use tabs
#1123: FILE: tcmu/helper.c:614:
+^I/* Don't fill in device-specific parameter */$

ERROR: code indent should never use tabs
#1124: FILE: tcmu/helper.c:615:
+^I/* This helper fn doesn't support sw write protect (SWP) */$

ERROR: code indent should never use tabs
#1126: FILE: tcmu/helper.c:617:
+^I/* Don't report block descriptors */$

ERROR: code indent should never use tabs
#1128: FILE: tcmu/helper.c:619:
+^Iif (page_code == 0x3f) {$

ERROR: code indent should never use tabs
#1129: FILE: tcmu/helper.c:620:
+^I^Ifor (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {$

ERROR: code indent should never use tabs
#1130: FILE: tcmu/helper.c:621:
+^I^I^Iret = handle_mode_sense(dev, &modesense_handlers[i],$

ERROR: code indent should never use tabs
#1131: FILE: tcmu/helper.c:622:
+^I^I^I^I^I^I&buf, alloc_len, &used_len,$

ERROR: code indent should never use tabs
#1132: FILE: tcmu/helper.c:623:
+^I^I^I^I^I^Isense_ten);$

ERROR: code indent should never use tabs
#1133: FILE: tcmu/helper.c:624:
+^I^I^Iif (ret < 0)$

ERROR: braces {} are necessary for all arms of this statement
#1133: FILE: tcmu/helper.c:624:
+                       if (ret < 0)
[...]

ERROR: code indent should never use tabs
#1134: FILE: tcmu/helper.c:625:
+^I^I^I^Igoto free_buf;$

ERROR: code indent should never use tabs
#1135: FILE: tcmu/helper.c:626:
+^I^I}$

ERROR: code indent should never use tabs
#1136: FILE: tcmu/helper.c:627:
+^I} else {$

ERROR: code indent should never use tabs
#1137: FILE: tcmu/helper.c:628:
+^I^Iret = 0;$

ERROR: code indent should never use tabs
#1139: FILE: tcmu/helper.c:630:
+^I^Ifor (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {$

ERROR: code indent should never use tabs
#1140: FILE: tcmu/helper.c:631:
+^I^I^Iif (page_code == modesense_handlers[i].page &&$

ERROR: code indent should never use tabs
#1141: FILE: tcmu/helper.c:632:
+^I^I^I    subpage_code == modesense_handlers[i].subpage) {$

ERROR: code indent should never use tabs
#1142: FILE: tcmu/helper.c:633:
+^I^I^I^Iret = handle_mode_sense(dev,$

ERROR: code indent should never use tabs
#1143: FILE: tcmu/helper.c:634:
+^I^I^I^I^I^I^I&modesense_handlers[i],$

ERROR: code indent should never use tabs
#1144: FILE: tcmu/helper.c:635:
+^I^I^I^I^I^I^I&buf, alloc_len,$

ERROR: code indent should never use tabs
#1145: FILE: tcmu/helper.c:636:
+^I^I^I^I^I^I^I&used_len, sense_ten);$

ERROR: code indent should never use tabs
#1146: FILE: tcmu/helper.c:637:
+^I^I^I^Ibreak;$

ERROR: code indent should never use tabs
#1147: FILE: tcmu/helper.c:638:
+^I^I^I}$

ERROR: code indent should never use tabs
#1148: FILE: tcmu/helper.c:639:
+^I^I}$

ERROR: code indent should never use tabs
#1150: FILE: tcmu/helper.c:641:
+^I^Iif (ret <= 0)$

ERROR: braces {} are necessary for all arms of this statement
#1150: FILE: tcmu/helper.c:641:
+               if (ret <= 0)
[...]

ERROR: code indent should never use tabs
#1151: FILE: tcmu/helper.c:642:
+^I^I^Igoto free_buf;$

ERROR: code indent should never use tabs
#1152: FILE: tcmu/helper.c:643:
+^I}$

ERROR: code indent should never use tabs
#1154: FILE: tcmu/helper.c:645:
+^Iif (sense_ten) {$

ERROR: code indent should never use tabs
#1155: FILE: tcmu/helper.c:646:
+^I^Iuint16_t *ptr = (uint16_t*) orig_buf;$

ERROR: "(foo*)" should be "(foo *)"
#1155: FILE: tcmu/helper.c:646:
+               uint16_t *ptr = (uint16_t*) orig_buf;

ERROR: code indent should never use tabs
#1156: FILE: tcmu/helper.c:647:
+^I^I*ptr = htobe16(used_len - 2);$

ERROR: code indent should never use tabs
#1157: FILE: tcmu/helper.c:648:
+^I}$

ERROR: code indent should never use tabs
#1158: FILE: tcmu/helper.c:649:
+^Ielse {$

ERROR: else should follow close brace '}'
#1158: FILE: tcmu/helper.c:649:
+       }
+       else {

ERROR: code indent should never use tabs
#1159: FILE: tcmu/helper.c:650:
+^I^Iorig_buf[0] = used_len - 1;$

ERROR: code indent should never use tabs
#1160: FILE: tcmu/helper.c:651:
+^I}$

ERROR: code indent should never use tabs
#1162: FILE: tcmu/helper.c:653:
+^Itcmu_memcpy_into_iovec(iovec, iov_cnt, orig_buf, alloc_len);$

ERROR: code indent should never use tabs
#1163: FILE: tcmu/helper.c:654:
+^Ifree(orig_buf);$

ERROR: code indent should never use tabs
#1164: FILE: tcmu/helper.c:655:
+^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#1167: FILE: tcmu/helper.c:658:
+^Ifree(orig_buf);$

ERROR: code indent should never use tabs
#1169: FILE: tcmu/helper.c:660:
+^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1178: FILE: tcmu/helper.c:669:
+^Istruct tcmu_device *dev,$

ERROR: code indent should never use tabs
#1179: FILE: tcmu/helper.c:670:
+^Iuint8_t *cdb,$

ERROR: code indent should never use tabs
#1180: FILE: tcmu/helper.c:671:
+^Istruct iovec *iovec,$

ERROR: code indent should never use tabs
#1181: FILE: tcmu/helper.c:672:
+^Isize_t iov_cnt)$

ERROR: code indent should never use tabs
#1183: FILE: tcmu/helper.c:674:
+^Ibool select_ten = (cdb[0] == MODE_SELECT_10);$

ERROR: code indent should never use tabs
#1184: FILE: tcmu/helper.c:675:
+^Iuint8_t page_code = cdb[2] & 0x3f;$

ERROR: code indent should never use tabs
#1185: FILE: tcmu/helper.c:676:
+^Iuint8_t subpage_code = cdb[3];$

ERROR: code indent should never use tabs
#1186: FILE: tcmu/helper.c:677:
+^Isize_t alloc_len = tcmu_dev_get_max_xfer_len(dev);$

ERROR: code indent should never use tabs
#1187: FILE: tcmu/helper.c:678:
+^Iint i;$

ERROR: code indent should never use tabs
#1188: FILE: tcmu/helper.c:679:
+^Iint ret = 0;$

ERROR: code indent should never use tabs
#1189: FILE: tcmu/helper.c:680:
+^Isize_t hdr_len = select_ten ? 8 : 4;$

ERROR: code indent should never use tabs
#1190: FILE: tcmu/helper.c:681:
+^Iuint8_t buf[512];$

ERROR: code indent should never use tabs
#1191: FILE: tcmu/helper.c:682:
+^Iuint8_t in_buf[512];$

ERROR: code indent should never use tabs
#1192: FILE: tcmu/helper.c:683:
+^Ibool got_sense = false;$

ERROR: code indent should never use tabs
#1194: FILE: tcmu/helper.c:685:
+^Iif (!alloc_len)$

ERROR: braces {} are necessary for all arms of this statement
#1194: FILE: tcmu/helper.c:685:
+       if (!alloc_len)
[...]

ERROR: code indent should never use tabs
#1195: FILE: tcmu/helper.c:686:
+^I^Ireturn TCMU_STS_OK;$

ERROR: line over 90 characters
#1197: FILE: tcmu/helper.c:688:
+       if (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))

ERROR: code indent should never use tabs
#1197: FILE: tcmu/helper.c:688:
+^Iif (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))$

ERROR: braces {} are necessary for all arms of this statement
#1197: FILE: tcmu/helper.c:688:
+       if (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))
[...]

ERROR: code indent should never use tabs
#1198: FILE: tcmu/helper.c:689:
+^I^Ireturn TCMU_STS_INVALID_PARAM_LIST_LEN;$

ERROR: code indent should never use tabs
#1200: FILE: tcmu/helper.c:691:
+^I/* Abort if !pf or sp */$

ERROR: code indent should never use tabs
#1201: FILE: tcmu/helper.c:692:
+^Iif (!(cdb[1] & 0x10) || (cdb[1] & 0x01))$

ERROR: braces {} are necessary for all arms of this statement
#1201: FILE: tcmu/helper.c:692:
+       if (!(cdb[1] & 0x10) || (cdb[1] & 0x01))
[...]

ERROR: code indent should never use tabs
#1202: FILE: tcmu/helper.c:693:
+^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1204: FILE: tcmu/helper.c:695:
+^Imemset(buf, 0, sizeof(buf));$

ERROR: code indent should never use tabs
#1205: FILE: tcmu/helper.c:696:
+^Ifor (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {$

ERROR: code indent should never use tabs
#1206: FILE: tcmu/helper.c:697:
+^I^Iif (page_code == modesense_handlers[i].page$

ERROR: code indent should never use tabs
#1207: FILE: tcmu/helper.c:698:
+^I^I    && subpage_code == modesense_handlers[i].subpage) {$

ERROR: code indent should never use tabs
#1208: FILE: tcmu/helper.c:699:
+^I^I^Iret = modesense_handlers[i].get(dev, &buf[hdr_len],$

ERROR: code indent should never use tabs
#1209: FILE: tcmu/helper.c:700:
+^I^I^I^I^I^I^Isizeof(buf) - hdr_len);$

ERROR: code indent should never use tabs
#1210: FILE: tcmu/helper.c:701:
+^I^I^Iif (ret <= 0)$

ERROR: braces {} are necessary for all arms of this statement
#1210: FILE: tcmu/helper.c:701:
+                       if (ret <= 0)
[...]

ERROR: code indent should never use tabs
#1211: FILE: tcmu/helper.c:702:
+^I^I^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1213: FILE: tcmu/helper.c:704:
+^I^I^Iif  (!select_ten && (hdr_len + ret >= 255))$

ERROR: braces {} are necessary for all arms of this statement
#1213: FILE: tcmu/helper.c:704:
+                       if  (!select_ten && (hdr_len + ret >= 255))
[...]

ERROR: code indent should never use tabs
#1214: FILE: tcmu/helper.c:705:
+^I^I^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1216: FILE: tcmu/helper.c:707:
+^I^I^Igot_sense = true;$

ERROR: code indent should never use tabs
#1217: FILE: tcmu/helper.c:708:
+^I^I^Ibreak;$

ERROR: code indent should never use tabs
#1218: FILE: tcmu/helper.c:709:
+^I^I}$

ERROR: code indent should never use tabs
#1219: FILE: tcmu/helper.c:710:
+^I}$

ERROR: code indent should never use tabs
#1221: FILE: tcmu/helper.c:712:
+^Iif (!got_sense)$

ERROR: braces {} are necessary for all arms of this statement
#1221: FILE: tcmu/helper.c:712:
+       if (!got_sense)
[...]

ERROR: code indent should never use tabs
#1222: FILE: tcmu/helper.c:713:
+^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1224: FILE: tcmu/helper.c:715:
+^Iif (alloc_len < (hdr_len + ret))$

ERROR: braces {} are necessary for all arms of this statement
#1224: FILE: tcmu/helper.c:715:
+       if (alloc_len < (hdr_len + ret))
[...]

ERROR: code indent should never use tabs
#1225: FILE: tcmu/helper.c:716:
+^I^Ireturn TCMU_STS_INVALID_PARAM_LIST_LEN;$

ERROR: code indent should never use tabs
#1227: FILE: tcmu/helper.c:718:
+^I/* Verify what was selected is identical to what sense returns, since we$

WARNING: Block comments use a leading /* on a separate line
#1227: FILE: tcmu/helper.c:718:
+       /* Verify what was selected is identical to what sense returns, since we

ERROR: code indent should never use tabs
#1228: FILE: tcmu/helper.c:719:
+^I   don't support actually setting anything. */$

WARNING: Block comments use * on subsequent lines
#1228: FILE: tcmu/helper.c:719:
+       /* Verify what was selected is identical to what sense returns, since we
+          don't support actually setting anything. */

WARNING: Block comments use a trailing */ on a separate line
#1228: FILE: tcmu/helper.c:719:
+          don't support actually setting anything. */

ERROR: code indent should never use tabs
#1229: FILE: tcmu/helper.c:720:
+^Iif (memcmp(&buf[hdr_len], &in_buf[hdr_len], ret))$

ERROR: braces {} are necessary for all arms of this statement
#1229: FILE: tcmu/helper.c:720:
+       if (memcmp(&buf[hdr_len], &in_buf[hdr_len], ret))
[...]

ERROR: code indent should never use tabs
#1230: FILE: tcmu/helper.c:721:
+^I^Ireturn TCMU_STS_INVALID_PARAM_LIST;$

ERROR: code indent should never use tabs
#1232: FILE: tcmu/helper.c:723:
+^Ireturn TCMU_STS_OK;$

ERROR: code indent should never use tabs
#1237: FILE: tcmu/helper.c:728:
+^Iif ((cdb[4] >> 4) & 0xf)$

ERROR: braces {} are necessary for all arms of this statement
#1237: FILE: tcmu/helper.c:728:
+       if ((cdb[4] >> 4) & 0xf)
[...]

ERROR: code indent should never use tabs
#1238: FILE: tcmu/helper.c:729:
+^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1240: FILE: tcmu/helper.c:731:
+^I/* Currently, we don't allow ejecting the medium, so we're$

WARNING: Block comments use a leading /* on a separate line
#1240: FILE: tcmu/helper.c:731:
+       /* Currently, we don't allow ejecting the medium, so we're

ERROR: code indent should never use tabs
#1241: FILE: tcmu/helper.c:732:
+^I * ignoring the FBO_PREV_EJECT flag, but it may turn out that$

ERROR: code indent should never use tabs
#1242: FILE: tcmu/helper.c:733:
+^I * initiators do not handle this well, so we may have to change$

ERROR: code indent should never use tabs
#1243: FILE: tcmu/helper.c:734:
+^I * this behavior.$

ERROR: code indent should never use tabs
#1244: FILE: tcmu/helper.c:735:
+^I */$

ERROR: code indent should never use tabs
#1246: FILE: tcmu/helper.c:737:
+^Iif (!(cdb[4] & 0x01))$

ERROR: braces {} are necessary for all arms of this statement
#1246: FILE: tcmu/helper.c:737:
+       if (!(cdb[4] & 0x01))
[...]

ERROR: code indent should never use tabs
#1247: FILE: tcmu/helper.c:738:
+^I^Ireturn TCMU_STS_INVALID_CDB;$

ERROR: code indent should never use tabs
#1249: FILE: tcmu/helper.c:740:
+^Ireturn TCMU_STS_OK;$

WARNING: architecture specific defines should be avoided
#1269: FILE: tcmu/helper.h:13:
+#ifndef __TCMU_HELPER_H

ERROR: line over 90 characters
#1275: FILE: tcmu/helper.h:19:
+int tcmu_emulate_inquiry(struct tcmu_device *dev, uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);

WARNING: line over 80 characters
#1277: FILE: tcmu/helper.h:21:
+int tcmu_emulate_test_unit_ready(uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);

WARNING: line over 80 characters
#1278: FILE: tcmu/helper.h:22:
+int tcmu_emulate_read_capacity_10(uint64_t num_lbas, uint32_t block_size, uint8_t *cdb,

ERROR: code indent should never use tabs
#1279: FILE: tcmu/helper.h:23:
+^I^I^I^I  struct iovec *iovec, size_t iov_cnt);$

WARNING: line over 80 characters
#1280: FILE: tcmu/helper.h:24:
+int tcmu_emulate_read_capacity_16(uint64_t num_lbas, uint32_t block_size, uint8_t *cdb,

ERROR: code indent should never use tabs
#1281: FILE: tcmu/helper.h:25:
+^I^I^I^I  struct iovec *iovec, size_t iov_cnt);$

ERROR: code indent should never use tabs
#1283: FILE: tcmu/helper.h:27:
+^I^I^I    struct iovec *iovec, size_t iov_cnt);$

ERROR: code indent should never use tabs
#1285: FILE: tcmu/helper.h:29:
+^I^I^I     struct iovec *iovec, size_t iov_cnt);$

WARNING: Block comments use a leading /* on a separate line
#1514: FILE: tcmu/tcmu.c:221:
+        { /* end of list */ }

WARNING: Block comments use a leading /* on a separate line
#1523: FILE: tcmu/tcmu.c:230:
+        { /* end of list */ }

ERROR: do not use assignment in if condition
#1590: FILE: tcmu/tcmu.c:297:
+    if ((aio = qemu_opt_get(common_opts, "aio")) != NULL) {

ERROR: do not use assignment in if condition
#1602: FILE: tcmu/tcmu.c:309:
+    if ((buf = qemu_opt_get(common_opts, "format")) != NULL) {

ERROR: braces {} are necessary for all arms of this statement
#1617: FILE: tcmu/tcmu.c:324:
+    if (read_only)
[...]

WARNING: Block comments use a leading /* on a separate line
#1620: FILE: tcmu/tcmu.c:327:
+    /* bdrv_open() defaults to the values in bdrv_flags (for compatibility

WARNING: Block comments use a trailing */ on a separate line
#1622: FILE: tcmu/tcmu.c:329:
+     * Apply the defaults here instead. */

ERROR: space required before the open parenthesis '('
#1712: FILE: tcmu/tcmu.c:419:
+    if(exp)

ERROR: braces {} are necessary for all arms of this statement
#1712: FILE: tcmu/tcmu.c:419:
+    if(exp)
[...]

ERROR: code indent should never use tabs
#1761: FILE: tcmu/tcmu.c:468:
+^Iid = device;$

ERROR: code indent should never use tabs
#1762: FILE: tcmu/tcmu.c:469:
+    ^Iblk = blk_by_name(id);$

ERROR: code indent should never use tabs
#1763: FILE: tcmu/tcmu.c:470:
+    ^Iif (!blk) {$

ERROR: code indent should never use tabs
#1764: FILE: tcmu/tcmu.c:471:
+        ^Ierror_setg(errp, "TCMU: Device not found: %s", id);$

ERROR: code indent should never use tabs
#1765: FILE: tcmu/tcmu.c:472:
+        ^Ireturn false;$

ERROR: code indent should never use tabs
#1766: FILE: tcmu/tcmu.c:473:
+    ^I}$

ERROR: code indent should never use tabs
#1767: FILE: tcmu/tcmu.c:474:
+    ^Iexp = tcmu_export_lookup(blk);$

ERROR: code indent should never use tabs
#1768: FILE: tcmu/tcmu.c:475:
+    ^Iif (!exp) {$

ERROR: code indent should never use tabs
#1769: FILE: tcmu/tcmu.c:476:
+        ^Ierror_setg(errp, "TCMU: Device not found: %s", id);$

ERROR: code indent should never use tabs
#1770: FILE: tcmu/tcmu.c:477:
+        ^Ireturn false;$

ERROR: code indent should never use tabs
#1771: FILE: tcmu/tcmu.c:478:
+   ^I}$

ERROR: do not use C99 // comments
#1772: FILE: tcmu/tcmu.c:479:
+    }// TODO: else to check id?

ERROR: code indent should never use tabs
#1780: FILE: tcmu/tcmu.c:487:
+^Iif (*opts == '@') {$

ERROR: braces {} are necessary for all arms of this statement
#1780: FILE: tcmu/tcmu.c:487:
+       if (*opts == '@') {
[...]
+       } else
[...]

ERROR: code indent should never use tabs
#1781: FILE: tcmu/tcmu.c:488:
+^I    *to = ',';$

ERROR: code indent should never use tabs
#1782: FILE: tcmu/tcmu.c:489:
+^I} else$

ERROR: code indent should never use tabs
#1783: FILE: tcmu/tcmu.c:490:
+^I    *to = *opts;$

ERROR: code indent should never use tabs
#1785: FILE: tcmu/tcmu.c:492:
+^Iopts++;$

ERROR: code indent should never use tabs
#1786: FILE: tcmu/tcmu.c:493:
+^Ito++;$

ERROR: space required before the open parenthesis '('
#1789: FILE: tcmu/tcmu.c:496:
+    if(to)

ERROR: braces {} are necessary for all arms of this statement
#1789: FILE: tcmu/tcmu.c:496:
+    if(to)
[...]

ERROR: code indent should never use tabs
#1806: FILE: tcmu/tcmu.c:513:
+    ^Iid = device;$

ERROR: code indent should never use tabs
#1807: FILE: tcmu/tcmu.c:514:
+    ^Iexp = tcmu_export_lookup(blk_by_name(id));$

ERROR: else should follow close brace '}'
#1809: FILE: tcmu/tcmu.c:516:
+    }
+    else {

ERROR: code indent should never use tabs
#1810: FILE: tcmu/tcmu.c:517:
+^IQemuOpts * export_opts;$

ERROR: "foo * bar" should be "foo *bar"
#1810: FILE: tcmu/tcmu.c:517:
+       QemuOpts * export_opts;

ERROR: code indent should never use tabs
#1812: FILE: tcmu/tcmu.c:519:
+^Inew_device = g_malloc0(strlen(device) + 1);$

ERROR: code indent should never use tabs
#1813: FILE: tcmu/tcmu.c:520:
+^Itcmu_convert_delim(new_device, device);$

WARNING: Block comments use a leading /* on a separate line
#1815: FILE: tcmu/tcmu.c:522:
+        /* parse new_device into an QemuOpts and link into

WARNING: Block comments use * on subsequent lines
#1816: FILE: tcmu/tcmu.c:523:
+        /* parse new_device into an QemuOpts and link into
+           qemu_tcmu_export_opts with QemuOpts->id set while

ERROR: code indent should never use tabs
#1819: FILE: tcmu/tcmu.c:526:
+^Iexport_opts = qemu_opts_parse_noisily(&qemu_tcmu_export_opts,$

ERROR: code indent should never use tabs
#1820: FILE: tcmu/tcmu.c:527:
+^I^I^I^I^I    new_device, false);$

ERROR: space required before the open parenthesis '('
#1824: FILE: tcmu/tcmu.c:531:
+        if(!export_opts)

ERROR: braces {} are necessary for all arms of this statement
#1824: FILE: tcmu/tcmu.c:531:
+        if(!export_opts)
[...]

ERROR: code indent should never use tabs
#1827: FILE: tcmu/tcmu.c:534:
+^Iif (export_init_func(NULL, export_opts, NULL))$

ERROR: braces {} are necessary for all arms of this statement
#1827: FILE: tcmu/tcmu.c:534:
+       if (export_init_func(NULL, export_opts, NULL))
[...]

ERROR: code indent should never use tabs
#1828: FILE: tcmu/tcmu.c:535:
+^I    goto fail;$

ERROR: code indent should never use tabs
#1830: FILE: tcmu/tcmu.c:537:
+^Iid = qemu_opts_id(export_opts);$

ERROR: code indent should never use tabs
#1831: FILE: tcmu/tcmu.c:538:
+^Iexp = tcmu_export_lookup(blk_by_name(id));$

total: 620 errors, 26 warnings, 1809 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility
  2018-12-26  8:19 ` no-reply
@ 2019-01-02  1:53   ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2019-01-02  1:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: fam, qemu-block, famz, atumball, mchristi, pkalever, pbonzini

Ping.

BTW, it should be update docker image to install glib to fix this.

On Wed, Dec 26, 2018 at 12:19:48AM -0800, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com/
> 
> 
> 
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Message-id: 1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com
> Type: series
> Subject: [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> 
> BASE=base
> n=1
> total=$(git log --oneline $BASE.. | wc -l)
> failed=0
> 
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> 
> commits="$(git log --format=%H --reverse $BASE..)"
> for c in $commits; do
>     echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
>     if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
>         failed=1
>         echo
>     fi
>     n=$((n+1))
> done
> 
> exit $failed
> === TEST SCRIPT END ===
> 
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> Switched to a new branch 'test'
> 52869e1 tcmu: Introduce qemu-tcmu utility
> 
> === OUTPUT BEGIN ===
> Checking PATCH 1/1: tcmu: Introduce qemu-tcmu utility...
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #157: 
> new file mode 100644
> 
> ERROR: trailing whitespace
> #329: FILE: qemu-tcmu.c:51:
> +"Usage:\n" $
> 
> WARNING: Block comments use a leading /* on a separate line
> #466: FILE: qemu-tcmu.c:188:
> +    /* now when the initialization is (almost) complete, chdir("/")
> 
> WARNING: Block comments use a trailing */ on a separate line
> #467: FILE: qemu-tcmu.c:189:
> +     * to free any busy filesystems */
> 
> ERROR: code indent should never use tabs
> #525: FILE: tcmu/helper.c:16:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #526: FILE: tcmu/helper.c:17:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #527: FILE: tcmu/helper.c:18:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #529: FILE: tcmu/helper.c:20:
> +^Iuint8_t buf[36];$
> 
> ERROR: code indent should never use tabs
> #531: FILE: tcmu/helper.c:22:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #533: FILE: tcmu/helper.c:24:
> +^Ibuf[2] = 0x05; /* SPC-3 */$
> 
> ERROR: code indent should never use tabs
> #534: FILE: tcmu/helper.c:25:
> +^Ibuf[3] = 0x02; /* response data format */$
> 
> ERROR: code indent should never use tabs
> #536: FILE: tcmu/helper.c:27:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #537: FILE: tcmu/helper.c:28:
> +^I * A Third-Party Copy (3PC)$
> 
> ERROR: code indent should never use tabs
> #538: FILE: tcmu/helper.c:29:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #539: FILE: tcmu/helper.c:30:
> +^I * Enable the XCOPY$
> 
> ERROR: code indent should never use tabs
> #540: FILE: tcmu/helper.c:31:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #541: FILE: tcmu/helper.c:32:
> +^Ibuf[5] = 0x08;$
> 
> ERROR: code indent should never use tabs
> #543: FILE: tcmu/helper.c:34:
> +^Ibuf[7] = 0x02; /* CmdQue */$
> 
> ERROR: code indent should never use tabs
> #545: FILE: tcmu/helper.c:36:
> +^Imemcpy(&buf[8], "LIO-ORG ", 8);$
> 
> ERROR: code indent should never use tabs
> #546: FILE: tcmu/helper.c:37:
> +^Imemset(&buf[16], 0x20, 16);$
> 
> ERROR: code indent should never use tabs
> #547: FILE: tcmu/helper.c:38:
> +^Imemcpy(&buf[16], "TCMU device", 11);$
> 
> ERROR: code indent should never use tabs
> #548: FILE: tcmu/helper.c:39:
> +^Imemcpy(&buf[32], "0002", 4);$
> 
> ERROR: code indent should never use tabs
> #549: FILE: tcmu/helper.c:40:
> +^Ibuf[4] = 31; /* Set additional length to 31 */$
> 
> ERROR: code indent should never use tabs
> #551: FILE: tcmu/helper.c:42:
> +^Itcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #552: FILE: tcmu/helper.c:43:
> +^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #558: FILE: tcmu/helper.c:49:
> +^Iif (c >= '0' && c <= '9') {$
> 
> ERROR: code indent should never use tabs
> #559: FILE: tcmu/helper.c:50:
> +^I^I*val = c - '0';$
> 
> ERROR: code indent should never use tabs
> #560: FILE: tcmu/helper.c:51:
> +^I^Ireturn true;$
> 
> ERROR: code indent should never use tabs
> #561: FILE: tcmu/helper.c:52:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #562: FILE: tcmu/helper.c:53:
> +^Iif (c >= 'a' && c <= 'f') {$
> 
> ERROR: code indent should never use tabs
> #563: FILE: tcmu/helper.c:54:
> +^I^I*val = c - 'a' + 10;$
> 
> ERROR: code indent should never use tabs
> #564: FILE: tcmu/helper.c:55:
> +^I^Ireturn true;$
> 
> ERROR: code indent should never use tabs
> #565: FILE: tcmu/helper.c:56:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #566: FILE: tcmu/helper.c:57:
> +^Iif (c >= 'A' && c <= 'F') {$
> 
> ERROR: code indent should never use tabs
> #567: FILE: tcmu/helper.c:58:
> +^I^I*val = c - 'A' + 10;$
> 
> ERROR: code indent should never use tabs
> #568: FILE: tcmu/helper.c:59:
> +^I^Ireturn true;$
> 
> ERROR: code indent should never use tabs
> #569: FILE: tcmu/helper.c:60:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #570: FILE: tcmu/helper.c:61:
> +^Ireturn false;$
> 
> ERROR: code indent should never use tabs
> #574: FILE: tcmu/helper.c:65:
> +^Istruct tcmu_device *dev,$
> 
> ERROR: code indent should never use tabs
> #575: FILE: tcmu/helper.c:66:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #576: FILE: tcmu/helper.c:67:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #577: FILE: tcmu/helper.c:68:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #579: FILE: tcmu/helper.c:70:
> +^Iswitch (cdb[2]) {$
> 
> ERROR: code indent should never use tabs
> #580: FILE: tcmu/helper.c:71:
> +^Icase 0x0: /* Supported VPD pages */$
> 
> ERROR: code indent should never use tabs
> #581: FILE: tcmu/helper.c:72:
> +^I{$
> 
> ERROR: code indent should never use tabs
> #582: FILE: tcmu/helper.c:73:
> +^I^Ichar data[16];$
> 
> ERROR: code indent should never use tabs
> #584: FILE: tcmu/helper.c:75:
> +^I^Imemset(data, 0, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #586: FILE: tcmu/helper.c:77:
> +^I^I/* data[1] (page code) already 0 */$
> 
> ERROR: code indent should never use tabs
> #587: FILE: tcmu/helper.c:78:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #588: FILE: tcmu/helper.c:79:
> +^I^I  *  spc4r22 7.7.13 The supported VPD page list shall contain$
> 
> WARNING: Block comments should align the * on each line
> #588: FILE: tcmu/helper.c:79:
> +               /*
> +                 *  spc4r22 7.7.13 The supported VPD page list shall contain
> 
> ERROR: code indent should never use tabs
> #589: FILE: tcmu/helper.c:80:
> +^I^I  *  a list of all VPD page codes (see 7.7) implemented by the$
> 
> WARNING: line over 80 characters
> #590: FILE: tcmu/helper.c:81:
> +                 *  logical unit in ascending order beginning with page code 00h
> 
> ERROR: code indent should never use tabs
> #590: FILE: tcmu/helper.c:81:
> +^I^I  *  logical unit in ascending order beginning with page code 00h$
> 
> ERROR: code indent should never use tabs
> #591: FILE: tcmu/helper.c:82:
> +^I^I  */$
> 
> ERROR: code indent should never use tabs
> #592: FILE: tcmu/helper.c:83:
> +^I^Idata[4] = 0x00;$
> 
> ERROR: code indent should never use tabs
> #593: FILE: tcmu/helper.c:84:
> +^I^Idata[5] = 0x80;$
> 
> ERROR: code indent should never use tabs
> #594: FILE: tcmu/helper.c:85:
> +^I^Idata[6] = 0x83;$
> 
> ERROR: code indent should never use tabs
> #595: FILE: tcmu/helper.c:86:
> +^I^Idata[7] = 0xb0;$
> 
> ERROR: code indent should never use tabs
> #596: FILE: tcmu/helper.c:87:
> +^I^Idata[8] = 0xb1;$
> 
> ERROR: code indent should never use tabs
> #597: FILE: tcmu/helper.c:88:
> +^I^Idata[9] = 0xb2;$
> 
> ERROR: code indent should never use tabs
> #599: FILE: tcmu/helper.c:90:
> +^I^Idata[3] = 6;$
> 
> ERROR: code indent should never use tabs
> #601: FILE: tcmu/helper.c:92:
> +^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #602: FILE: tcmu/helper.c:93:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #603: FILE: tcmu/helper.c:94:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #604: FILE: tcmu/helper.c:95:
> +^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #605: FILE: tcmu/helper.c:96:
> +^Icase 0x80: /* Unit Serial Number */$
> 
> ERROR: code indent should never use tabs
> #606: FILE: tcmu/helper.c:97:
> +^I{$
> 
> ERROR: code indent should never use tabs
> #607: FILE: tcmu/helper.c:98:
> +^I^Ichar data[512];$
> 
> ERROR: code indent should never use tabs
> #608: FILE: tcmu/helper.c:99:
> +^I^Ichar *wwn;$
> 
> ERROR: code indent should never use tabs
> #609: FILE: tcmu/helper.c:100:
> +^I^Iuint32_t len;$
> 
> ERROR: code indent should never use tabs
> #611: FILE: tcmu/helper.c:102:
> +^I^Imemset(data, 0, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #613: FILE: tcmu/helper.c:104:
> +^I^Idata[1] = 0x80;$
> 
> ERROR: code indent should never use tabs
> #615: FILE: tcmu/helper.c:106:
> +^I^Iwwn = tcmu_cfgfs_dev_get_wwn(dev);$
> 
> ERROR: code indent should never use tabs
> #616: FILE: tcmu/helper.c:107:
> +^I^Iif (!wwn)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #616: FILE: tcmu/helper.c:107:
> +               if (!wwn)
> [...]
> 
> ERROR: code indent should never use tabs
> #617: FILE: tcmu/helper.c:108:
> +^I^I^Ireturn TCMU_STS_HW_ERR;$
> 
> ERROR: code indent should never use tabs
> #619: FILE: tcmu/helper.c:110:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #620: FILE: tcmu/helper.c:111:
> +^I^I * The maximum length of the unit_serial has limited$
> 
> ERROR: code indent should never use tabs
> #621: FILE: tcmu/helper.c:112:
> +^I^I * to 254 Bytes in kernel, so here limit to 256 Bytes$
> 
> ERROR: code indent should never use tabs
> #622: FILE: tcmu/helper.c:113:
> +^I^I * will be enough.$
> 
> ERROR: code indent should never use tabs
> #623: FILE: tcmu/helper.c:114:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #624: FILE: tcmu/helper.c:115:
> +^I^Ilen = snprintf(&data[4], 256, "%s", wwn);$
> 
> ERROR: code indent should never use tabs
> #625: FILE: tcmu/helper.c:116:
> +^I^Idata[3] = len + 1;$
> 
> ERROR: code indent should never use tabs
> #627: FILE: tcmu/helper.c:118:
> +^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #629: FILE: tcmu/helper.c:120:
> +^I^Ifree(wwn);$
> 
> ERROR: code indent should never use tabs
> #630: FILE: tcmu/helper.c:121:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #631: FILE: tcmu/helper.c:122:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #632: FILE: tcmu/helper.c:123:
> +^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #633: FILE: tcmu/helper.c:124:
> +^Icase 0x83: /* Device identification */$
> 
> ERROR: code indent should never use tabs
> #634: FILE: tcmu/helper.c:125:
> +^I{$
> 
> ERROR: code indent should never use tabs
> #635: FILE: tcmu/helper.c:126:
> +^I^Ichar data[512];$
> 
> ERROR: code indent should never use tabs
> #636: FILE: tcmu/helper.c:127:
> +^I^Ichar *ptr, *p, *wwn;$
> 
> ERROR: code indent should never use tabs
> #637: FILE: tcmu/helper.c:128:
> +^I^Isize_t len, used = 0;$
> 
> ERROR: code indent should never use tabs
> #638: FILE: tcmu/helper.c:129:
> +^I^Iuint16_t *tot_len = (uint16_t*) &data[2];$
> 
> ERROR: "(foo*)" should be "(foo *)"
> #638: FILE: tcmu/helper.c:129:
> +               uint16_t *tot_len = (uint16_t*) &data[2];
> 
> ERROR: code indent should never use tabs
> #639: FILE: tcmu/helper.c:130:
> +^I^Ibool next;$
> 
> ERROR: code indent should never use tabs
> #640: FILE: tcmu/helper.c:131:
> +^I^Iint i;$
> 
> ERROR: code indent should never use tabs
> #642: FILE: tcmu/helper.c:133:
> +^I^Imemset(data, 0, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #644: FILE: tcmu/helper.c:135:
> +^I^Idata[1] = 0x83;$
> 
> ERROR: code indent should never use tabs
> #646: FILE: tcmu/helper.c:137:
> +^I^Iwwn = tcmu_cfgfs_dev_get_wwn(dev);$
> 
> ERROR: code indent should never use tabs
> #647: FILE: tcmu/helper.c:138:
> +^I^Iif (!wwn)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #647: FILE: tcmu/helper.c:138:
> +               if (!wwn)
> [...]
> 
> ERROR: code indent should never use tabs
> #648: FILE: tcmu/helper.c:139:
> +^I^I^Ireturn TCMU_STS_HW_ERR;$
> 
> ERROR: code indent should never use tabs
> #650: FILE: tcmu/helper.c:141:
> +^I^Iptr = &data[4];$
> 
> ERROR: code indent should never use tabs
> #652: FILE: tcmu/helper.c:143:
> +^I^I/* 1/5: T10 Vendor id */$
> 
> ERROR: code indent should never use tabs
> #653: FILE: tcmu/helper.c:144:
> +^I^Iptr[0] = 2; /* code set: ASCII */$
> 
> ERROR: code indent should never use tabs
> #654: FILE: tcmu/helper.c:145:
> +^I^Iptr[1] = 1; /* identifier: T10 vendor id */$
> 
> ERROR: code indent should never use tabs
> #655: FILE: tcmu/helper.c:146:
> +^I^Imemcpy(&ptr[4], "LIO-ORG ", 8);$
> 
> ERROR: code indent should never use tabs
> #656: FILE: tcmu/helper.c:147:
> +^I^Ilen = snprintf(&ptr[12], sizeof(data) - 16, "%s", wwn);$
> 
> ERROR: code indent should never use tabs
> #658: FILE: tcmu/helper.c:149:
> +^I^Iptr[3] = 8 + len + 1;$
> 
> ERROR: code indent should never use tabs
> #659: FILE: tcmu/helper.c:150:
> +^I^Iused += (uint8_t)ptr[3] + 4;$
> 
> ERROR: code indent should never use tabs
> #660: FILE: tcmu/helper.c:151:
> +^I^Iptr += used;$
> 
> ERROR: code indent should never use tabs
> #662: FILE: tcmu/helper.c:153:
> +^I^I/* 2/5: NAA binary */$
> 
> ERROR: code indent should never use tabs
> #663: FILE: tcmu/helper.c:154:
> +^I^Iptr[0] = 1; /* code set: binary */$
> 
> ERROR: code indent should never use tabs
> #664: FILE: tcmu/helper.c:155:
> +^I^Iptr[1] = 3; /* identifier: NAA */$
> 
> WARNING: line over 80 characters
> #665: FILE: tcmu/helper.c:156:
> +               ptr[3] = 16; /* body length for naa registered extended format */
> 
> ERROR: code indent should never use tabs
> #665: FILE: tcmu/helper.c:156:
> +^I^Iptr[3] = 16; /* body length for naa registered extended format */$
> 
> ERROR: code indent should never use tabs
> #667: FILE: tcmu/helper.c:158:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #668: FILE: tcmu/helper.c:159:
> +^I^I * Set type 6 and use OpenFabrics IEEE Company ID: 00 14 05$
> 
> ERROR: code indent should never use tabs
> #669: FILE: tcmu/helper.c:160:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #670: FILE: tcmu/helper.c:161:
> +^I^Iptr[4] = 0x60;$
> 
> ERROR: code indent should never use tabs
> #671: FILE: tcmu/helper.c:162:
> +^I^Iptr[5] = 0x01;$
> 
> ERROR: code indent should never use tabs
> #672: FILE: tcmu/helper.c:163:
> +^I^Iptr[6] = 0x40;$
> 
> ERROR: code indent should never use tabs
> #673: FILE: tcmu/helper.c:164:
> +^I^Iptr[7] = 0x50;$
> 
> ERROR: code indent should never use tabs
> #675: FILE: tcmu/helper.c:166:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #676: FILE: tcmu/helper.c:167:
> +^I^I * Fill in the rest with a binary representation of WWN$
> 
> ERROR: code indent should never use tabs
> #677: FILE: tcmu/helper.c:168:
> +^I^I *$
> 
> ERROR: code indent should never use tabs
> #678: FILE: tcmu/helper.c:169:
> +^I^I * This implementation only uses a nibble out of every byte of$
> 
> ERROR: code indent should never use tabs
> #679: FILE: tcmu/helper.c:170:
> +^I^I * WWN, but this is what the kernel does, and it's nice for our$
> 
> ERROR: code indent should never use tabs
> #680: FILE: tcmu/helper.c:171:
> +^I^I * values to match.$
> 
> ERROR: code indent should never use tabs
> #681: FILE: tcmu/helper.c:172:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #682: FILE: tcmu/helper.c:173:
> +^I^Inext = true;$
> 
> ERROR: code indent should never use tabs
> #683: FILE: tcmu/helper.c:174:
> +^I^Ifor (p = wwn, i = 7; *p && i < 20; p++) {$
> 
> ERROR: code indent should never use tabs
> #684: FILE: tcmu/helper.c:175:
> +^I^I^Iuint8_t val;$
> 
> ERROR: code indent should never use tabs
> #686: FILE: tcmu/helper.c:177:
> +^I^I^Iif (!char_to_hex(&val, *p))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #686: FILE: tcmu/helper.c:177:
> +                       if (!char_to_hex(&val, *p))
> [...]
> 
> ERROR: code indent should never use tabs
> #687: FILE: tcmu/helper.c:178:
> +^I^I^I^Icontinue;$
> 
> ERROR: code indent should never use tabs
> #689: FILE: tcmu/helper.c:180:
> +^I^I^Iif (next) {$
> 
> ERROR: code indent should never use tabs
> #690: FILE: tcmu/helper.c:181:
> +^I^I^I^Inext = false;$
> 
> ERROR: code indent should never use tabs
> #691: FILE: tcmu/helper.c:182:
> +^I^I^I^Iptr[i++] |= val;$
> 
> ERROR: code indent should never use tabs
> #692: FILE: tcmu/helper.c:183:
> +^I^I^I} else {$
> 
> ERROR: code indent should never use tabs
> #693: FILE: tcmu/helper.c:184:
> +^I^I^I^Inext = true;$
> 
> ERROR: code indent should never use tabs
> #694: FILE: tcmu/helper.c:185:
> +^I^I^I^Iptr[i] = val << 4;$
> 
> ERROR: code indent should never use tabs
> #695: FILE: tcmu/helper.c:186:
> +^I^I^I}$
> 
> ERROR: code indent should never use tabs
> #696: FILE: tcmu/helper.c:187:
> +^I^I}$
> 
> ERROR: code indent should never use tabs
> #698: FILE: tcmu/helper.c:189:
> +^I^Iused += 20;$
> 
> ERROR: code indent should never use tabs
> #699: FILE: tcmu/helper.c:190:
> +^I^Iptr += 20;$
> 
> ERROR: code indent should never use tabs
> #701: FILE: tcmu/helper.c:192:
> +^I^I/* 3/6: Vendor specific */$
> 
> ERROR: code indent should never use tabs
> #702: FILE: tcmu/helper.c:193:
> +^I^Iptr[0] = 2; /* code set: ASCII */$
> 
> ERROR: code indent should never use tabs
> #703: FILE: tcmu/helper.c:194:
> +^I^Iptr[1] = 0; /* identifier: vendor-specific */$
> 
> ERROR: line over 90 characters
> #705: FILE: tcmu/helper.c:196:
> +               len = snprintf(&ptr[4], sizeof(data) - used - 4, "%s", tcmu_dev_get_cfgstring(dev));
> 
> ERROR: code indent should never use tabs
> #705: FILE: tcmu/helper.c:196:
> +^I^Ilen = snprintf(&ptr[4], sizeof(data) - used - 4, "%s", tcmu_dev_get_cfgstring(dev));$
> 
> ERROR: code indent should never use tabs
> #706: FILE: tcmu/helper.c:197:
> +^I^Iptr[3] = len + 1;$
> 
> ERROR: code indent should never use tabs
> #708: FILE: tcmu/helper.c:199:
> +^I^Iused += (uint8_t)ptr[3] + 4;$
> 
> ERROR: code indent should never use tabs
> #709: FILE: tcmu/helper.c:200:
> +^I^Iptr += (uint8_t)ptr[3] + 4;$
> 
> ERROR: code indent should never use tabs
> #711: FILE: tcmu/helper.c:202:
> +^I^I/* Done with descriptor list */$
> 
> ERROR: code indent should never use tabs
> #713: FILE: tcmu/helper.c:204:
> +^I^I*tot_len = htobe16(used);$
> 
> ERROR: code indent should never use tabs
> #715: FILE: tcmu/helper.c:206:
> +^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, used + 4);$
> 
> ERROR: code indent should never use tabs
> #717: FILE: tcmu/helper.c:208:
> +^I^Ifree(wwn);$
> 
> ERROR: code indent should never use tabs
> #718: FILE: tcmu/helper.c:209:
> +^I^Iwwn = NULL;$
> 
> ERROR: code indent should never use tabs
> #720: FILE: tcmu/helper.c:211:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #721: FILE: tcmu/helper.c:212:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #722: FILE: tcmu/helper.c:213:
> +^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #723: FILE: tcmu/helper.c:214:
> +^Icase 0xb0: /* Block Limits */$
> 
> ERROR: code indent should never use tabs
> #724: FILE: tcmu/helper.c:215:
> +^I{$
> 
> ERROR: code indent should never use tabs
> #725: FILE: tcmu/helper.c:216:
> +^I^Ichar data[64];$
> 
> ERROR: code indent should never use tabs
> #726: FILE: tcmu/helper.c:217:
> +^I^Iuint32_t max_xfer_length;$
> 
> ERROR: code indent should never use tabs
> #727: FILE: tcmu/helper.c:218:
> +^I^Iuint16_t val16;$
> 
> ERROR: code indent should never use tabs
> #728: FILE: tcmu/helper.c:219:
> +^I^Iuint32_t val32;$
> 
> ERROR: code indent should never use tabs
> #730: FILE: tcmu/helper.c:221:
> +^I^Imemset(data, 0, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #732: FILE: tcmu/helper.c:223:
> +^I^Idata[1] = 0xb0;$
> 
> ERROR: code indent should never use tabs
> #734: FILE: tcmu/helper.c:225:
> +^I^Ival16 = htobe16(0x3c);$
> 
> ERROR: code indent should never use tabs
> #735: FILE: tcmu/helper.c:226:
> +^I^Imemcpy(&data[2], &val16, 2);$
> 
> ERROR: code indent should never use tabs
> #737: FILE: tcmu/helper.c:228:
> +^I^I/* WSNZ = 1: the device server won't support a value of zero$
> 
> WARNING: Block comments use a leading /* on a separate line
> #737: FILE: tcmu/helper.c:228:
> +               /* WSNZ = 1: the device server won't support a value of zero
> 
> ERROR: code indent should never use tabs
> #738: FILE: tcmu/helper.c:229:
> +^I^I * in the NUMBER OF LOGICAL BLOCKS field in the WRITE SAME$
> 
> ERROR: code indent should never use tabs
> #739: FILE: tcmu/helper.c:230:
> +^I^I * command CDBs$
> 
> ERROR: code indent should never use tabs
> #740: FILE: tcmu/helper.c:231:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #741: FILE: tcmu/helper.c:232:
> +^I^Idata[4] = 0x01;$
> 
> ERROR: code indent should never use tabs
> #743: FILE: tcmu/helper.c:234:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #744: FILE: tcmu/helper.c:235:
> +^I^I * Daemons like runner may override the user requested$
> 
> ERROR: code indent should never use tabs
> #745: FILE: tcmu/helper.c:236:
> +^I^I * value due to device specific limits.$
> 
> ERROR: code indent should never use tabs
> #746: FILE: tcmu/helper.c:237:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #747: FILE: tcmu/helper.c:238:
> +^I^Imax_xfer_length = tcmu_dev_get_max_xfer_len(dev);$
> 
> ERROR: code indent should never use tabs
> #749: FILE: tcmu/helper.c:240:
> +^I^Ival32 = htobe32(max_xfer_length);$
> 
> ERROR: code indent should never use tabs
> #750: FILE: tcmu/helper.c:241:
> +^I^I/* Max xfer length */$
> 
> ERROR: code indent should never use tabs
> #751: FILE: tcmu/helper.c:242:
> +^I^Imemcpy(&data[8], &val32, 4);$
> 
> ERROR: code indent should never use tabs
> #752: FILE: tcmu/helper.c:243:
> +^I^I/* Optimal xfer length */$
> 
> ERROR: code indent should never use tabs
> #753: FILE: tcmu/helper.c:244:
> +^I^Imemcpy(&data[12], &val32, 4);$
> 
> ERROR: code indent should never use tabs
> #755: FILE: tcmu/helper.c:246:
> +^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #757: FILE: tcmu/helper.c:248:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #758: FILE: tcmu/helper.c:249:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #759: FILE: tcmu/helper.c:250:
> +^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #760: FILE: tcmu/helper.c:251:
> +^Icase 0xb1: /* Block Device Characteristics VPD page */$
> 
> ERROR: code indent should never use tabs
> #761: FILE: tcmu/helper.c:252:
> +^I{$
> 
> ERROR: code indent should never use tabs
> #762: FILE: tcmu/helper.c:253:
> +^I^Ichar data[64];$
> 
> ERROR: code indent should never use tabs
> #763: FILE: tcmu/helper.c:254:
> +^I^Iuint16_t val16;$
> 
> ERROR: code indent should never use tabs
> #765: FILE: tcmu/helper.c:256:
> +^I^Imemset(data, 0, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #767: FILE: tcmu/helper.c:258:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #768: FILE: tcmu/helper.c:259:
> +^I^I * From spc-5 Revision 14, section 6.7.2 Standard INQUIRY data$
> 
> ERROR: code indent should never use tabs
> #769: FILE: tcmu/helper.c:260:
> +^I^I * set the devive type to Direct access block device.$
> 
> ERROR: code indent should never use tabs
> #770: FILE: tcmu/helper.c:261:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #771: FILE: tcmu/helper.c:262:
> +^I^Idata[0] = 0x00;$
> 
> ERROR: code indent should never use tabs
> #773: FILE: tcmu/helper.c:264:
> +^I^I/* PAGE CODE (B1h) */$
> 
> ERROR: code indent should never use tabs
> #774: FILE: tcmu/helper.c:265:
> +^I^Idata[1] = 0xb1;$
> 
> ERROR: code indent should never use tabs
> #776: FILE: tcmu/helper.c:267:
> +^I^I/* PAGE LENGTH (003Ch)*/$
> 
> ERROR: code indent should never use tabs
> #777: FILE: tcmu/helper.c:268:
> +^I^Ival16 = htobe16(0x003c);$
> 
> ERROR: code indent should never use tabs
> #778: FILE: tcmu/helper.c:269:
> +^I^Imemcpy(&data[2], &val16, 2);$
> 
> ERROR: code indent should never use tabs
> #780: FILE: tcmu/helper.c:271:
> +^I^Iif (tcmu_dev_get_solid_state_media(dev)) {$
> 
> ERROR: code indent should never use tabs
> #781: FILE: tcmu/helper.c:272:
> +^I^I^Ival16 = htobe16(0x0001);$
> 
> ERROR: code indent should never use tabs
> #782: FILE: tcmu/helper.c:273:
> +^I^I^Imemcpy(&data[4], &val16, 2);$
> 
> ERROR: code indent should never use tabs
> #783: FILE: tcmu/helper.c:274:
> +^I^I}$
> 
> ERROR: code indent should never use tabs
> #785: FILE: tcmu/helper.c:276:
> +^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #786: FILE: tcmu/helper.c:277:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #787: FILE: tcmu/helper.c:278:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #788: FILE: tcmu/helper.c:279:
> +^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #789: FILE: tcmu/helper.c:280:
> +^Icase 0xb2: /* Logical Block Provisioning VPD page */$
> 
> ERROR: code indent should never use tabs
> #790: FILE: tcmu/helper.c:281:
> +^I{$
> 
> ERROR: code indent should never use tabs
> #791: FILE: tcmu/helper.c:282:
> +^I^Ichar data[64];$
> 
> ERROR: code indent should never use tabs
> #792: FILE: tcmu/helper.c:283:
> +^I^Iuint16_t val16;$
> 
> ERROR: code indent should never use tabs
> #794: FILE: tcmu/helper.c:285:
> +^I^Imemset(data, 0, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #796: FILE: tcmu/helper.c:287:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #797: FILE: tcmu/helper.c:288:
> +^I^I * From spc-5 Revision 14, section 6.7.2 Standard INQUIRY data$
> 
> ERROR: code indent should never use tabs
> #798: FILE: tcmu/helper.c:289:
> +^I^I * set the device type to Direct access block device.$
> 
> ERROR: code indent should never use tabs
> #799: FILE: tcmu/helper.c:290:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #800: FILE: tcmu/helper.c:291:
> +^I^Idata[0] = 0x00;$
> 
> ERROR: code indent should never use tabs
> #802: FILE: tcmu/helper.c:293:
> +^I^I/* PAGE CODE (B2h) */$
> 
> ERROR: code indent should never use tabs
> #803: FILE: tcmu/helper.c:294:
> +^I^Idata[1] = 0xb2;$
> 
> ERROR: code indent should never use tabs
> #805: FILE: tcmu/helper.c:296:
> +^I^I/*$
> 
> WARNING: line over 80 characters
> #806: FILE: tcmu/helper.c:297:
> +                * PAGE LENGTH field: PROVISIONING GROUP DESCRIPTOR field will be
> 
> ERROR: code indent should never use tabs
> #806: FILE: tcmu/helper.c:297:
> +^I^I * PAGE LENGTH field: PROVISIONING GROUP DESCRIPTOR field will be$
> 
> ERROR: code indent should never use tabs
> #807: FILE: tcmu/helper.c:298:
> +^I^I * not present.$
> 
> ERROR: code indent should never use tabs
> #808: FILE: tcmu/helper.c:299:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #809: FILE: tcmu/helper.c:300:
> +^I^Ival16 = htobe16(0x0004);$
> 
> ERROR: code indent should never use tabs
> #810: FILE: tcmu/helper.c:301:
> +^I^Imemcpy(&data[2], &val16, 2);$
> 
> ERROR: code indent should never use tabs
> #812: FILE: tcmu/helper.c:303:
> +^I^I/*$
> 
> ERROR: code indent should never use tabs
> #813: FILE: tcmu/helper.c:304:
> +^I^I * The logical block provisioning read zeros (LBPRZ) field.$
> 
> ERROR: code indent should never use tabs
> #814: FILE: tcmu/helper.c:305:
> +^I^I *$
> 
> WARNING: line over 80 characters
> #815: FILE: tcmu/helper.c:306:
> +                * The logical block data represented by unmapped LBAs is set to zeros
> 
> ERROR: code indent should never use tabs
> #815: FILE: tcmu/helper.c:306:
> +^I^I * The logical block data represented by unmapped LBAs is set to zeros$
> 
> ERROR: code indent should never use tabs
> #816: FILE: tcmu/helper.c:307:
> +^I^I */$
> 
> ERROR: code indent should never use tabs
> #817: FILE: tcmu/helper.c:308:
> +^I^Idata[5] = 0x04;$
> 
> ERROR: code indent should never use tabs
> #819: FILE: tcmu/helper.c:310:
> +^I^Itcmu_memcpy_into_iovec(iovec, iov_cnt, data, sizeof(data));$
> 
> ERROR: code indent should never use tabs
> #820: FILE: tcmu/helper.c:311:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #821: FILE: tcmu/helper.c:312:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #822: FILE: tcmu/helper.c:313:
> +^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #823: FILE: tcmu/helper.c:314:
> +^Idefault:$
> 
> ERROR: code indent should never use tabs
> #824: FILE: tcmu/helper.c:315:
> +^I^Ierror_report("Vital product data page code 0x%x not support\n",$
> 
> ERROR: Error messages should not contain newlines
> #824: FILE: tcmu/helper.c:315:
> +               error_report("Vital product data page code 0x%x not support\n",
> 
> ERROR: code indent should never use tabs
> #825: FILE: tcmu/helper.c:316:
> +^I^I^I     cdb[2]);$
> 
> ERROR: code indent should never use tabs
> #826: FILE: tcmu/helper.c:317:
> +^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #827: FILE: tcmu/helper.c:318:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #834: FILE: tcmu/helper.c:325:
> +^Istruct tcmu_device *dev,$
> 
> ERROR: code indent should never use tabs
> #835: FILE: tcmu/helper.c:326:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #836: FILE: tcmu/helper.c:327:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #837: FILE: tcmu/helper.c:328:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #839: FILE: tcmu/helper.c:330:
> +^Iif (!(cdb[1] & 0x01)) {$
> 
> ERROR: code indent should never use tabs
> #840: FILE: tcmu/helper.c:331:
> +^I^Iif (!cdb[2])$
> 
> ERROR: code indent should never use tabs
> #841: FILE: tcmu/helper.c:332:
> +^I^I^Ireturn tcmu_emulate_std_inquiry(cdb, iovec,$
> 
> ERROR: code indent should never use tabs
> #842: FILE: tcmu/helper.c:333:
> +^I^I^I^I^I^I^Iiov_cnt);$
> 
> ERROR: code indent should never use tabs
> #843: FILE: tcmu/helper.c:334:
> +^I^Ielse$
> 
> ERROR: code indent should never use tabs
> #844: FILE: tcmu/helper.c:335:
> +^I^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #845: FILE: tcmu/helper.c:336:
> +^I} else {$
> 
> ERROR: code indent should never use tabs
> #846: FILE: tcmu/helper.c:337:
> +^I^Ireturn tcmu_emulate_evpd_inquiry(dev, cdb, iovec, iov_cnt);$
> 
> ERROR: code indent should never use tabs
> #847: FILE: tcmu/helper.c:338:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #851: FILE: tcmu/helper.c:342:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #852: FILE: tcmu/helper.c:343:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #853: FILE: tcmu/helper.c:344:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #855: FILE: tcmu/helper.c:346:
> +^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #859: FILE: tcmu/helper.c:350:
> +^Iuint64_t num_lbas,$
> 
> ERROR: code indent should never use tabs
> #860: FILE: tcmu/helper.c:351:
> +^Iuint32_t block_size,$
> 
> ERROR: code indent should never use tabs
> #861: FILE: tcmu/helper.c:352:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #862: FILE: tcmu/helper.c:353:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #863: FILE: tcmu/helper.c:354:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #865: FILE: tcmu/helper.c:356:
> +^Iuint8_t buf[8];$
> 
> ERROR: code indent should never use tabs
> #866: FILE: tcmu/helper.c:357:
> +^Iuint32_t val32;$
> 
> ERROR: code indent should never use tabs
> #868: FILE: tcmu/helper.c:359:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #870: FILE: tcmu/helper.c:361:
> +^Iif (num_lbas < 0x100000000ULL) {$
> 
> ERROR: code indent should never use tabs
> #871: FILE: tcmu/helper.c:362:
> +^I^I// Return the LBA of the last logical block, so subtract 1.$
> 
> ERROR: do not use C99 // comments
> #871: FILE: tcmu/helper.c:362:
> +               // Return the LBA of the last logical block, so subtract 1.
> 
> ERROR: code indent should never use tabs
> #872: FILE: tcmu/helper.c:363:
> +^I^Ival32 = htobe32(num_lbas-1);$
> 
> ERROR: spaces required around that '-' (ctx:VxV)
> #872: FILE: tcmu/helper.c:363:
> +               val32 = htobe32(num_lbas-1);
>                                         ^
> 
> ERROR: code indent should never use tabs
> #873: FILE: tcmu/helper.c:364:
> +^I} else {$
> 
> ERROR: code indent should never use tabs
> #874: FILE: tcmu/helper.c:365:
> +^I^I// This lets the initiator know that he needs to use$
> 
> ERROR: do not use C99 // comments
> #874: FILE: tcmu/helper.c:365:
> +               // This lets the initiator know that he needs to use
> 
> ERROR: code indent should never use tabs
> #875: FILE: tcmu/helper.c:366:
> +^I^I// Read Capacity(16).$
> 
> ERROR: do not use C99 // comments
> #875: FILE: tcmu/helper.c:366:
> +               // Read Capacity(16).
> 
> ERROR: code indent should never use tabs
> #876: FILE: tcmu/helper.c:367:
> +^I^Ival32 = 0xffffffff;$
> 
> ERROR: code indent should never use tabs
> #877: FILE: tcmu/helper.c:368:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #879: FILE: tcmu/helper.c:370:
> +^Imemcpy(&buf[0], &val32, 4);$
> 
> ERROR: code indent should never use tabs
> #881: FILE: tcmu/helper.c:372:
> +^Ival32 = htobe32(block_size);$
> 
> ERROR: code indent should never use tabs
> #882: FILE: tcmu/helper.c:373:
> +^Imemcpy(&buf[4], &val32, 4);$
> 
> ERROR: code indent should never use tabs
> #884: FILE: tcmu/helper.c:375:
> +^I/* all else is zero */$
> 
> ERROR: code indent should never use tabs
> #886: FILE: tcmu/helper.c:377:
> +^Itcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #888: FILE: tcmu/helper.c:379:
> +^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #892: FILE: tcmu/helper.c:383:
> +^Iuint64_t num_lbas,$
> 
> ERROR: code indent should never use tabs
> #893: FILE: tcmu/helper.c:384:
> +^Iuint32_t block_size,$
> 
> ERROR: code indent should never use tabs
> #894: FILE: tcmu/helper.c:385:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #895: FILE: tcmu/helper.c:386:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #896: FILE: tcmu/helper.c:387:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #898: FILE: tcmu/helper.c:389:
> +^Iuint8_t buf[32];$
> 
> ERROR: code indent should never use tabs
> #899: FILE: tcmu/helper.c:390:
> +^Iuint64_t val64;$
> 
> ERROR: code indent should never use tabs
> #900: FILE: tcmu/helper.c:391:
> +^Iuint32_t val32;$
> 
> ERROR: code indent should never use tabs
> #902: FILE: tcmu/helper.c:393:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #904: FILE: tcmu/helper.c:395:
> +^I// Return the LBA of the last logical block, so subtract 1.$
> 
> ERROR: do not use C99 // comments
> #904: FILE: tcmu/helper.c:395:
> +       // Return the LBA of the last logical block, so subtract 1.
> 
> ERROR: code indent should never use tabs
> #905: FILE: tcmu/helper.c:396:
> +^Ival64 = htobe64(num_lbas-1);$
> 
> ERROR: spaces required around that '-' (ctx:VxV)
> #905: FILE: tcmu/helper.c:396:
> +       val64 = htobe64(num_lbas-1);
>                                 ^
> 
> ERROR: code indent should never use tabs
> #906: FILE: tcmu/helper.c:397:
> +^Imemcpy(&buf[0], &val64, 8);$
> 
> ERROR: code indent should never use tabs
> #908: FILE: tcmu/helper.c:399:
> +^Ival32 = htobe32(block_size);$
> 
> ERROR: code indent should never use tabs
> #909: FILE: tcmu/helper.c:400:
> +^Imemcpy(&buf[8], &val32, 4);$
> 
> ERROR: code indent should never use tabs
> #911: FILE: tcmu/helper.c:402:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #912: FILE: tcmu/helper.c:403:
> +^I * Logical Block Provisioning Management Enabled (LBPME) bit$
> 
> ERROR: code indent should never use tabs
> #913: FILE: tcmu/helper.c:404:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #914: FILE: tcmu/helper.c:405:
> +^I * The LBPME bit sets to one and then the logical unit implements$
> 
> ERROR: code indent should never use tabs
> #915: FILE: tcmu/helper.c:406:
> +^I * logical block provisioning management$
> 
> ERROR: code indent should never use tabs
> #916: FILE: tcmu/helper.c:407:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #917: FILE: tcmu/helper.c:408:
> +^Ibuf[14] = 0x80;$
> 
> ERROR: code indent should never use tabs
> #919: FILE: tcmu/helper.c:410:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #920: FILE: tcmu/helper.c:411:
> +^I * The logical block provisioning read zeros (LBPRZ) bit shall be$
> 
> ERROR: code indent should never use tabs
> #921: FILE: tcmu/helper.c:412:
> +^I * set to one if the LBPRZ field is set to xx1b in VPD B2. The$
> 
> ERROR: code indent should never use tabs
> #922: FILE: tcmu/helper.c:413:
> +^I * LBPRZ bit shall be set to zero if the LBPRZ field is not set$
> 
> ERROR: code indent should never use tabs
> #923: FILE: tcmu/helper.c:414:
> +^I * to xx1b.$
> 
> ERROR: code indent should never use tabs
> #924: FILE: tcmu/helper.c:415:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #925: FILE: tcmu/helper.c:416:
> +^Ibuf[14] |= 0x40;$
> 
> ERROR: code indent should never use tabs
> #927: FILE: tcmu/helper.c:418:
> +^I/* all else is zero */$
> 
> ERROR: code indent should never use tabs
> #929: FILE: tcmu/helper.c:420:
> +^Itcmu_memcpy_into_iovec(iovec, iov_cnt, buf, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #931: FILE: tcmu/helper.c:422:
> +^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #935: FILE: tcmu/helper.c:426:
> +^I^I^I^I uint8_t *from_buf, size_t from_len)$
> 
> ERROR: code indent should never use tabs
> #937: FILE: tcmu/helper.c:428:
> +^Iif (!to_buf)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #937: FILE: tcmu/helper.c:428:
> +       if (!to_buf)
> [...]
> 
> ERROR: code indent should never use tabs
> #938: FILE: tcmu/helper.c:429:
> +^I^Ireturn;$
> 
> ERROR: code indent should never use tabs
> #939: FILE: tcmu/helper.c:430:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #940: FILE: tcmu/helper.c:431:
> +^I * SPC 4r37: 4.3.5.6 Allocation length:$
> 
> ERROR: code indent should never use tabs
> #941: FILE: tcmu/helper.c:432:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #942: FILE: tcmu/helper.c:433:
> +^I * The device server shall terminate transfers to the Data-In Buffer$
> 
> ERROR: code indent should never use tabs
> #943: FILE: tcmu/helper.c:434:
> +^I * when the number of bytes or blocks specified by the ALLOCATION$
> 
> ERROR: code indent should never use tabs
> #944: FILE: tcmu/helper.c:435:
> +^I * LENGTH field have been transferred or when all available data$
> 
> ERROR: code indent should never use tabs
> #945: FILE: tcmu/helper.c:436:
> +^I * have been transferred, whichever is less.$
> 
> ERROR: code indent should never use tabs
> #946: FILE: tcmu/helper.c:437:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #947: FILE: tcmu/helper.c:438:
> +^Imemcpy(to_buf, from_buf, to_len > from_len ? from_len : to_len);$
> 
> ERROR: code indent should never use tabs
> #951: FILE: tcmu/helper.c:442:
> +^I^I^I   size_t ret_buf_len)$
> 
> ERROR: code indent should never use tabs
> #953: FILE: tcmu/helper.c:444:
> +^Iuint8_t buf[12];$
> 
> ERROR: code indent should never use tabs
> #955: FILE: tcmu/helper.c:446:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #956: FILE: tcmu/helper.c:447:
> +^Ibuf[0] = 0x1;$
> 
> ERROR: code indent should never use tabs
> #957: FILE: tcmu/helper.c:448:
> +^Ibuf[1] = 0xa;$
> 
> ERROR: code indent should never use tabs
> #959: FILE: tcmu/helper.c:450:
> +^Icopy_to_response_buf(ret_buf, ret_buf_len, buf, 12);$
> 
> ERROR: code indent should never use tabs
> #960: FILE: tcmu/helper.c:451:
> +^Ireturn 12;$
> 
> ERROR: code indent should never use tabs
> #964: FILE: tcmu/helper.c:455:
> +^I^I      size_t ret_buf_len)$
> 
> ERROR: code indent should never use tabs
> #966: FILE: tcmu/helper.c:457:
> +^Iuint8_t buf[20];$
> 
> ERROR: code indent should never use tabs
> #968: FILE: tcmu/helper.c:459:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #969: FILE: tcmu/helper.c:460:
> +^Ibuf[0] = 0x8;$
> 
> ERROR: code indent should never use tabs
> #970: FILE: tcmu/helper.c:461:
> +^Ibuf[1] = 0x12;$
> 
> ERROR: code indent should never use tabs
> #972: FILE: tcmu/helper.c:463:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #973: FILE: tcmu/helper.c:464:
> +^I * If device supports a writeback cache then set writeback$
> 
> ERROR: code indent should never use tabs
> #974: FILE: tcmu/helper.c:465:
> +^I * cache enable (WCE)$
> 
> ERROR: code indent should never use tabs
> #975: FILE: tcmu/helper.c:466:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #976: FILE: tcmu/helper.c:467:
> +^Iif (tcmu_dev_get_write_cache_enabled(dev))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #976: FILE: tcmu/helper.c:467:
> +       if (tcmu_dev_get_write_cache_enabled(dev))
> [...]
> 
> ERROR: code indent should never use tabs
> #977: FILE: tcmu/helper.c:468:
> +^I^Ibuf[2] = 0x4;$
> 
> ERROR: code indent should never use tabs
> #979: FILE: tcmu/helper.c:470:
> +^Icopy_to_response_buf(ret_buf, ret_buf_len, buf, 20);$
> 
> ERROR: code indent should never use tabs
> #980: FILE: tcmu/helper.c:471:
> +^Ireturn 20;$
> 
> ERROR: code indent should never use tabs
> #984: FILE: tcmu/helper.c:475:
> +^I^I^I       size_t ret_buf_len)$
> 
> ERROR: code indent should never use tabs
> #986: FILE: tcmu/helper.c:477:
> +^Iuint8_t buf[12];$
> 
> ERROR: code indent should never use tabs
> #988: FILE: tcmu/helper.c:479:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #989: FILE: tcmu/helper.c:480:
> +^Ibuf[0] = 0x0a;$
> 
> ERROR: code indent should never use tabs
> #990: FILE: tcmu/helper.c:481:
> +^Ibuf[1] = 0x0a;$
> 
> ERROR: code indent should never use tabs
> #992: FILE: tcmu/helper.c:483:
> +^I/* From spc4r31, section 7.5.7 Control mode Page$
> 
> WARNING: Block comments use a leading /* on a separate line
> #992: FILE: tcmu/helper.c:483:
> +       /* From spc4r31, section 7.5.7 Control mode Page
> 
> ERROR: code indent should never use tabs
> #993: FILE: tcmu/helper.c:484:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #994: FILE: tcmu/helper.c:485:
> +^I * GLTSD = 1: because we don't implicitly save log parameters$
> 
> ERROR: code indent should never use tabs
> #995: FILE: tcmu/helper.c:486:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #996: FILE: tcmu/helper.c:487:
> +^I * A global logging target save disable (GLTSD) bit set to$
> 
> ERROR: code indent should never use tabs
> #997: FILE: tcmu/helper.c:488:
> +^I * zero specifies that the logical unit implicitly saves, at$
> 
> ERROR: code indent should never use tabs
> #998: FILE: tcmu/helper.c:489:
> +^I * vendor specific intervals, each log parameter in which the$
> 
> ERROR: code indent should never use tabs
> #999: FILE: tcmu/helper.c:490:
> +^I * TSD bit (see 7.3) is set to zero. A GLTSD bit set to one$
> 
> ERROR: code indent should never use tabs
> #1000: FILE: tcmu/helper.c:491:
> +^I * specifies that the logical unit shall not implicitly save$
> 
> ERROR: code indent should never use tabs
> #1001: FILE: tcmu/helper.c:492:
> +^I * any log parameters.$
> 
> ERROR: code indent should never use tabs
> #1002: FILE: tcmu/helper.c:493:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #1003: FILE: tcmu/helper.c:494:
> +^Ibuf[2] = 0x02;$
> 
> ERROR: code indent should never use tabs
> #1005: FILE: tcmu/helper.c:496:
> +^I/* From spc4r31, section 7.5.7 Control mode Page$
> 
> WARNING: Block comments use a leading /* on a separate line
> #1005: FILE: tcmu/helper.c:496:
> +       /* From spc4r31, section 7.5.7 Control mode Page
> 
> ERROR: code indent should never use tabs
> #1006: FILE: tcmu/helper.c:497:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #1007: FILE: tcmu/helper.c:498:
> +^I * TAS = 1: Currently not settable by tcmu. Using the LIO default$
> 
> ERROR: code indent should never use tabs
> #1008: FILE: tcmu/helper.c:499:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #1009: FILE: tcmu/helper.c:500:
> +^I * A task aborted status (TAS) bit set to zero specifies that$
> 
> ERROR: code indent should never use tabs
> #1010: FILE: tcmu/helper.c:501:
> +^I * aborted commands shall be terminated by the device server$
> 
> ERROR: code indent should never use tabs
> #1011: FILE: tcmu/helper.c:502:
> +^I * without any response to the application client. A TAS bit$
> 
> ERROR: code indent should never use tabs
> #1012: FILE: tcmu/helper.c:503:
> +^I * set to one specifies that commands aborted by the actions$
> 
> ERROR: code indent should never use tabs
> #1013: FILE: tcmu/helper.c:504:
> +^I * of an I_T nexus other than the I_T nexus on which the command$
> 
> ERROR: code indent should never use tabs
> #1014: FILE: tcmu/helper.c:505:
> +^I * was received shall be completed with TASK ABORTED status$
> 
> ERROR: code indent should never use tabs
> #1015: FILE: tcmu/helper.c:506:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #1016: FILE: tcmu/helper.c:507:
> +^Ibuf[5] = 0x40;$
> 
> ERROR: code indent should never use tabs
> #1018: FILE: tcmu/helper.c:509:
> +^I/* From spc4r31, section 7.5.7 Control mode Page$
> 
> WARNING: Block comments use a leading /* on a separate line
> #1018: FILE: tcmu/helper.c:509:
> +       /* From spc4r31, section 7.5.7 Control mode Page
> 
> ERROR: code indent should never use tabs
> #1019: FILE: tcmu/helper.c:510:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #1020: FILE: tcmu/helper.c:511:
> +^I * BUSY TIMEOUT PERIOD: Currently is unlimited$
> 
> ERROR: code indent should never use tabs
> #1021: FILE: tcmu/helper.c:512:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #1022: FILE: tcmu/helper.c:513:
> +^I * The BUSY TIMEOUT PERIOD field specifies the maximum time, in$
> 
> ERROR: code indent should never use tabs
> #1023: FILE: tcmu/helper.c:514:
> +^I * 100 milliseconds increments, that the application client allows$
> 
> ERROR: code indent should never use tabs
> #1024: FILE: tcmu/helper.c:515:
> +^I * for the device server to return BUSY status for unanticipated$
> 
> ERROR: code indent should never use tabs
> #1025: FILE: tcmu/helper.c:516:
> +^I * conditions that are not a routine part of commands from the$
> 
> ERROR: code indent should never use tabs
> #1026: FILE: tcmu/helper.c:517:
> +^I * application client. This value may be rounded down as defined$
> 
> ERROR: code indent should never use tabs
> #1027: FILE: tcmu/helper.c:518:
> +^I * in 5.4(the Parameter rounding section).$
> 
> ERROR: code indent should never use tabs
> #1028: FILE: tcmu/helper.c:519:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #1029: FILE: tcmu/helper.c:520:
> +^I * A 0000h value in this field is undefined by this standard.$
> 
> ERROR: code indent should never use tabs
> #1030: FILE: tcmu/helper.c:521:
> +^I * An FFFFh value in this field is defined as an unlimited period.$
> 
> ERROR: code indent should never use tabs
> #1031: FILE: tcmu/helper.c:522:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #1032: FILE: tcmu/helper.c:523:
> +^Ibuf[8] = 0xff;$
> 
> ERROR: code indent should never use tabs
> #1033: FILE: tcmu/helper.c:524:
> +^Ibuf[9] = 0xff;$
> 
> ERROR: code indent should never use tabs
> #1035: FILE: tcmu/helper.c:526:
> +^Icopy_to_response_buf(ret_buf, ret_buf_len, buf, 12);$
> 
> ERROR: code indent should never use tabs
> #1036: FILE: tcmu/helper.c:527:
> +^Ireturn 12;$
> 
> ERROR: code indent should never use tabs
> #1041: FILE: tcmu/helper.c:532:
> +^Iuint8_t page;$
> 
> ERROR: code indent should never use tabs
> #1042: FILE: tcmu/helper.c:533:
> +^Iuint8_t subpage;$
> 
> ERROR: code indent should never use tabs
> #1043: FILE: tcmu/helper.c:534:
> +^Iint (*get)(struct tcmu_device *dev, uint8_t *buf, size_t buf_len);$
> 
> ERROR: code indent should never use tabs
> #1045: FILE: tcmu/helper.c:536:
> +^I{0x1, 0, handle_rwrecovery_page},$
> 
> ERROR: code indent should never use tabs
> #1046: FILE: tcmu/helper.c:537:
> +^I{0x8, 0, handle_cache_page},$
> 
> ERROR: code indent should never use tabs
> #1047: FILE: tcmu/helper.c:538:
> +^I{0xa, 0, handle_control_page},$
> 
> ERROR: code indent should never use tabs
> #1051: FILE: tcmu/helper.c:542:
> +^I^I^I^I struct mode_sense_handler *handler,$
> 
> ERROR: code indent should never use tabs
> #1052: FILE: tcmu/helper.c:543:
> +^I^I^I^I uint8_t **buf, size_t alloc_len,$
> 
> ERROR: code indent should never use tabs
> #1053: FILE: tcmu/helper.c:544:
> +^I^I^I^I size_t *used_len, bool sense_ten)$
> 
> ERROR: code indent should never use tabs
> #1055: FILE: tcmu/helper.c:546:
> +^Iint ret;$
> 
> ERROR: code indent should never use tabs
> #1057: FILE: tcmu/helper.c:548:
> +^Iret = handler->get(dev, *buf, alloc_len - *used_len);$
> 
> ERROR: code indent should never use tabs
> #1059: FILE: tcmu/helper.c:550:
> +^Iif  (!sense_ten && (*used_len + ret >= 255))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1059: FILE: tcmu/helper.c:550:
> +       if  (!sense_ten && (*used_len + ret >= 255))
> [...]
> 
> ERROR: code indent should never use tabs
> #1060: FILE: tcmu/helper.c:551:
> +^I^Ireturn -EINVAL;$
> 
> ERROR: code indent should never use tabs
> #1062: FILE: tcmu/helper.c:553:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #1063: FILE: tcmu/helper.c:554:
> +^I * SPC 4r37: 4.3.5.6 Allocation length:$
> 
> ERROR: code indent should never use tabs
> #1064: FILE: tcmu/helper.c:555:
> +^I *$
> 
> ERROR: code indent should never use tabs
> #1065: FILE: tcmu/helper.c:556:
> +^I * If the information being transferred to the Data-In Buffer includes$
> 
> ERROR: code indent should never use tabs
> #1066: FILE: tcmu/helper.c:557:
> +^I * fields containing counts of the number of bytes in some or all of$
> 
> ERROR: code indent should never use tabs
> #1067: FILE: tcmu/helper.c:558:
> +^I * the data (e.g., the PARAMETER DATA LENGTH field, the PAGE LENGTH$
> 
> ERROR: code indent should never use tabs
> #1068: FILE: tcmu/helper.c:559:
> +^I * field, the DESCRIPTOR LENGTH field, the AVAILABLE DATA field),$
> 
> ERROR: code indent should never use tabs
> #1069: FILE: tcmu/helper.c:560:
> +^I * then the contents of these fields shall not be altered to reflect$
> 
> ERROR: code indent should never use tabs
> #1070: FILE: tcmu/helper.c:561:
> +^I * the truncation, if any, that results from an insufficient$
> 
> ERROR: code indent should never use tabs
> #1071: FILE: tcmu/helper.c:562:
> +^I * ALLOCATION LENGTH value$
> 
> ERROR: code indent should never use tabs
> #1072: FILE: tcmu/helper.c:563:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #1073: FILE: tcmu/helper.c:564:
> +^I/*$
> 
> ERROR: code indent should never use tabs
> #1074: FILE: tcmu/helper.c:565:
> +^I * Setup the buffer so to still loop over the handlers, but just$
> 
> ERROR: code indent should never use tabs
> #1075: FILE: tcmu/helper.c:566:
> +^I * increment the used_len so we can return the$
> 
> ERROR: code indent should never use tabs
> #1076: FILE: tcmu/helper.c:567:
> +^I * final value.$
> 
> ERROR: code indent should never use tabs
> #1077: FILE: tcmu/helper.c:568:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #1078: FILE: tcmu/helper.c:569:
> +^Iif (*buf && (*used_len + ret >= alloc_len))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1078: FILE: tcmu/helper.c:569:
> +       if (*buf && (*used_len + ret >= alloc_len))
> [...]
> 
> ERROR: code indent should never use tabs
> #1079: FILE: tcmu/helper.c:570:
> +^I^I*buf = NULL;$
> 
> ERROR: code indent should never use tabs
> #1081: FILE: tcmu/helper.c:572:
> +^I*used_len += ret;$
> 
> ERROR: code indent should never use tabs
> #1082: FILE: tcmu/helper.c:573:
> +^Iif (*buf)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1082: FILE: tcmu/helper.c:573:
> +       if (*buf)
> [...]
> 
> ERROR: code indent should never use tabs
> #1083: FILE: tcmu/helper.c:574:
> +^I^I*buf += ret;$
> 
> ERROR: code indent should never use tabs
> #1084: FILE: tcmu/helper.c:575:
> +^Ireturn ret;$
> 
> ERROR: code indent should never use tabs
> #1093: FILE: tcmu/helper.c:584:
> +^Istruct tcmu_device *dev,$
> 
> ERROR: code indent should never use tabs
> #1094: FILE: tcmu/helper.c:585:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #1095: FILE: tcmu/helper.c:586:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #1096: FILE: tcmu/helper.c:587:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #1098: FILE: tcmu/helper.c:589:
> +^Ibool sense_ten = (cdb[0] == MODE_SENSE_10);$
> 
> ERROR: code indent should never use tabs
> #1099: FILE: tcmu/helper.c:590:
> +^Iuint8_t page_code = cdb[2] & 0x3f;$
> 
> ERROR: code indent should never use tabs
> #1100: FILE: tcmu/helper.c:591:
> +^Iuint8_t subpage_code = cdb[3];$
> 
> ERROR: code indent should never use tabs
> #1101: FILE: tcmu/helper.c:592:
> +^Isize_t alloc_len = tcmu_dev_get_max_xfer_len(dev);$
> 
> ERROR: code indent should never use tabs
> #1102: FILE: tcmu/helper.c:593:
> +^Iint i;$
> 
> ERROR: code indent should never use tabs
> #1103: FILE: tcmu/helper.c:594:
> +^Iint ret;$
> 
> ERROR: code indent should never use tabs
> #1104: FILE: tcmu/helper.c:595:
> +^Isize_t used_len;$
> 
> ERROR: code indent should never use tabs
> #1105: FILE: tcmu/helper.c:596:
> +^Iuint8_t *buf;$
> 
> ERROR: code indent should never use tabs
> #1106: FILE: tcmu/helper.c:597:
> +^Iuint8_t *orig_buf = NULL;$
> 
> ERROR: code indent should never use tabs
> #1108: FILE: tcmu/helper.c:599:
> +^Iif (!alloc_len)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1108: FILE: tcmu/helper.c:599:
> +       if (!alloc_len)
> [...]
> 
> ERROR: code indent should never use tabs
> #1109: FILE: tcmu/helper.c:600:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #1111: FILE: tcmu/helper.c:602:
> +^I/* Mode parameter header. Mode data length filled in at the end. */$
> 
> ERROR: code indent should never use tabs
> #1112: FILE: tcmu/helper.c:603:
> +^Iused_len = sense_ten ? 8 : 4;$
> 
> ERROR: code indent should never use tabs
> #1113: FILE: tcmu/helper.c:604:
> +^Iif (used_len > alloc_len)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1113: FILE: tcmu/helper.c:604:
> +       if (used_len > alloc_len)
> [...]
> 
> ERROR: code indent should never use tabs
> #1114: FILE: tcmu/helper.c:605:
> +^I^Igoto fail;$
> 
> ERROR: code indent should never use tabs
> #1116: FILE: tcmu/helper.c:607:
> +^Ibuf = calloc(1, alloc_len);$
> 
> ERROR: code indent should never use tabs
> #1117: FILE: tcmu/helper.c:608:
> +^Iif (!buf)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1117: FILE: tcmu/helper.c:608:
> +       if (!buf)
> [...]
> 
> ERROR: code indent should never use tabs
> #1118: FILE: tcmu/helper.c:609:
> +^I^Ireturn TCMU_STS_NO_RESOURCE;$
> 
> ERROR: code indent should never use tabs
> #1120: FILE: tcmu/helper.c:611:
> +^Iorig_buf = buf;$
> 
> ERROR: code indent should never use tabs
> #1121: FILE: tcmu/helper.c:612:
> +^Ibuf += used_len;$
> 
> ERROR: code indent should never use tabs
> #1123: FILE: tcmu/helper.c:614:
> +^I/* Don't fill in device-specific parameter */$
> 
> ERROR: code indent should never use tabs
> #1124: FILE: tcmu/helper.c:615:
> +^I/* This helper fn doesn't support sw write protect (SWP) */$
> 
> ERROR: code indent should never use tabs
> #1126: FILE: tcmu/helper.c:617:
> +^I/* Don't report block descriptors */$
> 
> ERROR: code indent should never use tabs
> #1128: FILE: tcmu/helper.c:619:
> +^Iif (page_code == 0x3f) {$
> 
> ERROR: code indent should never use tabs
> #1129: FILE: tcmu/helper.c:620:
> +^I^Ifor (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {$
> 
> ERROR: code indent should never use tabs
> #1130: FILE: tcmu/helper.c:621:
> +^I^I^Iret = handle_mode_sense(dev, &modesense_handlers[i],$
> 
> ERROR: code indent should never use tabs
> #1131: FILE: tcmu/helper.c:622:
> +^I^I^I^I^I^I&buf, alloc_len, &used_len,$
> 
> ERROR: code indent should never use tabs
> #1132: FILE: tcmu/helper.c:623:
> +^I^I^I^I^I^Isense_ten);$
> 
> ERROR: code indent should never use tabs
> #1133: FILE: tcmu/helper.c:624:
> +^I^I^Iif (ret < 0)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1133: FILE: tcmu/helper.c:624:
> +                       if (ret < 0)
> [...]
> 
> ERROR: code indent should never use tabs
> #1134: FILE: tcmu/helper.c:625:
> +^I^I^I^Igoto free_buf;$
> 
> ERROR: code indent should never use tabs
> #1135: FILE: tcmu/helper.c:626:
> +^I^I}$
> 
> ERROR: code indent should never use tabs
> #1136: FILE: tcmu/helper.c:627:
> +^I} else {$
> 
> ERROR: code indent should never use tabs
> #1137: FILE: tcmu/helper.c:628:
> +^I^Iret = 0;$
> 
> ERROR: code indent should never use tabs
> #1139: FILE: tcmu/helper.c:630:
> +^I^Ifor (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {$
> 
> ERROR: code indent should never use tabs
> #1140: FILE: tcmu/helper.c:631:
> +^I^I^Iif (page_code == modesense_handlers[i].page &&$
> 
> ERROR: code indent should never use tabs
> #1141: FILE: tcmu/helper.c:632:
> +^I^I^I    subpage_code == modesense_handlers[i].subpage) {$
> 
> ERROR: code indent should never use tabs
> #1142: FILE: tcmu/helper.c:633:
> +^I^I^I^Iret = handle_mode_sense(dev,$
> 
> ERROR: code indent should never use tabs
> #1143: FILE: tcmu/helper.c:634:
> +^I^I^I^I^I^I^I&modesense_handlers[i],$
> 
> ERROR: code indent should never use tabs
> #1144: FILE: tcmu/helper.c:635:
> +^I^I^I^I^I^I^I&buf, alloc_len,$
> 
> ERROR: code indent should never use tabs
> #1145: FILE: tcmu/helper.c:636:
> +^I^I^I^I^I^I^I&used_len, sense_ten);$
> 
> ERROR: code indent should never use tabs
> #1146: FILE: tcmu/helper.c:637:
> +^I^I^I^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #1147: FILE: tcmu/helper.c:638:
> +^I^I^I}$
> 
> ERROR: code indent should never use tabs
> #1148: FILE: tcmu/helper.c:639:
> +^I^I}$
> 
> ERROR: code indent should never use tabs
> #1150: FILE: tcmu/helper.c:641:
> +^I^Iif (ret <= 0)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1150: FILE: tcmu/helper.c:641:
> +               if (ret <= 0)
> [...]
> 
> ERROR: code indent should never use tabs
> #1151: FILE: tcmu/helper.c:642:
> +^I^I^Igoto free_buf;$
> 
> ERROR: code indent should never use tabs
> #1152: FILE: tcmu/helper.c:643:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #1154: FILE: tcmu/helper.c:645:
> +^Iif (sense_ten) {$
> 
> ERROR: code indent should never use tabs
> #1155: FILE: tcmu/helper.c:646:
> +^I^Iuint16_t *ptr = (uint16_t*) orig_buf;$
> 
> ERROR: "(foo*)" should be "(foo *)"
> #1155: FILE: tcmu/helper.c:646:
> +               uint16_t *ptr = (uint16_t*) orig_buf;
> 
> ERROR: code indent should never use tabs
> #1156: FILE: tcmu/helper.c:647:
> +^I^I*ptr = htobe16(used_len - 2);$
> 
> ERROR: code indent should never use tabs
> #1157: FILE: tcmu/helper.c:648:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #1158: FILE: tcmu/helper.c:649:
> +^Ielse {$
> 
> ERROR: else should follow close brace '}'
> #1158: FILE: tcmu/helper.c:649:
> +       }
> +       else {
> 
> ERROR: code indent should never use tabs
> #1159: FILE: tcmu/helper.c:650:
> +^I^Iorig_buf[0] = used_len - 1;$
> 
> ERROR: code indent should never use tabs
> #1160: FILE: tcmu/helper.c:651:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #1162: FILE: tcmu/helper.c:653:
> +^Itcmu_memcpy_into_iovec(iovec, iov_cnt, orig_buf, alloc_len);$
> 
> ERROR: code indent should never use tabs
> #1163: FILE: tcmu/helper.c:654:
> +^Ifree(orig_buf);$
> 
> ERROR: code indent should never use tabs
> #1164: FILE: tcmu/helper.c:655:
> +^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #1167: FILE: tcmu/helper.c:658:
> +^Ifree(orig_buf);$
> 
> ERROR: code indent should never use tabs
> #1169: FILE: tcmu/helper.c:660:
> +^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1178: FILE: tcmu/helper.c:669:
> +^Istruct tcmu_device *dev,$
> 
> ERROR: code indent should never use tabs
> #1179: FILE: tcmu/helper.c:670:
> +^Iuint8_t *cdb,$
> 
> ERROR: code indent should never use tabs
> #1180: FILE: tcmu/helper.c:671:
> +^Istruct iovec *iovec,$
> 
> ERROR: code indent should never use tabs
> #1181: FILE: tcmu/helper.c:672:
> +^Isize_t iov_cnt)$
> 
> ERROR: code indent should never use tabs
> #1183: FILE: tcmu/helper.c:674:
> +^Ibool select_ten = (cdb[0] == MODE_SELECT_10);$
> 
> ERROR: code indent should never use tabs
> #1184: FILE: tcmu/helper.c:675:
> +^Iuint8_t page_code = cdb[2] & 0x3f;$
> 
> ERROR: code indent should never use tabs
> #1185: FILE: tcmu/helper.c:676:
> +^Iuint8_t subpage_code = cdb[3];$
> 
> ERROR: code indent should never use tabs
> #1186: FILE: tcmu/helper.c:677:
> +^Isize_t alloc_len = tcmu_dev_get_max_xfer_len(dev);$
> 
> ERROR: code indent should never use tabs
> #1187: FILE: tcmu/helper.c:678:
> +^Iint i;$
> 
> ERROR: code indent should never use tabs
> #1188: FILE: tcmu/helper.c:679:
> +^Iint ret = 0;$
> 
> ERROR: code indent should never use tabs
> #1189: FILE: tcmu/helper.c:680:
> +^Isize_t hdr_len = select_ten ? 8 : 4;$
> 
> ERROR: code indent should never use tabs
> #1190: FILE: tcmu/helper.c:681:
> +^Iuint8_t buf[512];$
> 
> ERROR: code indent should never use tabs
> #1191: FILE: tcmu/helper.c:682:
> +^Iuint8_t in_buf[512];$
> 
> ERROR: code indent should never use tabs
> #1192: FILE: tcmu/helper.c:683:
> +^Ibool got_sense = false;$
> 
> ERROR: code indent should never use tabs
> #1194: FILE: tcmu/helper.c:685:
> +^Iif (!alloc_len)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1194: FILE: tcmu/helper.c:685:
> +       if (!alloc_len)
> [...]
> 
> ERROR: code indent should never use tabs
> #1195: FILE: tcmu/helper.c:686:
> +^I^Ireturn TCMU_STS_OK;$
> 
> ERROR: line over 90 characters
> #1197: FILE: tcmu/helper.c:688:
> +       if (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))
> 
> ERROR: code indent should never use tabs
> #1197: FILE: tcmu/helper.c:688:
> +^Iif (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1197: FILE: tcmu/helper.c:688:
> +       if (tcmu_memcpy_from_iovec(in_buf, sizeof(in_buf), iovec, iov_cnt) >= sizeof(in_buf))
> [...]
> 
> ERROR: code indent should never use tabs
> #1198: FILE: tcmu/helper.c:689:
> +^I^Ireturn TCMU_STS_INVALID_PARAM_LIST_LEN;$
> 
> ERROR: code indent should never use tabs
> #1200: FILE: tcmu/helper.c:691:
> +^I/* Abort if !pf or sp */$
> 
> ERROR: code indent should never use tabs
> #1201: FILE: tcmu/helper.c:692:
> +^Iif (!(cdb[1] & 0x10) || (cdb[1] & 0x01))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1201: FILE: tcmu/helper.c:692:
> +       if (!(cdb[1] & 0x10) || (cdb[1] & 0x01))
> [...]
> 
> ERROR: code indent should never use tabs
> #1202: FILE: tcmu/helper.c:693:
> +^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1204: FILE: tcmu/helper.c:695:
> +^Imemset(buf, 0, sizeof(buf));$
> 
> ERROR: code indent should never use tabs
> #1205: FILE: tcmu/helper.c:696:
> +^Ifor (i = 0; i < ARRAY_SIZE(modesense_handlers); i++) {$
> 
> ERROR: code indent should never use tabs
> #1206: FILE: tcmu/helper.c:697:
> +^I^Iif (page_code == modesense_handlers[i].page$
> 
> ERROR: code indent should never use tabs
> #1207: FILE: tcmu/helper.c:698:
> +^I^I    && subpage_code == modesense_handlers[i].subpage) {$
> 
> ERROR: code indent should never use tabs
> #1208: FILE: tcmu/helper.c:699:
> +^I^I^Iret = modesense_handlers[i].get(dev, &buf[hdr_len],$
> 
> ERROR: code indent should never use tabs
> #1209: FILE: tcmu/helper.c:700:
> +^I^I^I^I^I^I^Isizeof(buf) - hdr_len);$
> 
> ERROR: code indent should never use tabs
> #1210: FILE: tcmu/helper.c:701:
> +^I^I^Iif (ret <= 0)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1210: FILE: tcmu/helper.c:701:
> +                       if (ret <= 0)
> [...]
> 
> ERROR: code indent should never use tabs
> #1211: FILE: tcmu/helper.c:702:
> +^I^I^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1213: FILE: tcmu/helper.c:704:
> +^I^I^Iif  (!select_ten && (hdr_len + ret >= 255))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1213: FILE: tcmu/helper.c:704:
> +                       if  (!select_ten && (hdr_len + ret >= 255))
> [...]
> 
> ERROR: code indent should never use tabs
> #1214: FILE: tcmu/helper.c:705:
> +^I^I^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1216: FILE: tcmu/helper.c:707:
> +^I^I^Igot_sense = true;$
> 
> ERROR: code indent should never use tabs
> #1217: FILE: tcmu/helper.c:708:
> +^I^I^Ibreak;$
> 
> ERROR: code indent should never use tabs
> #1218: FILE: tcmu/helper.c:709:
> +^I^I}$
> 
> ERROR: code indent should never use tabs
> #1219: FILE: tcmu/helper.c:710:
> +^I}$
> 
> ERROR: code indent should never use tabs
> #1221: FILE: tcmu/helper.c:712:
> +^Iif (!got_sense)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1221: FILE: tcmu/helper.c:712:
> +       if (!got_sense)
> [...]
> 
> ERROR: code indent should never use tabs
> #1222: FILE: tcmu/helper.c:713:
> +^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1224: FILE: tcmu/helper.c:715:
> +^Iif (alloc_len < (hdr_len + ret))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1224: FILE: tcmu/helper.c:715:
> +       if (alloc_len < (hdr_len + ret))
> [...]
> 
> ERROR: code indent should never use tabs
> #1225: FILE: tcmu/helper.c:716:
> +^I^Ireturn TCMU_STS_INVALID_PARAM_LIST_LEN;$
> 
> ERROR: code indent should never use tabs
> #1227: FILE: tcmu/helper.c:718:
> +^I/* Verify what was selected is identical to what sense returns, since we$
> 
> WARNING: Block comments use a leading /* on a separate line
> #1227: FILE: tcmu/helper.c:718:
> +       /* Verify what was selected is identical to what sense returns, since we
> 
> ERROR: code indent should never use tabs
> #1228: FILE: tcmu/helper.c:719:
> +^I   don't support actually setting anything. */$
> 
> WARNING: Block comments use * on subsequent lines
> #1228: FILE: tcmu/helper.c:719:
> +       /* Verify what was selected is identical to what sense returns, since we
> +          don't support actually setting anything. */
> 
> WARNING: Block comments use a trailing */ on a separate line
> #1228: FILE: tcmu/helper.c:719:
> +          don't support actually setting anything. */
> 
> ERROR: code indent should never use tabs
> #1229: FILE: tcmu/helper.c:720:
> +^Iif (memcmp(&buf[hdr_len], &in_buf[hdr_len], ret))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1229: FILE: tcmu/helper.c:720:
> +       if (memcmp(&buf[hdr_len], &in_buf[hdr_len], ret))
> [...]
> 
> ERROR: code indent should never use tabs
> #1230: FILE: tcmu/helper.c:721:
> +^I^Ireturn TCMU_STS_INVALID_PARAM_LIST;$
> 
> ERROR: code indent should never use tabs
> #1232: FILE: tcmu/helper.c:723:
> +^Ireturn TCMU_STS_OK;$
> 
> ERROR: code indent should never use tabs
> #1237: FILE: tcmu/helper.c:728:
> +^Iif ((cdb[4] >> 4) & 0xf)$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1237: FILE: tcmu/helper.c:728:
> +       if ((cdb[4] >> 4) & 0xf)
> [...]
> 
> ERROR: code indent should never use tabs
> #1238: FILE: tcmu/helper.c:729:
> +^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1240: FILE: tcmu/helper.c:731:
> +^I/* Currently, we don't allow ejecting the medium, so we're$
> 
> WARNING: Block comments use a leading /* on a separate line
> #1240: FILE: tcmu/helper.c:731:
> +       /* Currently, we don't allow ejecting the medium, so we're
> 
> ERROR: code indent should never use tabs
> #1241: FILE: tcmu/helper.c:732:
> +^I * ignoring the FBO_PREV_EJECT flag, but it may turn out that$
> 
> ERROR: code indent should never use tabs
> #1242: FILE: tcmu/helper.c:733:
> +^I * initiators do not handle this well, so we may have to change$
> 
> ERROR: code indent should never use tabs
> #1243: FILE: tcmu/helper.c:734:
> +^I * this behavior.$
> 
> ERROR: code indent should never use tabs
> #1244: FILE: tcmu/helper.c:735:
> +^I */$
> 
> ERROR: code indent should never use tabs
> #1246: FILE: tcmu/helper.c:737:
> +^Iif (!(cdb[4] & 0x01))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1246: FILE: tcmu/helper.c:737:
> +       if (!(cdb[4] & 0x01))
> [...]
> 
> ERROR: code indent should never use tabs
> #1247: FILE: tcmu/helper.c:738:
> +^I^Ireturn TCMU_STS_INVALID_CDB;$
> 
> ERROR: code indent should never use tabs
> #1249: FILE: tcmu/helper.c:740:
> +^Ireturn TCMU_STS_OK;$
> 
> WARNING: architecture specific defines should be avoided
> #1269: FILE: tcmu/helper.h:13:
> +#ifndef __TCMU_HELPER_H
> 
> ERROR: line over 90 characters
> #1275: FILE: tcmu/helper.h:19:
> +int tcmu_emulate_inquiry(struct tcmu_device *dev, uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);
> 
> WARNING: line over 80 characters
> #1277: FILE: tcmu/helper.h:21:
> +int tcmu_emulate_test_unit_ready(uint8_t *cdb, struct iovec *iovec, size_t iov_cnt);
> 
> WARNING: line over 80 characters
> #1278: FILE: tcmu/helper.h:22:
> +int tcmu_emulate_read_capacity_10(uint64_t num_lbas, uint32_t block_size, uint8_t *cdb,
> 
> ERROR: code indent should never use tabs
> #1279: FILE: tcmu/helper.h:23:
> +^I^I^I^I  struct iovec *iovec, size_t iov_cnt);$
> 
> WARNING: line over 80 characters
> #1280: FILE: tcmu/helper.h:24:
> +int tcmu_emulate_read_capacity_16(uint64_t num_lbas, uint32_t block_size, uint8_t *cdb,
> 
> ERROR: code indent should never use tabs
> #1281: FILE: tcmu/helper.h:25:
> +^I^I^I^I  struct iovec *iovec, size_t iov_cnt);$
> 
> ERROR: code indent should never use tabs
> #1283: FILE: tcmu/helper.h:27:
> +^I^I^I    struct iovec *iovec, size_t iov_cnt);$
> 
> ERROR: code indent should never use tabs
> #1285: FILE: tcmu/helper.h:29:
> +^I^I^I     struct iovec *iovec, size_t iov_cnt);$
> 
> WARNING: Block comments use a leading /* on a separate line
> #1514: FILE: tcmu/tcmu.c:221:
> +        { /* end of list */ }
> 
> WARNING: Block comments use a leading /* on a separate line
> #1523: FILE: tcmu/tcmu.c:230:
> +        { /* end of list */ }
> 
> ERROR: do not use assignment in if condition
> #1590: FILE: tcmu/tcmu.c:297:
> +    if ((aio = qemu_opt_get(common_opts, "aio")) != NULL) {
> 
> ERROR: do not use assignment in if condition
> #1602: FILE: tcmu/tcmu.c:309:
> +    if ((buf = qemu_opt_get(common_opts, "format")) != NULL) {
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1617: FILE: tcmu/tcmu.c:324:
> +    if (read_only)
> [...]
> 
> WARNING: Block comments use a leading /* on a separate line
> #1620: FILE: tcmu/tcmu.c:327:
> +    /* bdrv_open() defaults to the values in bdrv_flags (for compatibility
> 
> WARNING: Block comments use a trailing */ on a separate line
> #1622: FILE: tcmu/tcmu.c:329:
> +     * Apply the defaults here instead. */
> 
> ERROR: space required before the open parenthesis '('
> #1712: FILE: tcmu/tcmu.c:419:
> +    if(exp)
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1712: FILE: tcmu/tcmu.c:419:
> +    if(exp)
> [...]
> 
> ERROR: code indent should never use tabs
> #1761: FILE: tcmu/tcmu.c:468:
> +^Iid = device;$
> 
> ERROR: code indent should never use tabs
> #1762: FILE: tcmu/tcmu.c:469:
> +    ^Iblk = blk_by_name(id);$
> 
> ERROR: code indent should never use tabs
> #1763: FILE: tcmu/tcmu.c:470:
> +    ^Iif (!blk) {$
> 
> ERROR: code indent should never use tabs
> #1764: FILE: tcmu/tcmu.c:471:
> +        ^Ierror_setg(errp, "TCMU: Device not found: %s", id);$
> 
> ERROR: code indent should never use tabs
> #1765: FILE: tcmu/tcmu.c:472:
> +        ^Ireturn false;$
> 
> ERROR: code indent should never use tabs
> #1766: FILE: tcmu/tcmu.c:473:
> +    ^I}$
> 
> ERROR: code indent should never use tabs
> #1767: FILE: tcmu/tcmu.c:474:
> +    ^Iexp = tcmu_export_lookup(blk);$
> 
> ERROR: code indent should never use tabs
> #1768: FILE: tcmu/tcmu.c:475:
> +    ^Iif (!exp) {$
> 
> ERROR: code indent should never use tabs
> #1769: FILE: tcmu/tcmu.c:476:
> +        ^Ierror_setg(errp, "TCMU: Device not found: %s", id);$
> 
> ERROR: code indent should never use tabs
> #1770: FILE: tcmu/tcmu.c:477:
> +        ^Ireturn false;$
> 
> ERROR: code indent should never use tabs
> #1771: FILE: tcmu/tcmu.c:478:
> +   ^I}$
> 
> ERROR: do not use C99 // comments
> #1772: FILE: tcmu/tcmu.c:479:
> +    }// TODO: else to check id?
> 
> ERROR: code indent should never use tabs
> #1780: FILE: tcmu/tcmu.c:487:
> +^Iif (*opts == '@') {$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1780: FILE: tcmu/tcmu.c:487:
> +       if (*opts == '@') {
> [...]
> +       } else
> [...]
> 
> ERROR: code indent should never use tabs
> #1781: FILE: tcmu/tcmu.c:488:
> +^I    *to = ',';$
> 
> ERROR: code indent should never use tabs
> #1782: FILE: tcmu/tcmu.c:489:
> +^I} else$
> 
> ERROR: code indent should never use tabs
> #1783: FILE: tcmu/tcmu.c:490:
> +^I    *to = *opts;$
> 
> ERROR: code indent should never use tabs
> #1785: FILE: tcmu/tcmu.c:492:
> +^Iopts++;$
> 
> ERROR: code indent should never use tabs
> #1786: FILE: tcmu/tcmu.c:493:
> +^Ito++;$
> 
> ERROR: space required before the open parenthesis '('
> #1789: FILE: tcmu/tcmu.c:496:
> +    if(to)
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1789: FILE: tcmu/tcmu.c:496:
> +    if(to)
> [...]
> 
> ERROR: code indent should never use tabs
> #1806: FILE: tcmu/tcmu.c:513:
> +    ^Iid = device;$
> 
> ERROR: code indent should never use tabs
> #1807: FILE: tcmu/tcmu.c:514:
> +    ^Iexp = tcmu_export_lookup(blk_by_name(id));$
> 
> ERROR: else should follow close brace '}'
> #1809: FILE: tcmu/tcmu.c:516:
> +    }
> +    else {
> 
> ERROR: code indent should never use tabs
> #1810: FILE: tcmu/tcmu.c:517:
> +^IQemuOpts * export_opts;$
> 
> ERROR: "foo * bar" should be "foo *bar"
> #1810: FILE: tcmu/tcmu.c:517:
> +       QemuOpts * export_opts;
> 
> ERROR: code indent should never use tabs
> #1812: FILE: tcmu/tcmu.c:519:
> +^Inew_device = g_malloc0(strlen(device) + 1);$
> 
> ERROR: code indent should never use tabs
> #1813: FILE: tcmu/tcmu.c:520:
> +^Itcmu_convert_delim(new_device, device);$
> 
> WARNING: Block comments use a leading /* on a separate line
> #1815: FILE: tcmu/tcmu.c:522:
> +        /* parse new_device into an QemuOpts and link into
> 
> WARNING: Block comments use * on subsequent lines
> #1816: FILE: tcmu/tcmu.c:523:
> +        /* parse new_device into an QemuOpts and link into
> +           qemu_tcmu_export_opts with QemuOpts->id set while
> 
> ERROR: code indent should never use tabs
> #1819: FILE: tcmu/tcmu.c:526:
> +^Iexport_opts = qemu_opts_parse_noisily(&qemu_tcmu_export_opts,$
> 
> ERROR: code indent should never use tabs
> #1820: FILE: tcmu/tcmu.c:527:
> +^I^I^I^I^I    new_device, false);$
> 
> ERROR: space required before the open parenthesis '('
> #1824: FILE: tcmu/tcmu.c:531:
> +        if(!export_opts)
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1824: FILE: tcmu/tcmu.c:531:
> +        if(!export_opts)
> [...]
> 
> ERROR: code indent should never use tabs
> #1827: FILE: tcmu/tcmu.c:534:
> +^Iif (export_init_func(NULL, export_opts, NULL))$
> 
> ERROR: braces {} are necessary for all arms of this statement
> #1827: FILE: tcmu/tcmu.c:534:
> +       if (export_init_func(NULL, export_opts, NULL))
> [...]
> 
> ERROR: code indent should never use tabs
> #1828: FILE: tcmu/tcmu.c:535:
> +^I    goto fail;$
> 
> ERROR: code indent should never use tabs
> #1830: FILE: tcmu/tcmu.c:537:
> +^Iid = qemu_opts_id(export_opts);$
> 
> ERROR: code indent should never use tabs
> #1831: FILE: tcmu/tcmu.c:538:
> +^Iexp = tcmu_export_lookup(blk_by_name(id));$
> 
> total: 620 errors, 26 warnings, 1809 lines checked
> 
> Your patch has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> === OUTPUT END ===
> 
> Test command exited with code: 1
> 
> 
> The full log is available at
> http://patchew.org/logs/1545387387-9613-1-git-send-email-baiyaowei@cmss.chinamobile.com/testing.checkpatch/?type=message.
> ---
> Email generated automatically by Patchew [http://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2018-12-21 10:16 [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility Yaowei Bai
  2018-12-26  7:59 ` no-reply
  2018-12-26  8:19 ` no-reply
@ 2019-03-06 21:56 ` Kevin Wolf
  2019-03-07  8:20   ` Yaowei Bai
                     ` (2 more replies)
  2 siblings, 3 replies; 16+ messages in thread
From: Kevin Wolf @ 2019-03-06 21:56 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li

Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> This patch introduces a new utility, qemu-tcmu. Apart from the
> underlaying protocol it interacts with the world much like
> qemu-nbd. This patch bases on Fam's version.
> 
> Qemu-tcmu handles SCSI commands which are passed through userspace
> from kernel by LIO subsystem using TCMU protocol. Libtcmu is the
> library for processing TCMU protocol in userspace. With qemu-tcmu,
> we can export images/formats like qcow2, rbd, etc. that qemu supports
> using iSCSI protocol or loopback for remote or local access.
> 
> Currently qemu-tcmu implements several SCSI command helper functions
> to work. Our goal is to refactor and reuse SCSI code in scsi-disk.
> 
> Please refer to docs/tcmu.txt to use qemu-tcmu. We test it on CentOS
> 7.3.(Please use 3.10.0-514 or lower version kernel, there's one issuse
> in higher kernel version we're resolving.)
> 
> Cc: Mike Christie <mchristi@redhat.com>
> Cc: Amar Tumballi<atumball@redhat.com>
> Cc: Prasanna Kalever <pkalever@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>

Sorry, with the email backlog after the Christmas break, this patch went
completely unnoticed on my side.

I'm not going to review the code in detail yet, because I think there
are a few very high level points that need to be addressed first:

* Patchew replied with a ton of coding style problems. This patch isn't
  mergable without these problems fixed.

* The first priority should be adding an in-process iscsi target that
  can be managed with QMP, similar to the built-in NBD server.

* The standalone tool should configure its block backend using -blockdev
  based code paths instead of duplicating legacy -drive code, which
  cannot provide advanced functionality.

* Even worse, you can't get the configuration from the iscsi initiator.
  This would be a security nightmare. Instead, the user needs to
  configure named exports either in QMP or on the command line for the
  tool and the initiator then connects to an export name.

* It should be considered if we can have a single standalone tool for
  all export mechanisms (NBD, TCMU, vhost-user, fuse, and whatever new
  ideas we will have in the future) that could have advanced
  functionality like a QMP monitor instead of adding a minimal
  specialised tool for each of them.

Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-06 21:56 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
@ 2019-03-07  8:20   ` Yaowei Bai
  2019-03-07  8:44   ` Yaowei Bai
  2019-03-07 10:22   ` Stefan Hajnoczi
  2 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2019-03-07  8:20 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha

On Wed, Mar 06, 2019 at 10:56:33PM +0100, Kevin Wolf wrote:
> Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> > This patch introduces a new utility, qemu-tcmu. Apart from the
> > underlaying protocol it interacts with the world much like
> > qemu-nbd. This patch bases on Fam's version.
> > 
> > Qemu-tcmu handles SCSI commands which are passed through userspace
> > from kernel by LIO subsystem using TCMU protocol. Libtcmu is the
> > library for processing TCMU protocol in userspace. With qemu-tcmu,
> > we can export images/formats like qcow2, rbd, etc. that qemu supports
> > using iSCSI protocol or loopback for remote or local access.
> > 
> > Currently qemu-tcmu implements several SCSI command helper functions
> > to work. Our goal is to refactor and reuse SCSI code in scsi-disk.
> > 
> > Please refer to docs/tcmu.txt to use qemu-tcmu. We test it on CentOS
> > 7.3.(Please use 3.10.0-514 or lower version kernel, there's one issuse
> > in higher kernel version we're resolving.)
> > 
> > Cc: Mike Christie <mchristi@redhat.com>
> > Cc: Amar Tumballi<atumball@redhat.com>
> > Cc: Prasanna Kalever <pkalever@redhat.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
> > Signed-off-by: Xiubo Li <xiubli@redhat.com>
> 
> Sorry, with the email backlog after the Christmas break, this patch went
> completely unnoticed on my side.
> 
> I'm not going to review the code in detail yet, because I think there
> are a few very high level points that need to be addressed first:
> 
> * Patchew replied with a ton of coding style problems. This patch isn't
>   mergable without these problems fixed.

These problems've been fixed in the V2 and it'll be sent out soon.
Thanks.

> 
> * The first priority should be adding an in-process iscsi target that
>   can be managed with QMP, similar to the built-in NBD server.

Well, people used to manage iscsi targets through targetcli, a command
line utility. Our intention is, with targetcli and qemu-tcmu, user can
create/remove targets and backstores totally in just one place, so you
don't need to create targets in targetcli and then turn to configure
backstores in qemu-tcmu with QMP or command line, it's convenient. So
we decide to implement QMP in the future release but it's definitely
in our plan.

> 
> * The standalone tool should configure its block backend using -blockdev
>   based code paths instead of duplicating legacy -drive code, which
>   cannot provide advanced functionality.

OK, will turn into -blockdev based code paths. Thanks.

> 
> * Even worse, you can't get the configuration from the iscsi initiator.
>   This would be a security nightmare. Instead, the user needs to
>   configure named exports either in QMP or on the command line for the
>   tool and the initiator then connects to an export name.

So you mean we should configure exports through iscsi initiator? Sorry i
don't understand the problems here, could you please explain more?

> 
> * It should be considered if we can have a single standalone tool for
>   all export mechanisms (NBD, TCMU, vhost-user, fuse, and whatever new
>   ideas we will have in the future) that could have advanced
>   functionality like a QMP monitor instead of adding a minimal
>   specialised tool for each of them.

That's a great and exciting idea so we don't need one qemu-nbd, one
qemu-tcmu, or more qemu-xxx at the same time, there's just one standalone
tool to use, maybe we can even instead add a new 'export' subcommand to
qemu-img for this purpose.

> 
> Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-06 21:56 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
  2019-03-07  8:20   ` Yaowei Bai
@ 2019-03-07  8:44   ` Yaowei Bai
  2019-03-07 11:25     ` Kevin Wolf
  2019-03-07 10:22   ` Stefan Hajnoczi
  2 siblings, 1 reply; 16+ messages in thread
From: Yaowei Bai @ 2019-03-07  8:44 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha,
	Yaowei Bai

Add Fam.

On Wed, Mar 06, 2019 at 10:56:33PM +0100, Kevin Wolf wrote:
> Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> > This patch introduces a new utility, qemu-tcmu. Apart from the
> > underlaying protocol it interacts with the world much like
> > qemu-nbd. This patch bases on Fam's version.
> > 
> > Qemu-tcmu handles SCSI commands which are passed through userspace
> > from kernel by LIO subsystem using TCMU protocol. Libtcmu is the
> > library for processing TCMU protocol in userspace. With qemu-tcmu,
> > we can export images/formats like qcow2, rbd, etc. that qemu supports
> > using iSCSI protocol or loopback for remote or local access.
> > 
> > Currently qemu-tcmu implements several SCSI command helper functions
> > to work. Our goal is to refactor and reuse SCSI code in scsi-disk.
> > 
> > Please refer to docs/tcmu.txt to use qemu-tcmu. We test it on CentOS
> > 7.3.(Please use 3.10.0-514 or lower version kernel, there's one issuse
> > in higher kernel version we're resolving.)
> > 
> > Cc: Mike Christie <mchristi@redhat.com>
> > Cc: Amar Tumballi<atumball@redhat.com>
> > Cc: Prasanna Kalever <pkalever@redhat.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
> > Signed-off-by: Xiubo Li <xiubli@redhat.com>
> 
> Sorry, with the email backlog after the Christmas break, this patch went
> completely unnoticed on my side.
> 
> I'm not going to review the code in detail yet, because I think there
> are a few very high level points that need to be addressed first:
> 
> * Patchew replied with a ton of coding style problems. This patch isn't
>   mergable without these problems fixed.

These problems've been fixed in the V2 and it'll be sent out soon.
Thanks.

> 
> * The first priority should be adding an in-process iscsi target that
>   can be managed with QMP, similar to the built-in NBD server.

Well, people used to manage iscsi targets through targetcli, a command
line utility. Our intention is, with targetcli and qemu-tcmu, user can
create/remove targets and backstores totally in just one place, so you
don't need to create targets in targetcli and then turn to configure
backstores in qemu-tcmu with QMP or command line, it's convenient. So
we decide to implement QMP in the future release but it's definitely
in our plan.

> 
> * The standalone tool should configure its block backend using -blockdev
>   based code paths instead of duplicating legacy -drive code, which
>   cannot provide advanced functionality.

OK, will turn into -blockdev based code paths. Thanks.

> 
> * Even worse, you can't get the configuration from the iscsi initiator.
>   This would be a security nightmare. Instead, the user needs to
>   configure named exports either in QMP or on the command line for the
>   tool and the initiator then connects to an export name.

So you mean we should configure exports through iscsi initiator? Sorry i
don't understand the problems here, could you please explain more?

> 
> * It should be considered if we can have a single standalone tool for
>   all export mechanisms (NBD, TCMU, vhost-user, fuse, and whatever new
>   ideas we will have in the future) that could have advanced
>   functionality like a QMP monitor instead of adding a minimal
>   specialised tool for each of them.

That's a great and exciting idea so we don't need one qemu-nbd, one
qemu-tcmu, or more qemu-xxx at the same time, there's just one standalone
tool to use, maybe we can even instead add a new 'export' subcommand to
qemu-img for this purpose.

> 
> Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-06 21:56 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
  2019-03-07  8:20   ` Yaowei Bai
  2019-03-07  8:44   ` Yaowei Bai
@ 2019-03-07 10:22   ` Stefan Hajnoczi
  2019-03-07 10:34     ` Kevin Wolf
  2 siblings, 1 reply; 16+ messages in thread
From: Stefan Hajnoczi @ 2019-03-07 10:22 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Yaowei Bai, qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

On Wed, Mar 06, 2019 at 10:56:33PM +0100, Kevin Wolf wrote:
> Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> * The first priority should be adding an in-process iscsi target that
>   can be managed with QMP, similar to the built-in NBD server.

Using the in-kernel SCSI target with TCMU, or do you mean implementing
the iSCSI network protocol inside QEMU?

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-07 10:22   ` Stefan Hajnoczi
@ 2019-03-07 10:34     ` Kevin Wolf
  2019-03-11  9:55       ` Stefan Hajnoczi
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2019-03-07 10:34 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Yaowei Bai, qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

Am 07.03.2019 um 11:22 hat Stefan Hajnoczi geschrieben:
> On Wed, Mar 06, 2019 at 10:56:33PM +0100, Kevin Wolf wrote:
> > Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> > * The first priority should be adding an in-process iscsi target that
> >   can be managed with QMP, similar to the built-in NBD server.
> 
> Using the in-kernel SCSI target with TCMU, or do you mean implementing
> the iSCSI network protocol inside QEMU?

Using TCMU in this case, of course. This point was about external tool
vs. exporting from a running QEMU instance, not about how to implement
the actual functionality.

Building an external command line tool around QMP functionality is easy,
but the reverse way isn't necessarily. This is why I think QMP-based
should come first.

Kevin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-07  8:44   ` Yaowei Bai
@ 2019-03-07 11:25     ` Kevin Wolf
  2019-03-08  7:22       ` Yaowei Bai
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2019-03-07 11:25 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha

Am 07.03.2019 um 09:44 hat Yaowei Bai geschrieben:
> Add Fam.
> 
> On Wed, Mar 06, 2019 at 10:56:33PM +0100, Kevin Wolf wrote:
> > Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> > > This patch introduces a new utility, qemu-tcmu. Apart from the
> > > underlaying protocol it interacts with the world much like
> > > qemu-nbd. This patch bases on Fam's version.
> > > 
> > > Qemu-tcmu handles SCSI commands which are passed through userspace
> > > from kernel by LIO subsystem using TCMU protocol. Libtcmu is the
> > > library for processing TCMU protocol in userspace. With qemu-tcmu,
> > > we can export images/formats like qcow2, rbd, etc. that qemu supports
> > > using iSCSI protocol or loopback for remote or local access.
> > > 
> > > Currently qemu-tcmu implements several SCSI command helper functions
> > > to work. Our goal is to refactor and reuse SCSI code in scsi-disk.
> > > 
> > > Please refer to docs/tcmu.txt to use qemu-tcmu. We test it on CentOS
> > > 7.3.(Please use 3.10.0-514 or lower version kernel, there's one issuse
> > > in higher kernel version we're resolving.)
> > > 
> > > Cc: Mike Christie <mchristi@redhat.com>
> > > Cc: Amar Tumballi<atumball@redhat.com>
> > > Cc: Prasanna Kalever <pkalever@redhat.com>
> > > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > > Signed-off-by: Fam Zheng <famz@redhat.com>
> > > Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
> > > Signed-off-by: Xiubo Li <xiubli@redhat.com>
> > 
> > Sorry, with the email backlog after the Christmas break, this patch went
> > completely unnoticed on my side.
> > 
> > I'm not going to review the code in detail yet, because I think there
> > are a few very high level points that need to be addressed first:
> > 
> > * Patchew replied with a ton of coding style problems. This patch isn't
> >   mergable without these problems fixed.
> 
> These problems've been fixed in the V2 and it'll be sent out soon.
> Thanks.

Ok.

> > * The first priority should be adding an in-process iscsi target that
> >   can be managed with QMP, similar to the built-in NBD server.
> 
> Well, people used to manage iscsi targets through targetcli, a command
> line utility. Our intention is, with targetcli and qemu-tcmu, user can
> create/remove targets and backstores totally in just one place, so you
> don't need to create targets in targetcli and then turn to configure
> backstores in qemu-tcmu with QMP or command line, it's convenient.  So
> we decide to implement QMP in the future release but it's definitely
> in our plan.

I think QMP needs to come first to result in a clean design, because the
command line tool should only be a wrapper around the QMP code.

> > * The standalone tool should configure its block backend using -blockdev
> >   based code paths instead of duplicating legacy -drive code, which
> >   cannot provide advanced functionality.
> 
> OK, will turn into -blockdev based code paths. Thanks.
> 
> > 
> > * Even worse, you can't get the configuration from the iscsi initiator.
> >   This would be a security nightmare. Instead, the user needs to
> >   configure named exports either in QMP or on the command line for the
> >   tool and the initiator then connects to an export name.
> 
> So you mean we should configure exports through iscsi initiator? Sorry i
> don't understand the problems here, could you please explain more?

Sorry, I misunderstood. I thought cfgstr comes from the initiator, but
it really comes from the kernel target.

But anyway, I still think the change I had in mind is necessary. Maybe
you can see the difference best in an example. Your documentation says
to use this:

    # qemu-tcmu
    # targetcli /backstores/user:qemu create qemulun 1G @id=test@file=/root/test.file

I think it should work more like this:

    # qemu-tcmu -blockdev driver=file,filename=/root/test.file,node-name=my_file \
                -export my_export,node=my_file
    # targetcli /backstores/user:qemu create qemulun 1G my_export

In fact, something like this is probably required if we want to export
existing block nodes (that may be in use by a guest) from a running QEMU
instance. In this case, you don't want to open a new image file, but
export the already opened image file.

(Also, can we somehow get rid of the 1G in the command line? qemu-tcmu
knows how big the image is and can provide this value.)

> > * It should be considered if we can have a single standalone tool for
> >   all export mechanisms (NBD, TCMU, vhost-user, fuse, and whatever new
> >   ideas we will have in the future) that could have advanced
> >   functionality like a QMP monitor instead of adding a minimal
> >   specialised tool for each of them.
> 
> That's a great and exciting idea so we don't need one qemu-nbd, one
> qemu-tcmu, or more qemu-xxx at the same time, there's just one standalone
> tool to use, maybe we can even instead add a new 'export' subcommand to
> qemu-img for this purpose.

I wouldn't use qemu-img because it's a long-running daemon rather than
short specific operations as in other qemu-img subcommans. I think I'd
rather have a new binary qemu-blockd or something.

But these are details that we can decide when we have the functionality
available from QMP.

Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-07 11:25     ` Kevin Wolf
@ 2019-03-08  7:22       ` Yaowei Bai
  2019-03-08 10:08         ` Kevin Wolf
  0 siblings, 1 reply; 16+ messages in thread
From: Yaowei Bai @ 2019-03-08  7:22 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha

> > > * The first priority should be adding an in-process iscsi target that
> > >   can be managed with QMP, similar to the built-in NBD server.
> > 
> > Well, people used to manage iscsi targets through targetcli, a command
> > line utility. Our intention is, with targetcli and qemu-tcmu, user can
> > create/remove targets and backstores totally in just one place, so you
> > don't need to create targets in targetcli and then turn to configure
> > backstores in qemu-tcmu with QMP or command line, it's convenient.  So
> > we decide to implement QMP in the future release but it's definitely
> > in our plan.
> 
> I think QMP needs to come first to result in a clean design, because the
> command line tool should only be a wrapper around the QMP code.

Yeah, i agree this makes more sense from this point. Ok, i'll try to
implement it in v2 as your suggestion. Thanks.

> But anyway, I still think the change I had in mind is necessary. Maybe
> you can see the difference best in an example. Your documentation says
> to use this:
> 
>     # qemu-tcmu
>     # targetcli /backstores/user:qemu create qemulun 1G @id=test@file=/root/test.file

Let's call this one case1.

> 
> I think it should work more like this:
> 
>     # qemu-tcmu -blockdev driver=file,filename=/root/test.file,node-name=my_file \
>                 -export my_export,node=my_file
>     # targetcli /backstores/user:qemu create qemulun 1G my_export

And this one case2.

> 
> In fact, something like this is probably required if we want to export
> existing block nodes (that may be in use by a guest) from a running QEMU
> instance. In this case, you don't want to open a new image file, but
> export the already opened image file.

I think the main difference between these two cases is just how the configuration
of exported image file is passed to qemu-tcmu. Case1 uses cfgstr while case2
uses command line. Case2 still needs one way to check whether the passed-in
image file was opened, right? If so, case1 should also be able to use the same
way to check that after extracting cfgstr. 

Actually we thought about qemu-tcmu working like case2, but felt is's quite less
flexible. With case2, e.g. when we want to export another new image file with
one qemu-tcmu already running, we have to run another qemu-tcmu with
the configuration of the new image file in commandline, or through QMP of the
running qemu-tcmu, and then configure it with targetcli. So anyway,
there's one more step for case2 to export a new image file. While for case1 
you just need to run qemu-tcmu once and all other operations will be done
within targetcli, which is more friendly to users i think.

So i think qemu-tcmu's quite different from qemu-nbd at this point. We can
export a image file by NBD protocol just with qemu-nbd itself. While for
qemu-tcmu we still need targetcli to complete other ISCSI target
configurations to export a image file. So moving the configuration of image
file from cmdline to targetcli should be reasonable in my opinion.

> 
> (Also, can we somehow get rid of the 1G in the command line? qemu-tcmu
> knows how big the image is and can provide this value.)

Currently this size option is mandatory in targetcli, not all tools are
so smart as QEMU. But maybe we could change it optional in the future.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-08  7:22       ` Yaowei Bai
@ 2019-03-08 10:08         ` Kevin Wolf
  2019-03-09  1:46           ` Yaowei Bai
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2019-03-08 10:08 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha

Am 08.03.2019 um 08:22 hat Yaowei Bai geschrieben:
> > > > * The first priority should be adding an in-process iscsi target that
> > > >   can be managed with QMP, similar to the built-in NBD server.
> > > 
> > > Well, people used to manage iscsi targets through targetcli, a command
> > > line utility. Our intention is, with targetcli and qemu-tcmu, user can
> > > create/remove targets and backstores totally in just one place, so you
> > > don't need to create targets in targetcli and then turn to configure
> > > backstores in qemu-tcmu with QMP or command line, it's convenient.  So
> > > we decide to implement QMP in the future release but it's definitely
> > > in our plan.
> > 
> > I think QMP needs to come first to result in a clean design, because the
> > command line tool should only be a wrapper around the QMP code.
> 
> Yeah, i agree this makes more sense from this point. Ok, i'll try to
> implement it in v2 as your suggestion. Thanks.
> 
> > But anyway, I still think the change I had in mind is necessary. Maybe
> > you can see the difference best in an example. Your documentation says
> > to use this:
> > 
> >     # qemu-tcmu
> >     # targetcli /backstores/user:qemu create qemulun 1G @id=test@file=/root/test.file
> 
> Let's call this one case1.
> 
> > 
> > I think it should work more like this:
> > 
> >     # qemu-tcmu -blockdev driver=file,filename=/root/test.file,node-name=my_file \
> >                 -export my_export,node=my_file
> >     # targetcli /backstores/user:qemu create qemulun 1G my_export
> 
> And this one case2.
> 
> > 
> > In fact, something like this is probably required if we want to export
> > existing block nodes (that may be in use by a guest) from a running QEMU
> > instance. In this case, you don't want to open a new image file, but
> > export the already opened image file.
> 
> I think the main difference between these two cases is just how the configuration
> of exported image file is passed to qemu-tcmu. Case1 uses cfgstr while case2
> uses command line. Case2 still needs one way to check whether the passed-in
> image file was opened, right? If so, case1 should also be able to use the same
> way to check that after extracting cfgstr. 

I'm not sure what check you mean. Case 2 would need to find an existing
export with the given name, of course, and would return an error if no
such export exists yet.

But for care 1, isn't the image explicitly opened when the target is
configured? And if it can't be opened, -1 is returned to libtcmu?

> Actually we thought about qemu-tcmu working like case2, but felt is's quite less
> flexible. With case2, e.g. when we want to export another new image file with
> one qemu-tcmu already running, we have to run another qemu-tcmu with
> the configuration of the new image file in commandline, or through QMP of the
> running qemu-tcmu, and then configure it with targetcli. So anyway,
> there's one more step for case2 to export a new image file. While for case1 
> you just need to run qemu-tcmu once and all other operations will be done
> within targetcli, which is more friendly to users i think.

Some users may call it more convenient (even though it's really the
same, just moved to a different command, in the simple case that case 2
supports). But it's actually not very flexible.

If we implement case 1, you can define your configuration exactly as
with QEMU, including multiple -blockdev and -object options, and select
the exact block node that you want to export.

In case 2, you only have a single string, which comes with many
downsides:

* You cannot get the semantics of block nodes defined individually with
  separate -blockdev options, but only a single tree that is managed as
  a single unit.

* Additional objects such as iothreads or secrets cannot be included in
  the config string, so you must split the configuration and pass some
  parts directly to qemu-tcmu and other parts to targetcli. This is
  inconsistent.

* You need a way to represent a possible options of a node in a string.
  QEMU -drive already caused trouble by giving commas a special meaning.
  This patch adds @ as a special character, without an option to escape
  it. If you have a filename that contains @, there is no way to use it.

* For the not yet implemented QMP part: You can export only images that
  are newly opened. You cannot export images that are already opened and
  in use. But exporting images that are in use by the VM is the main use
  of even having a QMP interface.

If I think a bit longer, I'm sure I can come up with more points. Case 2
just doesn't feel right, it is like drives were configured in QEMU 0.10,
not in 4.0, and we moved away from it for many reasons, most of which
probably apply here, too.

> So i think qemu-tcmu's quite different from qemu-nbd at this point. We can
> export a image file by NBD protocol just with qemu-nbd itself. While for
> qemu-tcmu we still need targetcli to complete other ISCSI target
> configurations to export a image file. So moving the configuration of image
> file from cmdline to targetcli should be reasonable in my opinion.

Yes, it is different. But the restriction to configure everything in a
single string is what makes moving the configuration to targetcli a
problem.

Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-08 10:08         ` Kevin Wolf
@ 2019-03-09  1:46           ` Yaowei Bai
  2019-03-11 11:06             ` Kevin Wolf
  0 siblings, 1 reply; 16+ messages in thread
From: Yaowei Bai @ 2019-03-09  1:46 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha,
	Yaowei Bai

> 
> I'm not sure what check you mean. Case 2 would need to find an existing
> export with the given name, of course, and would return an error if no
> such export exists yet.
> 
> But for care 1, isn't the image explicitly opened when the target is
> configured? And if it can't be opened, -1 is returned to libtcmu?

Yes it is. I misunderstood your meaning, forget about this.

> 
> > Actually we thought about qemu-tcmu working like case2, but felt is's quite less
> > flexible. With case2, e.g. when we want to export another new image file with
> > one qemu-tcmu already running, we have to run another qemu-tcmu with
> > the configuration of the new image file in commandline, or through QMP of the
> > running qemu-tcmu, and then configure it with targetcli. So anyway,
> > there's one more step for case2 to export a new image file. While for case1 
> > you just need to run qemu-tcmu once and all other operations will be done
> > within targetcli, which is more friendly to users i think.
> 
> Some users may call it more convenient (even though it's really the
> same, just moved to a different command, in the simple case that case 2
> supports). But it's actually not very flexible.
> 
> If we implement case 1, you can define your configuration exactly as
> with QEMU, including multiple -blockdev and -object options, and select
> the exact block node that you want to export.
> 
> In case 2, you only have a single string, which comes with many
> downsides:
> 
> * You cannot get the semantics of block nodes defined individually with
>   separate -blockdev options, but only a single tree that is managed as
>   a single unit.
> 
> * Additional objects such as iothreads or secrets cannot be included in
>   the config string, so you must split the configuration and pass some
>   parts directly to qemu-tcmu and other parts to targetcli. This is
>   inconsistent.
> 
> * You need a way to represent a possible options of a node in a string.
>   QEMU -drive already caused trouble by giving commas a special meaning.
>   This patch adds @ as a special character, without an option to escape
>   it. If you have a filename that contains @, there is no way to use it.
> 
> * For the not yet implemented QMP part: You can export only images that
>   are newly opened. You cannot export images that are already opened and
>   in use. But exporting images that are in use by the VM is the main use
>   of even having a QMP interface.
> 
> If I think a bit longer, I'm sure I can come up with more points. Case 2
> just doesn't feel right, it is like drives were configured in QEMU 0.10,
> not in 4.0, and we moved away from it for many reasons, most of which
> probably apply here, too.

Thanks for explaining the background. It comes to my mind that actually we
talked about these two cases with Fam a bit long time ago and decided to
support both these two cases. The reason why we implement case2 first is
currently we care more about exporting new opened images and it's a bit
more convenient, exporting from a VM or QMP can be added in the later
release. Do you think it's reasonable/acceptable that we support both
cases and use case2 for normal new opened images and case1 for the
circumstances you mention above?

> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-07 10:34     ` Kevin Wolf
@ 2019-03-11  9:55       ` Stefan Hajnoczi
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Hajnoczi @ 2019-03-11  9:55 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Yaowei Bai, qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

On Thu, Mar 07, 2019 at 11:34:55AM +0100, Kevin Wolf wrote:
> Am 07.03.2019 um 11:22 hat Stefan Hajnoczi geschrieben:
> > On Wed, Mar 06, 2019 at 10:56:33PM +0100, Kevin Wolf wrote:
> > > Am 21.12.2018 um 11:16 hat Yaowei Bai geschrieben:
> > > * The first priority should be adding an in-process iscsi target that
> > >   can be managed with QMP, similar to the built-in NBD server.
> > 
> > Using the in-kernel SCSI target with TCMU, or do you mean implementing
> > the iSCSI network protocol inside QEMU?
> 
> Using TCMU in this case, of course. This point was about external tool
> vs. exporting from a running QEMU instance, not about how to implement
> the actual functionality.
> 
> Building an external command line tool around QMP functionality is easy,
> but the reverse way isn't necessarily. This is why I think QMP-based
> should come first.

Makes sense, thanks.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-09  1:46           ` Yaowei Bai
@ 2019-03-11 11:06             ` Kevin Wolf
  2019-03-12  2:18               ` Fam Zheng
  0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2019-03-11 11:06 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: qemu-block, qemu-devel, Amar Tumballi, Mike Christie,
	Prasanna Kalever, Paolo Bonzini, Xiubo Li, Fam Zheng, stefanha

Am 09.03.2019 um 02:46 hat Yaowei Bai geschrieben:
> Thanks for explaining the background. It comes to my mind that actually we
> talked about these two cases with Fam a bit long time ago and decided to
> support both these two cases. The reason why we implement case2 first is
> currently we care more about exporting new opened images and it's a bit
> more convenient, exporting from a VM or QMP can be added in the later
> release. Do you think it's reasonable/acceptable that we support both
> cases and use case2 for normal new opened images and case1 for the
> circumstances you mention above?

I would like to avoid a second code path because it comes with a
maintenance cost.

Experience also tells that adding a new way to parse option strings will
come back at us later because it we must always maintain compatibility
with yet another format.

So I would prefer not doing this and just passing command line options
to qemu-tcmu, which can reuse the already existing code paths.

Kevin

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH] tcmu: Introduce qemu-tcmu utility
  2019-03-11 11:06             ` Kevin Wolf
@ 2019-03-12  2:18               ` Fam Zheng
  0 siblings, 0 replies; 16+ messages in thread
From: Fam Zheng @ 2019-03-12  2:18 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Fam Zheng, Yaowei Bai, stefanha, qemu-block, qemu-devel,
	Amar Tumballi, Mike Christie, Prasanna Kalever, Paolo Bonzini,
	Xiubo Li



> On Mar 11, 2019, at 19:06, Kevin Wolf <kwolf@redhat.com> wrote:
> 
> Am 09.03.2019 um 02:46 hat Yaowei Bai geschrieben:
>> Thanks for explaining the background. It comes to my mind that actually we
>> talked about these two cases with Fam a bit long time ago and decided to
>> support both these two cases. The reason why we implement case2 first is
>> currently we care more about exporting new opened images and it's a bit
>> more convenient, exporting from a VM or QMP can be added in the later
>> release. Do you think it's reasonable/acceptable that we support both
>> cases and use case2 for normal new opened images and case1 for the
>> circumstances you mention above?
> 
> I would like to avoid a second code path because it comes with a
> maintenance cost.
> 
> Experience also tells that adding a new way to parse option strings will
> come back at us later because it we must always maintain compatibility
> with yet another format.

If the rule is that cfgstr strictly follows -blockdev syntax and the parsing code is mostly shared, it shouldn’t be a problem, right? I suppose this will limit the expressiveness of cfgstr but might be a reasonable tradeoff between implementation complexity, user friendliness and interface consistency.

Another possibility is to use json: format in cfgstr for anything more complex than a single -blockdev.

> 
> So I would prefer not doing this and just passing command line options
> to qemu-tcmu, which can reuse the already existing code paths.

I think the effect of not supporting adding new blockdev from cfgstr is that we have to resort to QMP to allow hot-adding targets. It’s not necessarily bad, though I’m not sure hwo that aligns with Yaowei’s development plan.

Fam


> 
> Kevin
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-03-12  2:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21 10:16 [Qemu-devel] [PATCH] tcmu: Introduce qemu-tcmu utility Yaowei Bai
2018-12-26  7:59 ` no-reply
2018-12-26  8:19 ` no-reply
2019-01-02  1:53   ` Yaowei Bai
2019-03-06 21:56 ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2019-03-07  8:20   ` Yaowei Bai
2019-03-07  8:44   ` Yaowei Bai
2019-03-07 11:25     ` Kevin Wolf
2019-03-08  7:22       ` Yaowei Bai
2019-03-08 10:08         ` Kevin Wolf
2019-03-09  1:46           ` Yaowei Bai
2019-03-11 11:06             ` Kevin Wolf
2019-03-12  2:18               ` Fam Zheng
2019-03-07 10:22   ` Stefan Hajnoczi
2019-03-07 10:34     ` Kevin Wolf
2019-03-11  9:55       ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.