From nobody Tue Nov 4 14:51:50 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530145806710956.9022637840467; Wed, 27 Jun 2018 17:30:06 -0700 (PDT) Received: from localhost ([::1]:33897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYKp3-0005IP-S5 for importer@patchew.org; Wed, 27 Jun 2018 20:30:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYKU6-0004mR-6a for qemu-devel@nongnu.org; Wed, 27 Jun 2018 20:08:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYKU5-0004U0-1A for qemu-devel@nongnu.org; Wed, 27 Jun 2018 20:08:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43530 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fYKU1-0004KV-NT; Wed, 27 Jun 2018 20:08:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61347401EF04; Thu, 28 Jun 2018 00:08:21 +0000 (UTC) Received: from localhost (unknown [10.40.205.153]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BC3611166E8; Thu, 28 Jun 2018 00:08:20 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 28 Jun 2018 02:07:31 +0200 Message-Id: <20180628000745.4477-18-mreitz@redhat.com> In-Reply-To: <20180628000745.4477-1-mreitz@redhat.com> References: <20180628000745.4477-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 28 Jun 2018 00:08:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 28 Jun 2018 00:08:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mreitz@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v9 17/31] block/nbd: Make bdrv_dirname() return NULL 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: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The generic bdrv_dirname() implementation would be able to generate some form of directory name for many NBD nodes, but it would be always wrong. Therefore, we have to explicitly make it an error (until NBD has some form of specification for export paths, if it ever will). Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Reviewed-by: Eric Blake --- block/nbd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/block/nbd.c b/block/nbd.c index 13db4030e6..0cd5865558 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -558,6 +558,16 @@ static void nbd_refresh_filename(BlockDriverState *bs,= QDict *options) bs->full_open_options =3D opts; } =20 +static char *nbd_dirname(BlockDriverState *bs, Error **errp) +{ + /* The generic bdrv_dirname() implementation is able to work out some + * directory name for NBD nodes, but that would be wrong. So far there= is no + * specification for how "export paths" would work, so NBD does not ha= ve + * directory names. */ + error_setg(errp, "Cannot generate a base directory for NBD nodes"); + return NULL; +} + static BlockDriver bdrv_nbd =3D { .format_name =3D "nbd", .protocol_name =3D "nbd", @@ -576,6 +586,7 @@ static BlockDriver bdrv_nbd =3D { .bdrv_attach_aio_context =3D nbd_attach_aio_context, .bdrv_refresh_filename =3D nbd_refresh_filename, .bdrv_co_block_status =3D nbd_client_co_block_status, + .bdrv_dirname =3D nbd_dirname, }; =20 static BlockDriver bdrv_nbd_tcp =3D { @@ -596,6 +607,7 @@ static BlockDriver bdrv_nbd_tcp =3D { .bdrv_attach_aio_context =3D nbd_attach_aio_context, .bdrv_refresh_filename =3D nbd_refresh_filename, .bdrv_co_block_status =3D nbd_client_co_block_status, + .bdrv_dirname =3D nbd_dirname, }; =20 static BlockDriver bdrv_nbd_unix =3D { @@ -616,6 +628,7 @@ static BlockDriver bdrv_nbd_unix =3D { .bdrv_attach_aio_context =3D nbd_attach_aio_context, .bdrv_refresh_filename =3D nbd_refresh_filename, .bdrv_co_block_status =3D nbd_client_co_block_status, + .bdrv_dirname =3D nbd_dirname, }; =20 static void bdrv_nbd_init(void) --=20 2.17.1