Show a patch.

GET /api/patches/371/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 371,
    "url": "https://patches.dpdk.org/api/patches/371/?format=api",
    "web_url": "https://patches.dpdk.org/patch/371/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk"
    },
    "msgid": "<1410519304-14521-5-git-send-email-huawei.xie@intel.com>",
    "date": "2014-09-12T10:55:03",
    "name": "[dpdk-dev,v4,4/5] coding style issue fix",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0ec6f6ee7250b36fae3a62debfb2b36ea37b36a1",
    "submitter": {
        "id": 16,
        "url": "https://patches.dpdk.org/api/people/16/?format=api",
        "name": "Huawei Xie",
        "email": "huawei.xie@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/patch/371/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/371/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/371/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Mailer": "git-send-email 1.7.4.1",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id A98B3B3A2;\n\tFri, 12 Sep 2014 12:50:19 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id BD2C168B7\n\tfor <dev@dpdk.org>; Fri, 12 Sep 2014 12:50:15 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP; 12 Sep 2014 03:55:32 -0700",
            "from shvmail01.sh.intel.com ([10.239.29.42])\n\tby FMSMGA003.fm.intel.com with ESMTP; 12 Sep 2014 03:50:19 -0700",
            "from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com\n\t[10.239.29.90])\n\tby shvmail01.sh.intel.com with ESMTP id s8CAtS6f023103;\n\tFri, 12 Sep 2014 18:55:28 +0800",
            "from shecgisg003.sh.intel.com (localhost [127.0.0.1])\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP\n\tid s8CAtPuJ014585; Fri, 12 Sep 2014 18:55:27 +0800",
            "(from hxie5@localhost)\n\tby shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id s8CAtP7d014581; \n\tFri, 12 Sep 2014 18:55:25 +0800"
        ],
        "References": "<1410519304-14521-1-git-send-email-huawei.xie@intel.com>",
        "Delivered-To": "patchwork@dpdk.org",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<1410519304-14521-5-git-send-email-huawei.xie@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"4.97,862,1389772800\"; d=\"scan'208\";a=\"385203955\"",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Precedence": "list",
        "From": "Huawei Xie <huawei.xie@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<1410519304-14521-1-git-send-email-huawei.xie@intel.com>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Fri, 12 Sep 2014 18:55:03 +0800",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v4 4/5] coding style issue fix"
    },
    "content": "This vhost lib is based on old vhost example, and there are still plenty of\ncoding style issues left. Will fix those issues once this patch is applied. \n\nSigned-off-by: Huawei Xie <huawei.xie@intel.com>\nAcked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>\nAcked-by: Tommy Long <thomas.long@intel.com>\n---\n lib/librte_vhost/rte_virtio_net.h |  52 ++++----\n lib/librte_vhost/vhost-net-cdev.c | 256 +++++++++++++++++++-------------------\n lib/librte_vhost/vhost-net-cdev.h |  40 +++---\n lib/librte_vhost/vhost_rxtx.c     |  15 ++-\n lib/librte_vhost/virtio-net.c     |  88 +++++++------\n 5 files changed, 220 insertions(+), 231 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h\nindex 08dc6f4..82eb993 100644\n--- a/lib/librte_vhost/rte_virtio_net.h\n+++ b/lib/librte_vhost/rte_virtio_net.h\n@@ -43,44 +43,38 @@\n #include <rte_mempool.h>\n #include <rte_mbuf.h>\n \n-/* Used to indicate that the device is running on a data core */\n-#define VIRTIO_DEV_RUNNING 1\n-\n-/* Backend value set by guest. */\n-#define VIRTIO_DEV_STOPPED -1\n-\n+#define VIRTIO_DEV_RUNNING 1  /**< Used to indicate that the device is running on a data core. */\n+#define VIRTIO_DEV_STOPPED -1 /**< Backend value set by guest. */\n \n /* Enum for virtqueue management. */\n enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};\n \n-\n-/*\n- * Structure contains variables relevant to TX/RX virtqueues.\n+/**\n+ * Structure contains variables relevant to RX/TX virtqueues.\n  */\n-struct vhost_virtqueue\n-{\n-\tstruct vring_desc\t*desc;\t\t\t\t/* Virtqueue descriptor ring. */\n-\tstruct vring_avail\t*avail;\t\t\t\t/* Virtqueue available ring. */\n-\tstruct vring_used\t*used;\t\t\t\t/* Virtqueue used ring. */\n-\tuint32_t\t\t\tsize;\t\t\t\t/* Size of descriptor ring. */\n-\tuint32_t\t\t\tbackend;\t\t\t/* Backend value to determine if device should started/stopped. */\n-\tuint16_t\t\t\tvhost_hlen;\t\t\t/* Vhost header length (varies depending on RX merge buffers. */\n-\tvolatile uint16_t\tlast_used_idx;\t\t/* Last index used on the available ring */\n-\tvolatile uint16_t\tlast_used_idx_res;\t/* Used for multiple devices reserving buffers. */\n-\teventfd_t\t\t\tcallfd;\t\t\t\t/* Currently unused as polling mode is enabled. */\n-\teventfd_t\t\t\tkickfd;\t\t\t\t/* Used to notify the guest (trigger interrupt). */\n+struct vhost_virtqueue {\n+\tstruct vring_desc    *desc;             /**< descriptor ring. */\n+\tstruct vring_avail   *avail;            /**< available ring. */\n+\tstruct vring_used    *used;             /**< used ring. */\n+\tuint32_t             size;              /**< size of descriptor ring. */\n+\tuint32_t             backend;           /**< backend value to determine if device should be started/stopped. */\n+\tuint16_t             vhost_hlen;        /**< vhost header length (varies depending on RX merge buffers. */\n+\tvolatile uint16_t    last_used_idx;     /**< last index used on the available ring. */\n+\tvolatile uint16_t    last_used_idx_res; /**< used for multiple devices reserving buffers. */\n+\teventfd_t            callfd;            /**< currently unused as polling mode is enabled. */\n+\teventfd_t            kickfd;            /**< used to notify the guest (trigger interrupt). */\n } __rte_cache_aligned;\n \n-\n-/*\n- * Information relating to memory regions including offsets to addresses in QEMUs memory file.\n+/**\n+ * Information relating to memory regions including offsets to\n+ * addresses in QEMU memory file.\n  */\n struct virtio_memory_regions {\n-\tuint64_t\tguest_phys_address;\t\t/* Base guest physical address of region. */\n-\tuint64_t\tguest_phys_address_end;\t/* End guest physical address of region. */\n-\tuint64_t\tmemory_size;\t\t\t/* Size of region. */\n-\tuint64_t\tuserspace_address;\t\t/* Base userspace address of region. */\n-\tuint64_t\taddress_offset;\t\t\t/* Offset of region for address translation. */\n+\tuint64_t    guest_phys_address;     /**< base guest physical address of region. */\n+\tuint64_t    guest_phys_address_end; /**< end guest physical address of region. */\n+\tuint64_t    memory_size;            /**< size of region. */\n+\tuint64_t    userspace_address;      /**< base userspace address of region. */\n+\tuint64_t    address_offset;         /**< offset of region for address translation. */\n };\n \n \ndiff --git a/lib/librte_vhost/vhost-net-cdev.c b/lib/librte_vhost/vhost-net-cdev.c\nindex e73bf23..c3b580a 100644\n--- a/lib/librte_vhost/vhost-net-cdev.c\n+++ b/lib/librte_vhost/vhost-net-cdev.c\n@@ -46,16 +46,16 @@\n \n #include \"vhost-net-cdev.h\"\n \n-#define FUSE_OPT_DUMMY \t\t\"\\0\\0\"\n-#define FUSE_OPT_FORE \t\t\"-f\\0\\0\"\n-#define FUSE_OPT_NOMULTI \t\"-s\\0\\0\"\n+#define FUSE_OPT_DUMMY    \"\\0\\0\"\n+#define FUSE_OPT_FORE     \"-f\\0\\0\"\n+#define FUSE_OPT_NOMULTI  \"-s\\0\\0\"\n \n static const uint32_t\tdefault_major = 231;\n static const uint32_t\tdefault_minor = 1;\n static const char\tcuse_device_name[]\t= \"/dev/cuse\";\n static const char\tdefault_cdev[] = \"vhost-net\";\n \n-static struct fuse_session\t\t\t*session;\n+static struct fuse_session\t\t*session;\n static struct vhost_net_device_ops\tconst *ops;\n \n /*\n@@ -113,61 +113,61 @@ vhost_net_release(fuse_req_t req, struct fuse_file_info *fi)\n  * Boilerplate code for CUSE IOCTL\n  * Implicit arguments: ctx, req, result.\n  */\n-#define VHOST_IOCTL(func) do {\t\t\t\t\t\t\t\t\\\n-\tresult = (func)(ctx);\t\t\t\t\t\t\t\t\t\\\n-\tfuse_reply_ioctl(req, result, NULL, 0);\t\t\t\t\t\\\n-} while(0)\t\t\t\t\t\t\t\t\t\t\t\t\t\n+#define VHOST_IOCTL(func) do { \\\n+\tresult = (func)(ctx); \\\n+\tfuse_reply_ioctl(req, result, NULL, 0); \\\n+} while (0)\n \n /*\n  * Boilerplate IOCTL RETRY\n  * Implicit arguments: req.\n  */\n-#define VHOST_IOCTL_RETRY(size_r, size_w) do {\t\t\t\t\t\t\t\t\t\\\n-\tstruct iovec iov_r = { arg, (size_r) };\t\t\t\t\t\t\t\t\t\t\\\n-\tstruct iovec iov_w = { arg, (size_w) };\t\t\t\t\t\t\t\t\t\t\\\n-\tfuse_reply_ioctl_retry(req, &iov_r, (size_r)?1:0, &iov_w, (size_w)?1:0);\t\\\n-} while(0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define VHOST_IOCTL_RETRY(size_r, size_w) do { \\\n+\tstruct iovec iov_r = { arg, (size_r) }; \\\n+\tstruct iovec iov_w = { arg, (size_w) }; \\\n+\tfuse_reply_ioctl_retry(req, &iov_r, (size_r) ? 1 : 0, &iov_w, (size_w) ? 1 : 0); \\\n+} while (0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n \n /*\n  * Boilerplate code for CUSE Read IOCTL\n  * Implicit arguments: ctx, req, result, in_bufsz, in_buf.\n  */\n-#define VHOST_IOCTL_R(type, var, func) do {\t\t\t\t\\\n-\tif (!in_bufsz) {\t\t\t\t\t\t\t\t\t\\\n-\t\tVHOST_IOCTL_RETRY(sizeof(type), 0);\t\t\t\t\\\n-\t} else {\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t(var) = *(const type * ) in_buf;\t\t\t\t\\\n-\t\tresult = func(ctx, &(var));\t\t\t\t\t\t\\\n-\t\tfuse_reply_ioctl(req, result, NULL, 0);\t\t\t\\\n-\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n-} while(0)\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define VHOST_IOCTL_R(type, var, func) do {             \\\n+\tif (!in_bufsz) {                                \\\n+\t\tVHOST_IOCTL_RETRY(sizeof(type), 0);     \\\n+\t} else {                                        \\\n+\t\t(var) = *(const type*)in_buf;          \\\n+\t\tresult = func(ctx, &(var));             \\\n+\t\tfuse_reply_ioctl(req, result, NULL, 0); \\\n+\t}                                               \\\n+} while (0)\n \n /*\n- *\tBoilerplate code for CUSE Write IOCTL\n+ * Boilerplate code for CUSE Write IOCTL\n  * Implicit arguments: ctx, req, result, out_bufsz.\n  */\n-#define\tVHOST_IOCTL_W(type, var, func) do {\t\t\t\t\t\t\\\n-\tif (!out_bufsz) {\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\tVHOST_IOCTL_RETRY(0, sizeof(type));\t\t\t\t\t\t\\\n-\t} else {\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\tresult = (func)(ctx, &(var));\t\t\t\t\t\t\t\\\n-\t\tfuse_reply_ioctl(req, result, &(var), sizeof(type));\t\\\n-\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n-} while(0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define\tVHOST_IOCTL_W(type, var, func) do {              \\\n+\tif (!out_bufsz) {                                \\\n+\t\tVHOST_IOCTL_RETRY(0, sizeof(type));      \\\n+\t} else {                                         \\\n+\t\tresult = (func)(ctx, &(var));            \\\n+\t\tfuse_reply_ioctl(req, result, &(var), sizeof(type)); \\\n+\t} \\\n+} while (0)\n \n /*\n  * Boilerplate code for CUSE Read/Write IOCTL\n  * Implicit arguments: ctx, req, result, in_bufsz, in_buf.\n  */\n-#define VHOST_IOCTL_RW(type1, var1, type2, var2, func) do {\t\t\t\\\n-\tif (!in_bufsz) {\t\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\tVHOST_IOCTL_RETRY(sizeof(type1), sizeof(type2));\t\t\t\\\n-\t} else {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n-\t\t(var1) = *(const type1* ) (in_buf);\t\t\t\t\t\t\t\\\n-\t\tresult = (func)(ctx, (var1), &(var2));\t\t\t\t\t\t\\\n-\t\tfuse_reply_ioctl(req, result, &(var2), sizeof(type2));\t\t\\\n-\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n-} while(0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\\\n+#define VHOST_IOCTL_RW(type1, var1, type2, var2, func) do {      \\\n+\tif (!in_bufsz) {                                         \\\n+\t\tVHOST_IOCTL_RETRY(sizeof(type1), sizeof(type2)); \\\n+\t} else {                                                 \\\n+\t\t(var1) = *(const type1*) (in_buf);              \\\n+\t\tresult = (func)(ctx, (var1), &(var2));           \\\n+\t\tfuse_reply_ioctl(req, result, &(var2), sizeof(type2));  \\\n+\t} \\\n+} while (0)\n \n /*\n  * The IOCTLs are handled using CUSE/FUSE in userspace. Depending on\n@@ -187,106 +187,104 @@ vhost_net_ioctl(fuse_req_t req, int cmd, void *arg,\n \tuint32_t index;\n \tint result = 0;\n \n-\tswitch(cmd)\n-\t{\n-\t\tcase VHOST_NET_SET_BACKEND:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_NET_SET_BACKEND\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_backend);\n+\tswitch (cmd) {\n+\tcase VHOST_NET_SET_BACKEND:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_NET_SET_BACKEND\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_backend);\n+\t\tbreak;\n+\n+\tcase VHOST_GET_FEATURES:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_GET_FEATURES\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_W(uint64_t, features, ops->get_features);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_FEATURES:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_FEATURES\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(uint64_t, features, ops->set_features);\n+\t\tbreak;\n+\n+\tcase VHOST_RESET_OWNER:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_RESET_OWNER\\n\", ctx.fh);\n+\t\tVHOST_IOCTL(ops->reset_owner);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_OWNER:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_OWNER\\n\", ctx.fh);\n+\t\tVHOST_IOCTL(ops->set_owner);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_MEM_TABLE:\n+\t\t/*TODO fix race condition.*/\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_MEM_TABLE\\n\", ctx.fh);\n+\t\tstatic struct vhost_memory mem_temp;\n+\n+\t\tswitch (in_bufsz) {\n+\t\tcase 0:\n+\t\t\tVHOST_IOCTL_RETRY(sizeof(struct vhost_memory), 0);\n \t\t\tbreak;\n \n-\t\tcase VHOST_GET_FEATURES:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_GET_FEATURES\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_W(uint64_t, features, ops->get_features);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_FEATURES:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_FEATURES\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(uint64_t, features, ops->set_features);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_RESET_OWNER:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_RESET_OWNER\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL(ops->reset_owner);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_OWNER:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_OWNER\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL(ops->set_owner);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_MEM_TABLE:\n-\t\t\t/*TODO fix race condition.*/\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_MEM_TABLE\\n\", ctx.fh);\n-\t\t\tstatic struct vhost_memory mem_temp;\n-\n-\t\t\tswitch(in_bufsz){\n-\t\t\t\tcase 0:\n-\t\t\t\t\tVHOST_IOCTL_RETRY(sizeof(struct vhost_memory), 0);\n-\t\t\t\t\tbreak;\n-\n-\t\t\t\tcase sizeof(struct vhost_memory):\n-\t\t\t\t\tmem_temp = *(const struct vhost_memory *) in_buf;\n-\n-\t\t\t\t\tif (mem_temp.nregions > 0) {\n-\t\t\t\t\t\tVHOST_IOCTL_RETRY(sizeof(struct vhost_memory) + (sizeof(struct vhost_memory_region) * mem_temp.nregions), 0);\n-\t\t\t\t\t} else {\n-\t\t\t\t\t\tresult = -1;\n-\t\t\t\t\t\tfuse_reply_ioctl(req, result, NULL, 0);\n-\t\t\t\t\t}\n-\t\t\t\t\tbreak;\n-\n-\t\t\t\tdefault:\n-\t\t\t\t\tresult = ops->set_mem_table(ctx, in_buf, mem_temp.nregions);\n-\t\t\t\t\tif (result)\n-\t\t\t\t\t\tfuse_reply_err(req, EINVAL);\n-\t\t\t\t\telse\n-\t\t\t\t\t\tfuse_reply_ioctl(req, result, NULL, 0);\n+\t\tcase sizeof(struct vhost_memory):\n+\t\t\tmem_temp = *(const struct vhost_memory *) in_buf;\n \n+\t\t\tif (mem_temp.nregions > 0) {\n+\t\t\t\tVHOST_IOCTL_RETRY(sizeof(struct vhost_memory) + (sizeof(struct vhost_memory_region) * mem_temp.nregions), 0);\n+\t\t\t} else {\n+\t\t\t\tresult = -1;\n+\t\t\t\tfuse_reply_ioctl(req, result, NULL, 0);\n \t\t\t}\n-\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_VRING_NUM:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_NUM\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(struct vhost_vring_state, state, ops->set_vring_num);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_VRING_BASE:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_BASE\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(struct vhost_vring_state, state, ops->set_vring_base);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_GET_VRING_BASE:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_GET_VRING_BASE\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_RW(uint32_t, index, struct vhost_vring_state, state, ops->get_vring_base);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_VRING_ADDR:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_ADDR\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(struct vhost_vring_addr, addr, ops->set_vring_addr);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_VRING_KICK:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_KICK\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_vring_kick);\n-\t\t\tbreak;\n-\n-\t\tcase VHOST_SET_VRING_CALL:\n-\t\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_CALL\\n\", ctx.fh);\n-\t\t\tVHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_vring_call);\n \t\t\tbreak;\n \n \t\tdefault:\n-\t\t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: DOESN NOT EXIST\\n\", ctx.fh);\n-\t\t\tresult = -1;\n-\t\t\tfuse_reply_ioctl(req, result, NULL, 0);\n+\t\t\tresult = ops->set_mem_table(ctx, in_buf, mem_temp.nregions);\n+\t\t\tif (result)\n+\t\t\t\tfuse_reply_err(req, EINVAL);\n+\t\t\telse\n+\t\t\t\tfuse_reply_ioctl(req, result, NULL, 0);\n+\n+\t\t}\n+\n+\t\tbreak;\n+\n+\tcase VHOST_SET_VRING_NUM:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_NUM\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(struct vhost_vring_state, state, ops->set_vring_num);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_VRING_BASE:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_BASE\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(struct vhost_vring_state, state, ops->set_vring_base);\n+\t\tbreak;\n+\n+\tcase VHOST_GET_VRING_BASE:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_GET_VRING_BASE\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_RW(uint32_t, index, struct vhost_vring_state, state, ops->get_vring_base);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_VRING_ADDR:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_ADDR\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(struct vhost_vring_addr, addr, ops->set_vring_addr);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_VRING_KICK:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_KICK\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_vring_kick);\n+\t\tbreak;\n+\n+\tcase VHOST_SET_VRING_CALL:\n+\t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: VHOST_SET_VRING_CALL\\n\", ctx.fh);\n+\t\tVHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_vring_call);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: DOESN NOT EXIST\\n\", ctx.fh);\n+\t\tresult = -1;\n+\t\tfuse_reply_ioctl(req, result, NULL, 0);\n \t}\n \n-\tif (result < 0) {\n+\tif (result < 0)\n \t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: FAIL\\n\", ctx.fh);\n-\t} else {\n+\telse\n \t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") IOCTL: SUCCESS\\n\", ctx.fh);\n-\t}\n }\n \n /*\ndiff --git a/lib/librte_vhost/vhost-net-cdev.h b/lib/librte_vhost/vhost-net-cdev.h\nindex d9a5a9a..d1b2386 100644\n--- a/lib/librte_vhost/vhost-net-cdev.h\n+++ b/lib/librte_vhost/vhost-net-cdev.h\n@@ -72,41 +72,39 @@\n #define VHOST_PRINT_PACKET(device, addr, size, header) do {} while (0)\n #endif\n \n-\n-/*\n+/**\n  * Structure used to identify device context.\n  */\n-struct vhost_device_ctx\n-{\n-\tpid_t\t\tpid;\t/* PID of process calling the IOCTL. */\n-\tuint64_t \tfh;\t\t/* Populated with fi->fh to track the device index. */\n+struct vhost_device_ctx {\n+\tpid_t    pid; /**< PID of process calling the IOCTL. */\n+\tuint64_t fh;  /**< Populated with fi->fh to track the device index. */\n };\n \n-/*\n+/**\n  * Structure contains function pointers to be defined in virtio-net.c. These\n  * functions are called in CUSE context and are used to configure devices.\n  */\n struct vhost_net_device_ops {\n-\tint (* new_device) \t\t(struct vhost_device_ctx);\n-\tvoid (* destroy_device) (struct vhost_device_ctx);\n+\tint (*new_device)(struct vhost_device_ctx);\n+\tvoid (*destroy_device)(struct vhost_device_ctx);\n \n-\tint (* get_features) \t(struct vhost_device_ctx, uint64_t *);\n-\tint (* set_features) \t(struct vhost_device_ctx, uint64_t *);\n+\tint (*get_features)(struct vhost_device_ctx, uint64_t *);\n+\tint (*set_features)(struct vhost_device_ctx, uint64_t *);\n \n-\tint (* set_mem_table) \t(struct vhost_device_ctx, const void *, uint32_t);\n+\tint (*set_mem_table)(struct vhost_device_ctx, const void *, uint32_t);\n \n-\tint (* set_vring_num) \t(struct vhost_device_ctx, struct vhost_vring_state *);\n-\tint (* set_vring_addr) \t(struct vhost_device_ctx, struct vhost_vring_addr *);\n-\tint (* set_vring_base) \t(struct vhost_device_ctx, struct vhost_vring_state *);\n-\tint (* get_vring_base) \t(struct vhost_device_ctx, uint32_t, struct vhost_vring_state *);\n+\tint (*set_vring_num)(struct vhost_device_ctx, struct vhost_vring_state *);\n+\tint (*set_vring_addr)(struct vhost_device_ctx, struct vhost_vring_addr *);\n+\tint (*set_vring_base)(struct vhost_device_ctx, struct vhost_vring_state *);\n+\tint (*get_vring_base)(struct vhost_device_ctx, uint32_t, struct vhost_vring_state *);\n \n-\tint (* set_vring_kick) \t(struct vhost_device_ctx, struct vhost_vring_file *);\n-\tint (* set_vring_call) \t(struct vhost_device_ctx, struct vhost_vring_file *);\n+\tint (*set_vring_kick)(struct vhost_device_ctx, struct vhost_vring_file *);\n+\tint (*set_vring_call)(struct vhost_device_ctx, struct vhost_vring_file *);\n \n-\tint (* set_backend) \t(struct vhost_device_ctx, struct vhost_vring_file *);\n+\tint (*set_backend)(struct vhost_device_ctx, struct vhost_vring_file *);\n \n-\tint (* set_owner) \t\t(struct vhost_device_ctx);\n-\tint (* reset_owner) \t(struct vhost_device_ctx);\n+\tint (*set_owner)(struct vhost_device_ctx);\n+\tint (*reset_owner)(struct vhost_device_ctx);\n };\n \n \ndiff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c\nindex 0d96c43..65cfac5 100644\n--- a/lib/librte_vhost/vhost_rxtx.c\n+++ b/lib/librte_vhost/vhost_rxtx.c\n@@ -56,7 +56,7 @@ rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id, struct rte_mb\n \tstruct vring_desc *desc;\n \tstruct rte_mbuf *buff;\n \t/* The virtio_hdr is initialised to 0. */\n-\tstruct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0,0,0,0,0,0},0};\n+\tstruct virtio_net_hdr_mrg_rxbuf virtio_hdr = {{0, 0, 0, 0, 0, 0}, 0};\n \tuint64_t buff_addr = 0;\n \tuint64_t buff_hdr_addr = 0;\n \tuint32_t head[VHOST_MAX_PKT_BURST], packet_len = 0;\n@@ -67,7 +67,7 @@ rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id, struct rte_mb\n \tuint16_t free_entries;\n \tuint8_t success = 0;\n \n-\tLOG_DEBUG(VHOST_DATA, \"(%\"PRIu64\") virtio_dev_rx()\\n\", dev->device_fh);\n+\tLOG_DEBUG(VHOST_DATA, \"(%\"PRIu64\") %s()\\n\", dev->device_fh, __func__);\n \tif (unlikely(queue_id != VIRTIO_RXQ)) {\n \t\tLOG_DEBUG(VHOST_DATA, \"mq isn't supported in this version.\\n\");\n \t\treturn 0;\n@@ -96,7 +96,9 @@ rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id, struct rte_mb\n \t\t/* If there is contention here and failed, try again. */\n \t} while (unlikely(success == 0));\n \tres_cur_idx = res_base_idx;\n-\tLOG_DEBUG(VHOST_DATA, \"(%\"PRIu64\") Current Index %d| End Index %d\\n\", dev->device_fh, res_cur_idx, res_end_idx);\n+\tLOG_DEBUG(VHOST_DATA, \"(%\"PRIu64\") Current Index %d| End Index %d\\n\",\n+\t\t\tdev->device_fh,\n+\t\t\tres_cur_idx, res_end_idx);\n \n \t/* Prefetch available ring to retrieve indexes. */\n \trte_prefetch0(&vq->avail->ring[res_cur_idx & (vq->size - 1)]);\n@@ -120,7 +122,7 @@ rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id, struct rte_mb\n \t\t/* Convert from gpa to vva (guest physical addr -> vhost virtual addr) */\n \t\tbuff_addr = gpa_to_vva(dev, desc->addr);\n \t\t/* Prefetch buffer address. */\n-\t\trte_prefetch0((void*)(uintptr_t)buff_addr);\n+\t\trte_prefetch0((void *)(uintptr_t)buff_addr);\n \n \t\tif (mergeable && (mrg_count != 0)) {\n \t\t\tdesc->len = packet_len = rte_pktmbuf_data_len(buff);\n@@ -155,12 +157,13 @@ rte_vhost_enqueue_burst(struct virtio_net *dev, uint16_t queue_id, struct rte_mb\n \t\trte_memcpy((void *)(uintptr_t)buff_addr,\n \t\t\t(const void *)buff->pkt.data,\n \t\t\trte_pktmbuf_data_len(buff));\n+\n \t\tVHOST_PRINT_PACKET(dev, (uintptr_t)buff_addr,\n \t\t\trte_pktmbuf_data_len(buff), 0);\n \n \t\tres_cur_idx++;\n \t\tpacket_success++;\n-\t\n+\n \t\t/* If mergeable is disabled then a header is required per buffer. */\n \t\tif (!mergeable) {\n \t\t\trte_memcpy((void *)(uintptr_t)buff_hdr_addr, (const void *)&virtio_hdr, vq->vhost_hlen);\n@@ -255,7 +258,7 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id, struct rte_me\n \t\t/* Buffer address translation. */\n \t\tbuff_addr = gpa_to_vva(dev, desc->addr);\n \t\t/* Prefetch buffer address. */\n-\t\trte_prefetch0((void*)(uintptr_t)buff_addr);\n+\t\trte_prefetch0((void *)(uintptr_t)buff_addr);\n \n \t\tused_idx = vq->last_used_idx & (vq->size - 1);\n \ndiff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c\nindex 9852961..e6d331a 100644\n--- a/lib/librte_vhost/virtio-net.c\n+++ b/lib/librte_vhost/virtio-net.c\n@@ -63,9 +63,9 @@ struct virtio_net_config_ll {\n static const char eventfd_cdev[] = \"/dev/eventfd-link\";\n \n /* device ops to add/remove device to data core. */\n-static struct virtio_net_device_ops const * notify_ops;\n+static struct virtio_net_device_ops const *notify_ops;\n /* Root address of the linked list in the configuration core. */\n-static struct virtio_net_config_ll\t\t\t*ll_root = NULL;\n+static struct virtio_net_config_ll *ll_root;\n \n /* Features supported by this library. */\n #define VHOST_SUPPORTED_FEATURES (1ULL << VIRTIO_NET_F_MRG_RXBUF)\n@@ -81,16 +81,15 @@ static const uint32_t BUFSIZE = PATH_MAX;\n #define PROCMAP_SZ 8\n \n /* Structure containing information gathered from maps file. */\n-struct procmap\n-{\n-\tuint64_t\tva_start;\t\t\t/* Start virtual address in file. */\n-\tuint64_t\tlen;\t\t\t\t/* Size of file. */\n-\tuint64_t\tpgoff;\t\t\t\t/* Not used. */\n-\tuint32_t\tmaj;\t\t\t\t/* Not used. */\n-\tuint32_t\tmin;\t\t\t\t/* Not used. */\n-\tuint32_t\tino;\t\t\t\t/* Not used. */\n-\tchar\t\tprot[PROT_SZ];\t\t/* Not used. */\n-\tchar\t\tfname[PATH_MAX];\t/* File name. */\n+struct procmap {\n+\tuint64_t    va_start;         /* Start virtual address in file. */\n+\tuint64_t    len;              /* Size of file. */\n+\tuint64_t    pgoff;            /* Not used. */\n+\tuint32_t    maj;              /* Not used. */\n+\tuint32_t    min;              /* Not used. */\n+\tuint32_t    ino;              /* Not used. */\n+\tchar        prot[PROT_SZ];    /* Not used. */\n+\tchar        fname[PATH_MAX];  /* File name. */\n };\n \n /*\n@@ -108,8 +107,8 @@ qva_to_vva(struct virtio_net *dev, uint64_t qemu_va)\n \tfor (regionidx = 0; regionidx < dev->mem->nregions; regionidx++) {\n \t\tregion = &dev->mem->regions[regionidx];\n \t\tif ((qemu_va >= region->userspace_address) &&\n-\t\t\t\t(qemu_va <= region->userspace_address +\n-\t\t\t \tregion->memory_size)) {\n+\t\t\t(qemu_va <= region->userspace_address +\n+\t\t\tregion->memory_size)) {\n \t\t\tvhost_va = dev->mem->mapped_address + qemu_va - dev->mem->base_address;\n \t\t\tbreak;\n \t\t}\n@@ -121,7 +120,7 @@ qva_to_vva(struct virtio_net *dev, uint64_t qemu_va)\n  * Locate the file containing QEMU's memory space and map it to our address space.\n  */\n static int\n-host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, uint64_t addr)\n+host_memory_map(struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, uint64_t addr)\n {\n \tstruct dirent *dptr = NULL;\n \tstruct procmap procmap;\n@@ -132,18 +131,18 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u\n \tchar mapfile[PATH_MAX];\n \tchar procdir[PATH_MAX];\n \tchar resolved_path[PATH_MAX];\n-\tFILE\t\t*fmap;\n-\tvoid\t\t*map;\n-\tuint8_t \tfound = 0;\n-\tchar \t\tline[BUFSIZE];\n+\tFILE *fmap;\n+\tvoid *map;\n+\tuint8_t\tfound = 0;\n+\tchar line[BUFSIZE];\n \tchar dlm[] = \"-   :   \";\n \tchar *str, *sp, *in[PROCMAP_SZ];\n \tchar *end = NULL;\n \n \t/* Path where mem files are located. */\n-\tsnprintf (procdir, PATH_MAX, \"/proc/%u/fd/\", pid);\n+\tsnprintf(procdir, PATH_MAX, \"/proc/%u/fd/\", pid);\n \t/* Maps file used to locate mem file. */\n-\tsnprintf (mapfile, PATH_MAX, \"/proc/%u/maps\", pid);\n+\tsnprintf(mapfile, PATH_MAX, \"/proc/%u/maps\", pid);\n \n \tfmap = fopen(mapfile, \"r\");\n \tif (fmap == NULL) {\n@@ -157,7 +156,8 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u\n \t\terrno = 0;\n \t\t/* Split line in to fields. */\n \t\tfor (i = 0; i < PROCMAP_SZ; i++) {\n-\t\t\tif (((in[i] = strtok_r(str, &dlm[i], &sp)) == NULL) || (errno != 0)) {\n+\t\t\tin[i] = strtok_r(str, &dlm[i], &sp);\n+\t\t\tif ((in[i] == NULL) || (errno != 0)) {\n \t\t\t\tfclose(fmap);\n \t\t\t\treturn -1;\n \t\t\t}\n@@ -220,7 +220,7 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u\n \t/* Find the guest memory file among the process fds. */\n \tdp = opendir(procdir);\n \tif (dp == NULL) {\n-\t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Cannot open pid %d process directory \\n\", dev->device_fh, pid);\n+\t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Cannot open pid %d process directory\\n\", dev->device_fh, pid);\n \t\treturn -1;\n \n \t}\n@@ -229,8 +229,8 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u\n \n \t/* Read the fd directory contents. */\n \twhile (NULL != (dptr = readdir(dp))) {\n-\t\tsnprintf (memfile, PATH_MAX, \"/proc/%u/fd/%s\", pid, dptr->d_name);\n-\t    realpath(memfile, resolved_path);\n+\t\tsnprintf(memfile, PATH_MAX, \"/proc/%u/fd/%s\", pid, dptr->d_name);\n+\t\trealpath(memfile, resolved_path);\n \t\tif (resolved_path == NULL) {\n \t\t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Failed to resolve fd directory\\n\", dev->device_fh);\n \t\t\tclosedir(dp);\n@@ -258,7 +258,7 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u\n \t}\n \n \tmap = mmap(0, (size_t)procmap.len, PROT_READ|PROT_WRITE , MAP_POPULATE|MAP_SHARED, fd, 0);\n-\tclose (fd);\n+\tclose(fd);\n \n \tif (map == MAP_FAILED) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Error mapping the file %s for pid %d\\n\",  dev->device_fh, memfile, pid);\n@@ -304,9 +304,8 @@ get_device(struct vhost_device_ctx ctx)\n \tll_dev = get_config_ll_entry(ctx);\n \n \t/* If a matching entry is found in the linked list, return the device in that entry. */\n-\tif (ll_dev) {\n+\tif (ll_dev)\n \t\treturn &ll_dev->dev;\n-\t}\n \n \tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Device not found in linked list.\\n\", ctx.fh);\n \treturn NULL;\n@@ -351,7 +350,7 @@ cleanup_device(struct virtio_net *dev)\n {\n \t/* Unmap QEMU memory file if mapped. */\n \tif (dev->mem) {\n-\t\tmunmap((void*)(uintptr_t)dev->mem->mapped_address, (size_t)dev->mem->mapped_size);\n+\t\tmunmap((void *)(uintptr_t)dev->mem->mapped_address, (size_t)dev->mem->mapped_size);\n \t\tfree(dev->mem);\n \t}\n \n@@ -416,7 +415,7 @@ init_device(struct virtio_net *dev)\n \tvq_offset = offsetof(struct virtio_net, mem);\n \n \t/* Set everything to 0. */\n-\tmemset((void*)(uintptr_t)((uint64_t)(uintptr_t)dev + vq_offset), 0,\n+\tmemset((void *)(uintptr_t)((uint64_t)(uintptr_t)dev + vq_offset), 0,\n \t\t(sizeof(struct virtio_net) - (size_t)vq_offset));\n \tmemset(dev->virtqueue[VIRTIO_RXQ], 0, sizeof(struct vhost_virtqueue));\n \tmemset(dev->virtqueue[VIRTIO_TXQ], 0, sizeof(struct vhost_virtqueue));\n@@ -495,6 +494,7 @@ destroy_device(struct vhost_device_ctx ctx)\n \t\t\tif ((ll_dev_cur->dev.flags & VIRTIO_DEV_RUNNING))\n \t\t\t\tnotify_ops->destroy_device(&(ll_dev_cur->dev));\n \t\t\tll_dev_cur = rm_config_ll_entry(ll_dev_cur, ll_dev_last);\n+\t\t\t/*TODO return here? */\n \t\t} else {\n \t\t\tll_dev_last = ll_dev_cur;\n \t\t\tll_dev_cur = ll_dev_cur->next;\n@@ -603,7 +603,7 @@ set_mem_table(struct vhost_device_ctx ctx, const void *mem_regions_addr, uint32_\n \t\treturn -1;\n \n \tif (dev->mem) {\n-\t\tmunmap((void*)(uintptr_t)dev->mem->mapped_address, (size_t)dev->mem->mapped_size);\n+\t\tmunmap((void *)(uintptr_t)dev->mem->mapped_address, (size_t)dev->mem->mapped_size);\n \t\tfree(dev->mem);\n \t}\n \n@@ -616,7 +616,7 @@ set_mem_table(struct vhost_device_ctx ctx, const void *mem_regions_addr, uint32_\n \n \tmem->nregions = nregions;\n \n-\tmem_regions = (void*)(uintptr_t)((uint64_t)(uintptr_t)mem_regions_addr + size);\n+\tmem_regions = (void *)(uintptr_t)((uint64_t)(uintptr_t)mem_regions_addr + size);\n \n \tfor (regionidx = 0; regionidx < mem->nregions; regionidx++) {\n \t\t/* Populate the region structure for each region. */\n@@ -627,8 +627,8 @@ set_mem_table(struct vhost_device_ctx ctx, const void *mem_regions_addr, uint32_\n \t\tmem->regions[regionidx].userspace_address = mem_regions[regionidx].userspace_addr;\n \n \t\tLOG_DEBUG(VHOST_CONFIG, \"(%\"PRIu64\") REGION: %u - GPA: %p - QEMU VA: %p - SIZE (%\"PRIu64\")\\n\", dev->device_fh,\n-\t\t\t\tregionidx, (void*)(uintptr_t)mem->regions[regionidx].guest_phys_address,\n-\t\t\t\t(void*)(uintptr_t)mem->regions[regionidx].userspace_address,\n+\t\t\t\tregionidx, (void *)(uintptr_t)mem->regions[regionidx].guest_phys_address,\n+\t\t\t\t(void *)(uintptr_t)mem->regions[regionidx].userspace_address,\n \t\t\t\tmem->regions[regionidx].memory_size);\n \n \t\t/*set the base address mapping*/\n@@ -682,11 +682,10 @@ set_mem_table(struct vhost_device_ctx ctx, const void *mem_regions_addr, uint32_\n \t * Calculate the address offset for each region. This offset is used to identify the vhost virtual address\n \t * corresponding to a QEMU guest physical address.\n \t */\n-\tfor (regionidx = 0; regionidx < dev->mem->nregions; regionidx++) {\n+\tfor (regionidx = 0; regionidx < dev->mem->nregions; regionidx++)\n \t\tdev->mem->regions[regionidx].address_offset = dev->mem->regions[regionidx].userspace_address - dev->mem->base_address\n \t\t\t+ dev->mem->mapped_address - dev->mem->regions[regionidx].guest_phys_address;\n \n-\t}\n \treturn 0;\n }\n \n@@ -728,19 +727,19 @@ set_vring_addr(struct vhost_device_ctx ctx, struct vhost_vring_addr *addr)\n \tvq = dev->virtqueue[addr->index];\n \n \t/* The addresses are converted from QEMU virtual to Vhost virtual. */\n-\tvq->desc = (struct vring_desc*)(uintptr_t)qva_to_vva(dev, addr->desc_user_addr);\n+\tvq->desc = (struct vring_desc *)(uintptr_t)qva_to_vva(dev, addr->desc_user_addr);\n \tif (vq->desc == 0) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Failed to find descriptor ring address.\\n\", dev->device_fh);\n \t\treturn -1;\n \t}\n \n-\tvq->avail = (struct vring_avail*)(uintptr_t)qva_to_vva(dev, addr->avail_user_addr);\n+\tvq->avail = (struct vring_avail *)(uintptr_t)qva_to_vva(dev, addr->avail_user_addr);\n \tif (vq->avail == 0) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Failed to find available ring address.\\n\", dev->device_fh);\n \t\treturn -1;\n \t}\n \n-\tvq->used = (struct vring_used*)(uintptr_t)qva_to_vva(dev, addr->used_user_addr);\n+\tvq->used = (struct vring_used *)(uintptr_t)qva_to_vva(dev, addr->used_user_addr);\n \tif (vq->used == 0) {\n \t\tRTE_LOG(ERR, VHOST_CONFIG, \"(%\"PRIu64\") Failed to find used ring address.\\n\", dev->device_fh);\n \t\treturn -1;\n@@ -885,7 +884,7 @@ set_vring_kick(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n \teventfd_call.target_pid = ctx.pid;\n \n \tif (eventfd_copy(dev, &eventfd_call))\n-        return -1;\n+\t\treturn -1;\n \n \treturn 0;\n }\n@@ -903,9 +902,8 @@ set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n \tstruct virtio_net *dev;\n \n \tdev = get_device(ctx);\n-\tif (dev == NULL) {\n+\tif (dev == NULL)\n \t\treturn -1;\n-\t}\n \n \t/* file->index refers to the queue index. The TX queue is 1, RX queue is 0. */\n \tdev->virtqueue[file->index]->backend = file->fd;\n@@ -917,9 +915,8 @@ set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n \t\t\treturn notify_ops->new_device(dev);\n \t/* Otherwise we remove it. */\n \t} else\n-\t\tif (file->fd == VIRTIO_DEV_STOPPED) {\n+\t\tif (file->fd == VIRTIO_DEV_STOPPED)\n \t\t\tnotify_ops->destroy_device(dev);\n-\t\t}\n \treturn 0;\n }\n \n@@ -927,8 +924,7 @@ set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n  * Function pointers are set for the device operations to allow CUSE to call functions\n  * when an IOCTL, device_add or device_release is received.\n  */\n-static const struct vhost_net_device_ops vhost_device_ops =\n-{\n+static const struct vhost_net_device_ops vhost_device_ops = {\n \t.new_device = new_device,\n \t.destroy_device = destroy_device,\n \n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "4/5"
    ]
}