qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	qemu-block@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Coiby Xu <Coiby.Xu@gmail.com>, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH 3/4] block: move block exports to libblockdev
Date: Fri, 25 Sep 2020 16:11:54 +0200	[thread overview]
Message-ID: <48e58e9a-0feb-66b4-0e41-9ee01e2e272f@redhat.com> (raw)
In-Reply-To: <20200925134229.246169-4-stefanha@redhat.com>

On 25/09/20 15:42, Stefan Hajnoczi wrote:
> Block exports are used by softmmu, qemu-storage-daemon, and qemu-nbd.
> They are not used by other programs and are not otherwise needed in
> libblock.
> 
> Undo the recent move of blockdev-nbd.c from blockdev_ss into block_ss.
> Two stubs are required to support this:
> 1. bdrv_close_all() (libblock) calls blk_exp_close_all() (libblockdev).
> 2. qemu_system_killed() is called by os-posix.c (libblockdev) and not
>    implemented in qemu-nbd.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Another possibility is to call os_setup_signal_handling in qemu-nbd.c
where we currently set the SIGTERM handler.  The existing
termsig_handler can be repurposed as qemu_system_killed.

Paolo


> ---
>  stubs/blk-exp-close-all.c  |  7 +++++++
>  stubs/qemu-system-killed.c | 10 ++++++++++
>  block/export/meson.build   |  4 ++--
>  meson.build                |  4 ++--
>  nbd/meson.build            |  2 ++
>  stubs/meson.build          |  2 ++
>  6 files changed, 25 insertions(+), 4 deletions(-)
>  create mode 100644 stubs/blk-exp-close-all.c
>  create mode 100644 stubs/qemu-system-killed.c
> 
> diff --git a/stubs/blk-exp-close-all.c b/stubs/blk-exp-close-all.c
> new file mode 100644
> index 0000000000..1c71316763
> --- /dev/null
> +++ b/stubs/blk-exp-close-all.c
> @@ -0,0 +1,7 @@
> +#include "qemu/osdep.h"
> +#include "block/export.h"
> +
> +/* Only used in programs that support block exports (libblockdev.fa) */
> +void blk_exp_close_all(void)
> +{
> +}
> diff --git a/stubs/qemu-system-killed.c b/stubs/qemu-system-killed.c
> new file mode 100644
> index 0000000000..9af131917b
> --- /dev/null
> +++ b/stubs/qemu-system-killed.c
> @@ -0,0 +1,10 @@
> +#include "qemu/osdep.h"
> +#include "sysemu/runstate.h"
> +
> +/*
> + * This function is needed by os-posix.c but only implemented by softmmu and
> + * qemu-storage-daemon. Other programs may have no need for it.
> + */
> +void qemu_system_killed(int signal, pid_t pid)
> +{
> +}
> diff --git a/block/export/meson.build b/block/export/meson.build
> index 469a7aa0f5..a2772a0dce 100644
> --- a/block/export/meson.build
> +++ b/block/export/meson.build
> @@ -1,2 +1,2 @@
> -block_ss.add(files('export.c'))
> -block_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-blk-server.c'))
> +blockdev_ss.add(files('export.c'))
> +blockdev_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-blk-server.c'))
> diff --git a/meson.build b/meson.build
> index 18d689b423..0e9528adab 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -835,7 +835,6 @@ subdir('dump')
>  
>  block_ss.add(files(
>    'block.c',
> -  'blockdev-nbd.c',
>    'blockjob.c',
>    'job.c',
>    'qemu-io-cmds.c',
> @@ -848,6 +847,7 @@ subdir('block')
>  
>  blockdev_ss.add(files(
>    'blockdev.c',
> +  'blockdev-nbd.c',
>    'iothread.c',
>    'job-qmp.c',
>  ))
> @@ -1171,7 +1171,7 @@ if have_tools
>    qemu_io = executable('qemu-io', files('qemu-io.c'),
>               dependencies: [block, qemuutil], install: true)
>    qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
> -               dependencies: [block, qemuutil], install: true)
> +               dependencies: [blockdev, qemuutil], install: true)
>  
>    subdir('storage-daemon')
>    subdir('contrib/rdmacm-mux')
> diff --git a/nbd/meson.build b/nbd/meson.build
> index 0c00a776d3..2baaa36948 100644
> --- a/nbd/meson.build
> +++ b/nbd/meson.build
> @@ -1,5 +1,7 @@
>  block_ss.add(files(
>    'client.c',
>    'common.c',
> +))
> +blockdev_ss.add(files(
>    'server.c',
>  ))
> diff --git a/stubs/meson.build b/stubs/meson.build
> index e0b322bc28..60234571b1 100644
> --- a/stubs/meson.build
> +++ b/stubs/meson.build
> @@ -1,6 +1,7 @@
>  stub_ss.add(files('arch_type.c'))
>  stub_ss.add(files('bdrv-next-monitor-owned.c'))
>  stub_ss.add(files('blk-commit-all.c'))
> +stub_ss.add(files('blk-exp-close-all.c'))
>  stub_ss.add(files('blockdev-close-all-bdrv-states.c'))
>  stub_ss.add(files('change-state-handler.c'))
>  stub_ss.add(files('clock-warp.c'))
> @@ -25,6 +26,7 @@ stub_ss.add(files('monitor.c'))
>  stub_ss.add(files('monitor-core.c'))
>  stub_ss.add(files('pci-bus.c'))
>  stub_ss.add(files('pci-host-piix.c'))
> +stub_ss.add(files('qemu-system-killed.c'))
>  stub_ss.add(files('qemu-timer-notify-cb.c'))
>  stub_ss.add(files('qmp_memory_device.c'))
>  stub_ss.add(files('qtest.c'))
> 



  reply	other threads:[~2020-09-25 14:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 13:42 [PATCH 0/4] block/export: add BlockExportOptions->iothread member Stefan Hajnoczi
2020-09-25 13:42 ` [PATCH 1/4] util/vhost-user-server: use static library in meson.build Stefan Hajnoczi
2020-09-25 14:07   ` Paolo Bonzini
2020-09-25 13:42 ` [PATCH 2/4] qemu-storage-daemon: avoid compiling blockdev_ss twice Stefan Hajnoczi
2020-09-25 14:08   ` Paolo Bonzini
2020-09-25 13:42 ` [PATCH 3/4] block: move block exports to libblockdev Stefan Hajnoczi
2020-09-25 14:11   ` Paolo Bonzini [this message]
2020-09-25 15:06     ` Stefan Hajnoczi
2020-09-25 13:42 ` [PATCH 4/4] block/export: add BlockExportOptions->iothread member Stefan Hajnoczi
2020-09-25 15:01   ` Kevin Wolf
2020-09-28  8:37     ` Stefan Hajnoczi

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=48e58e9a-0feb-66b4-0e41-9ee01e2e272f@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Coiby.Xu@gmail.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).