From patchwork Wed Oct 14 13:16:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 530175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E1CF01401DE for ; Thu, 15 Oct 2015 00:18:44 +1100 (AEDT) Received: from localhost ([::1]:42284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmLx4-0005rh-R1 for incoming@patchwork.ozlabs.org; Wed, 14 Oct 2015 09:18:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmLun-0004Sh-4C for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:16:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmLuh-0004SP-CE for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:16:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49440) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmLuZ-0004R4-SE; Wed, 14 Oct 2015 09:16:07 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 6DB1BAB4; Wed, 14 Oct 2015 13:16:07 +0000 (UTC) Received: from localhost (ovpn-112-44.phx2.redhat.com [10.3.112.44]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9EDG5IV010671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA256 bits=256 verify=NO); Wed, 14 Oct 2015 09:16:06 -0400 From: Jeff Cody To: qemu-devel@nongnu.org Date: Wed, 14 Oct 2015 09:16:00 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, berto@igalia.com, armbru@redhat.com, qemu-block@nongnu.org, quintela@redhat.com Subject: [Qemu-devel] [PATCH 1/3] block: Use bdrv_lookup_bs() instead of bdrv_find_node() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is a precursor to making bdrv_find_node() static, and internal to block.c To find a BlockDriverState interface, it can be done via blk_by_name(), bdrv_find_node(), and bdrv_lookup_bs(). The latter can take the place of the other two, in the instances where we are only concerned with the BlockDriverState. There is no benefit in calling bdrv_find_node() directly. This patch replaces all calls to bdrv_find_node() outside of block.c with bdrv_lookup_bs(). Signed-off-by: Jeff Cody Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia --- block/block-backend.c | 2 +- block/mirror.c | 2 +- block/write-threshold.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 2256551..7026a3f 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -67,7 +67,7 @@ BlockBackend *blk_new(const char *name, Error **errp) error_setg(errp, "Device with id '%s' already exists", name); return NULL; } - if (bdrv_find_node(name)) { + if (bdrv_lookup_bs(NULL, name, NULL)) { error_setg(errp, "Device name '%s' conflicts with an existing node name", name); diff --git a/block/mirror.c b/block/mirror.c index 7e43511..cb3c765 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -644,7 +644,7 @@ static void mirror_complete(BlockJob *job, Error **errp) if (s->replaces) { AioContext *replace_aio_context; - s->to_replace = bdrv_find_node(s->replaces); + s->to_replace = bdrv_lookup_bs(NULL, s->replaces, NULL); if (!s->to_replace) { error_setg(errp, "Node name '%s' not found", s->replaces); return; diff --git a/block/write-threshold.c b/block/write-threshold.c index a53c1f5..908fa7f 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -110,7 +110,7 @@ void qmp_block_set_write_threshold(const char *node_name, BlockDriverState *bs; AioContext *aio_context; - bs = bdrv_find_node(node_name); + bs = bdrv_lookup_bs(NULL, node_name, NULL); if (!bs) { error_setg(errp, "Device '%s' not found", node_name); return;