From patchwork Wed Mar 20 11:26:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10861435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A4E9317E0 for ; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8587E29B54 for ; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79E5429B56; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2C70129B54 for ; Wed, 20 Mar 2019 11:33:50 +0000 (UTC) Received: from localhost ([127.0.0.1]:46475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZTh-0003zd-9n for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Mar 2019 07:33:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ZNl-0007r1-8G for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ZNk-0003wR-HE for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:41 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:42947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ZNk-0003vH-4A for qemu-devel@nongnu.org; Wed, 20 Mar 2019 07:27:40 -0400 Received: by mail-pg1-x543.google.com with SMTP id p6so1585208pgh.9 for ; Wed, 20 Mar 2019 04:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4B3BH1ILWujJPaM/a9P3rPutgoh2mf8u1LXdt6dGLB8=; b=ZeTf3Ilu8M+T/GrmeWT+l0X2TlHXjWksAcgpaKemSeT2hLYi0uJE5VjvZdqQxsRZeB 4Lu2hCIAYdkR7lusq/INinOnzl6iwksVKwdZ+zxtEfKIDKdsejtmUkGUhxPijERSwQNf /5wXFGu47ukNH8UL1gy5xOyDwV9p5N6v+bkl0Gfw4lGi7I9G5/quVGZ6jP+LPMzZ9/v1 xJfiNtEPW5KEjRnNBEbr77sUkbTifKwLKuDt5un9BSQPI1cOEA/WQAODR9es1iPnMzO4 DjOCieyrPs9wG10b5h/+IS6HCzm1T77stHvLWPvkHcQajBXyG+8jt0gbRidWp5hA5LFD oYow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4B3BH1ILWujJPaM/a9P3rPutgoh2mf8u1LXdt6dGLB8=; b=S1PcFSRq6tW8OR+43WSKsway+SCkTijlXyg5PGeut1jHiMvpsInHLRN+XE7+8B4uk/ W65K3mOURBIs1/DRI2eu44lmFY8fUWyZrZAop7IsOJLLYxmOm49wM3GTg/1WaEvNwz5Z dZLFGIewhlT0JHfZvVIoYJ6U6Tw+x5X0V3s0py/uJBgeDUcHvAn2LrUcJPTwIHK+Q2Jj Lph6dQnkn6+9PyobAGii4og4vwmysFjLiuT2B1Jy6GuP6XkrLfup0pM5yqNsbqrSWOP4 oas251rhDrpBR8ciBxBD1REUHfBIeZ2SYXt+vZE6NmuFm07ih/rkTTlOiGTNqAnN0QaH N9ew== X-Gm-Message-State: APjAAAVVjLbZqc7kQp3wuqFy6J3CpZjoujqU1I0JHhnBC2JtYxyx5z8G aybBnio0A/D0HiVWeQeDcK8= X-Google-Smtp-Source: APXvYqz3jXLiak0jSmjg34g6SSW0YF+Cck0veDa1sbj0Qa4BLHmzG1+rDbHCJeNpRCUGt8prqVWudg== X-Received: by 2002:a63:190d:: with SMTP id z13mr4270470pgl.432.1553081259298; Wed, 20 Mar 2019 04:27:39 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id x23sm2195666pgf.10.2019.03.20.04.27.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 04:27:38 -0700 (PDT) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, kwolf@redhat.com, mreitz@redhat.com, stefanha@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru, changpeng.liu@intel.com Date: Wed, 20 Mar 2019 19:26:44 +0800 Message-Id: <20190320112646.3712-6-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190320112646.3712-1-xieyongji@baidu.com> References: <20190320112646.3712-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v8 5/7] vhost-user-blk: Add return value for vhost_user_blk_start() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji Add a return value for vhost_user_blk_start() to check whether we start vhost-user backend successfully or not. Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- hw/block/vhost-user-blk.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 39e1adc60a..6802c19d65 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -103,7 +103,7 @@ const VhostDevConfigOps blk_ops = { .vhost_dev_config_notifier = vhost_user_blk_handle_config_change, }; -static void vhost_user_blk_start(VirtIODevice *vdev) +static int vhost_user_blk_start(VirtIODevice *vdev) { VHostUserBlk *s = VHOST_USER_BLK(vdev); BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); @@ -112,13 +112,13 @@ static void vhost_user_blk_start(VirtIODevice *vdev) if (!k->set_guest_notifiers) { error_report("binding does not support guest notifiers"); - return; + return -ENOSYS; } ret = vhost_dev_enable_notifiers(&s->dev, vdev); if (ret < 0) { error_report("Error enabling host notifiers: %d", -ret); - return; + return ret; } ret = k->set_guest_notifiers(qbus->parent, s->dev.nvqs, true); @@ -157,12 +157,13 @@ static void vhost_user_blk_start(VirtIODevice *vdev) vhost_virtqueue_mask(&s->dev, vdev, i, false); } - return; + return ret; err_guest_notifiers: k->set_guest_notifiers(qbus->parent, s->dev.nvqs, false); err_host_notifiers: vhost_dev_disable_notifiers(&s->dev, vdev); + return ret; } static void vhost_user_blk_stop(VirtIODevice *vdev)