All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: qemu-block@nongnu.org,  qemu-devel@nongnu.org,
	 pbonzini@redhat.com, eblake@redhat.com,  hreitz@redhat.com,
	 kwolf@redhat.com
Subject: Re: [PATCH v9 2/7] block/export: add blk_by_export_id()
Date: Thu, 18 Jul 2024 13:48:25 +0200	[thread overview]
Message-ID: <87ed7qc452.fsf@pond.sub.org> (raw)
In-Reply-To: <20240626115350.405778-3-vsementsov@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Wed, 26 Jun 2024 14:53:45 +0300")

Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:

> We need it for further blockdev-replace functionality.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  block/export/export.c                       | 18 ++++++++++++++++++
>  include/sysemu/block-backend-global-state.h |  1 +
>  2 files changed, 19 insertions(+)
>
> diff --git a/block/export/export.c b/block/export/export.c
> index 6d51ae8ed7..57beae7982 100644
> --- a/block/export/export.c
> +++ b/block/export/export.c
> @@ -355,3 +355,21 @@ BlockExportInfoList *qmp_query_block_exports(Error **errp)
>  
>      return head;
>  }
> +
> +BlockBackend *blk_by_export_id(const char *id, Error **errp)
> +{
> +    BlockExport *exp;
> +
> +    exp = blk_exp_find(id);
> +    if (exp == NULL) {
> +        error_setg(errp, "Export '%s' not found", id);
> +        return NULL;
> +    }
> +
> +    if (!exp->blk) {
> +        error_setg(errp, "Export '%s' is empty", id);

Can this happen?

> +        return NULL;
> +    }
> +
> +    return exp->blk;
> +}
> diff --git a/include/sysemu/block-backend-global-state.h b/include/sysemu/block-backend-global-state.h
> index ccb35546a1..410d0cc5c7 100644
> --- a/include/sysemu/block-backend-global-state.h
> +++ b/include/sysemu/block-backend-global-state.h
> @@ -74,6 +74,7 @@ void blk_detach_dev(BlockBackend *blk, DeviceState *dev);
>  DeviceState *blk_get_attached_dev(BlockBackend *blk);
>  BlockBackend *blk_by_dev(void *dev);
>  BlockBackend *blk_by_qdev_id(const char *id, Error **errp);
> +BlockBackend *blk_by_export_id(const char *id, Error **errp);
>  void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque);
>  
>  void blk_activate(BlockBackend *blk, Error **errp);



  reply	other threads:[~2024-07-18 11:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26 11:53 [PATCH v9 0/7] blockdev-replace Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 1/7] block-backend: blk_root(): drop const specifier on return type Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 2/7] block/export: add blk_by_export_id() Vladimir Sementsov-Ogievskiy
2024-07-18 11:48   ` Markus Armbruster [this message]
2024-07-19 10:59     ` Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 3/7] block: make bdrv_find_child() function public Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 4/7] qapi: add blockdev-replace command Vladimir Sementsov-Ogievskiy
2024-07-18 12:00   ` Markus Armbruster
2024-07-19 16:00     ` Vladimir Sementsov-Ogievskiy
2024-10-02 14:41   ` Vladimir Sementsov-Ogievskiy
2024-10-04 17:01     ` Vladimir Sementsov-Ogievskiy
2024-10-18 13:59       ` Kevin Wolf
2025-04-02 13:05         ` Vladimir Sementsov-Ogievskiy
2025-11-17 10:49           ` Kevin Wolf
2025-11-18  7:37             ` Vladimir Sementsov-Ogievskiy
2025-11-18  9:47               ` Kevin Wolf
2025-11-18 12:19                 ` Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 5/7] block: bdrv_get_xdbg_block_graph(): report export ids Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 6/7] iotests.py: introduce VM.assert_edges_list() method Vladimir Sementsov-Ogievskiy
2024-06-26 11:53 ` [PATCH v9 7/7] iotests: add filter-insertion Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ed7qc452.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.