All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block/blkio: Fix inclusion of required headers
@ 2023-01-23 12:39 Peter Krempa
  2023-01-23 14:01 ` Markus Armbruster
  2023-01-23 20:02 ` Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Krempa @ 2023-01-23 12:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Hajnoczi, Kevin Wolf, Hanna Reitz, qemu-block,
	Markus Armbruster, Peter Krempa

After recent header file inclusion rework the build fails when the blkio
module is enabled:

../block/blkio.c: In function ‘blkio_detach_aio_context’:
../block/blkio.c:321:24: error: implicit declaration of function ‘bdrv_get_aio_context’; did you mean ‘qemu_get_aio_context’? [-Werror=implicit-function-declaration]
  321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
      |                        ^~~~~~~~~~~~~~~~~~~~
      |                        qemu_get_aio_context
../block/blkio.c:321:24: error: nested extern declaration of ‘bdrv_get_aio_context’ [-Werror=nested-externs]
../block/blkio.c:321:24: error: passing argument 1 of ‘aio_set_fd_handler’ makes pointer from integer without a cast [-Werror=int-conversion]
  321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        int
In file included from /home/pipo/git/qemu.git/include/qemu/job.h:33,
                 from /home/pipo/git/qemu.git/include/block/blockjob.h:30,
                 from /home/pipo/git/qemu.git/include/block/block_int-global-state.h:28,
                 from /home/pipo/git/qemu.git/include/block/block_int.h:27,
                 from ../block/blkio.c:13:
/home/pipo/git/qemu.git/include/block/aio.h:476:37: note: expected ‘AioContext *’ but argument is of type ‘int’
  476 | void aio_set_fd_handler(AioContext *ctx,
      |                         ~~~~~~~~~~~~^~~
../block/blkio.c: In function ‘blkio_file_open’:
../block/blkio.c:821:34: error: passing argument 2 of ‘blkio_attach_aio_context’ makes pointer from integer without a cast [-Werror=int-conversion]
  821 |     blkio_attach_aio_context(bs, bdrv_get_aio_context(bs));
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  int

Fix it by including 'block/block-io.h' which contains the required
declarations.

Fixes: e2c1c34f139f49ef909bb4322607fb8b39002312
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 block/blkio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/blkio.c b/block/blkio.c
index 5eae3adfaf..6ad86b23d1 100644
--- a/block/blkio.c
+++ b/block/blkio.c
@@ -19,6 +19,8 @@
 #include "qemu/module.h"
 #include "exec/memory.h" /* for ram_block_discard_disable() */

+#include "block/block-io.h"
+
 /*
  * Keep the QEMU BlockDriver names identical to the libblkio driver names.
  * Using macros instead of typing out the string literals avoids typos.
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] block/blkio: Fix inclusion of required headers
  2023-01-23 12:39 [PATCH] block/blkio: Fix inclusion of required headers Peter Krempa
@ 2023-01-23 14:01 ` Markus Armbruster
  2023-01-23 14:14   ` Peter Krempa
  2023-01-23 20:02 ` Stefan Hajnoczi
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2023-01-23 14:01 UTC (permalink / raw)
  To: Peter Krempa
  Cc: qemu-devel, Stefan Hajnoczi, Kevin Wolf, Hanna Reitz, qemu-block

Peter Krempa <pkrempa@redhat.com> writes:

> After recent header file inclusion rework the build fails when the blkio
> module is enabled:
>
> ../block/blkio.c: In function ‘blkio_detach_aio_context’:
> ../block/blkio.c:321:24: error: implicit declaration of function ‘bdrv_get_aio_context’; did you mean ‘qemu_get_aio_context’? [-Werror=implicit-function-declaration]
>   321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
>       |                        ^~~~~~~~~~~~~~~~~~~~
>       |                        qemu_get_aio_context
> ../block/blkio.c:321:24: error: nested extern declaration of ‘bdrv_get_aio_context’ [-Werror=nested-externs]
> ../block/blkio.c:321:24: error: passing argument 1 of ‘aio_set_fd_handler’ makes pointer from integer without a cast [-Werror=int-conversion]
>   321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
>       |                        ^~~~~~~~~~~~~~~~~~~~~~~~
>       |                        |
>       |                        int
> In file included from /home/pipo/git/qemu.git/include/qemu/job.h:33,
>                  from /home/pipo/git/qemu.git/include/block/blockjob.h:30,
>                  from /home/pipo/git/qemu.git/include/block/block_int-global-state.h:28,
>                  from /home/pipo/git/qemu.git/include/block/block_int.h:27,
>                  from ../block/blkio.c:13:
> /home/pipo/git/qemu.git/include/block/aio.h:476:37: note: expected ‘AioContext *’ but argument is of type ‘int’
>   476 | void aio_set_fd_handler(AioContext *ctx,
>       |                         ~~~~~~~~~~~~^~~
> ../block/blkio.c: In function ‘blkio_file_open’:
> ../block/blkio.c:821:34: error: passing argument 2 of ‘blkio_attach_aio_context’ makes pointer from integer without a cast [-Werror=int-conversion]
>   821 |     blkio_attach_aio_context(bs, bdrv_get_aio_context(bs));
>       |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
>       |                                  |
>       |                                  int
>

My apologies...

Why are modules disabled by default?

> Fix it by including 'block/block-io.h' which contains the required
> declarations.
>
> Fixes: e2c1c34f139f49ef909bb4322607fb8b39002312
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  block/blkio.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/block/blkio.c b/block/blkio.c
> index 5eae3adfaf..6ad86b23d1 100644
> --- a/block/blkio.c
> +++ b/block/blkio.c
> @@ -19,6 +19,8 @@
>  #include "qemu/module.h"
>  #include "exec/memory.h" /* for ram_block_discard_disable() */
>
> +#include "block/block-io.h"
> +
>  /*
>   * Keep the QEMU BlockDriver names identical to the libblkio driver names.
>   * Using macros instead of typing out the string literals avoids typos.

Reviewed-by: Markus Armbruster <armbru@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block/blkio: Fix inclusion of required headers
  2023-01-23 14:01 ` Markus Armbruster
@ 2023-01-23 14:14   ` Peter Krempa
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Krempa @ 2023-01-23 14:14 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: qemu-devel, Stefan Hajnoczi, Kevin Wolf, Hanna Reitz, qemu-block

On Mon, Jan 23, 2023 at 15:01:37 +0100, Markus Armbruster wrote:
> Peter Krempa <pkrempa@redhat.com> writes:
> 
> > After recent header file inclusion rework the build fails when the blkio
> > module is enabled:
> >
> > ../block/blkio.c: In function ‘blkio_detach_aio_context’:
> > ../block/blkio.c:321:24: error: implicit declaration of function ‘bdrv_get_aio_context’; did you mean ‘qemu_get_aio_context’? [-Werror=implicit-function-declaration]
> >   321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
> >       |                        ^~~~~~~~~~~~~~~~~~~~
> >       |                        qemu_get_aio_context
> > ../block/blkio.c:321:24: error: nested extern declaration of ‘bdrv_get_aio_context’ [-Werror=nested-externs]
> > ../block/blkio.c:321:24: error: passing argument 1 of ‘aio_set_fd_handler’ makes pointer from integer without a cast [-Werror=int-conversion]
> >   321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
> >       |                        ^~~~~~~~~~~~~~~~~~~~~~~~
> >       |                        |
> >       |                        int
> > In file included from /home/pipo/git/qemu.git/include/qemu/job.h:33,
> >                  from /home/pipo/git/qemu.git/include/block/blockjob.h:30,
> >                  from /home/pipo/git/qemu.git/include/block/block_int-global-state.h:28,
> >                  from /home/pipo/git/qemu.git/include/block/block_int.h:27,
> >                  from ../block/blkio.c:13:
> > /home/pipo/git/qemu.git/include/block/aio.h:476:37: note: expected ‘AioContext *’ but argument is of type ‘int’
> >   476 | void aio_set_fd_handler(AioContext *ctx,
> >       |                         ~~~~~~~~~~~~^~~
> > ../block/blkio.c: In function ‘blkio_file_open’:
> > ../block/blkio.c:821:34: error: passing argument 2 of ‘blkio_attach_aio_context’ makes pointer from integer without a cast [-Werror=int-conversion]
> >   821 |     blkio_attach_aio_context(bs, bdrv_get_aio_context(bs));
> >       |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
> >       |                                  |
> >       |                                  int
> >
> 
> My apologies...
> 
> Why are modules disabled by default?

libblkio is too new and is not yet packaged too widely. IIUC it's
supposed to be included e.g. in Fedora 38, so you most likely don't have
the dependancy.

I actually installed it explicitly since I wanted to give it a try.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] block/blkio: Fix inclusion of required headers
  2023-01-23 12:39 [PATCH] block/blkio: Fix inclusion of required headers Peter Krempa
  2023-01-23 14:01 ` Markus Armbruster
@ 2023-01-23 20:02 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2023-01-23 20:02 UTC (permalink / raw)
  To: Peter Krempa
  Cc: qemu-devel, Kevin Wolf, Hanna Reitz, qemu-block, Markus Armbruster

[-- Attachment #1: Type: text/plain, Size: 2444 bytes --]

On Mon, Jan 23, 2023 at 01:39:27PM +0100, Peter Krempa wrote:
> After recent header file inclusion rework the build fails when the blkio
> module is enabled:
> 
> ../block/blkio.c: In function ‘blkio_detach_aio_context’:
> ../block/blkio.c:321:24: error: implicit declaration of function ‘bdrv_get_aio_context’; did you mean ‘qemu_get_aio_context’? [-Werror=implicit-function-declaration]
>   321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
>       |                        ^~~~~~~~~~~~~~~~~~~~
>       |                        qemu_get_aio_context
> ../block/blkio.c:321:24: error: nested extern declaration of ‘bdrv_get_aio_context’ [-Werror=nested-externs]
> ../block/blkio.c:321:24: error: passing argument 1 of ‘aio_set_fd_handler’ makes pointer from integer without a cast [-Werror=int-conversion]
>   321 |     aio_set_fd_handler(bdrv_get_aio_context(bs),
>       |                        ^~~~~~~~~~~~~~~~~~~~~~~~
>       |                        |
>       |                        int
> In file included from /home/pipo/git/qemu.git/include/qemu/job.h:33,
>                  from /home/pipo/git/qemu.git/include/block/blockjob.h:30,
>                  from /home/pipo/git/qemu.git/include/block/block_int-global-state.h:28,
>                  from /home/pipo/git/qemu.git/include/block/block_int.h:27,
>                  from ../block/blkio.c:13:
> /home/pipo/git/qemu.git/include/block/aio.h:476:37: note: expected ‘AioContext *’ but argument is of type ‘int’
>   476 | void aio_set_fd_handler(AioContext *ctx,
>       |                         ~~~~~~~~~~~~^~~
> ../block/blkio.c: In function ‘blkio_file_open’:
> ../block/blkio.c:821:34: error: passing argument 2 of ‘blkio_attach_aio_context’ makes pointer from integer without a cast [-Werror=int-conversion]
>   821 |     blkio_attach_aio_context(bs, bdrv_get_aio_context(bs));
>       |                                  ^~~~~~~~~~~~~~~~~~~~~~~~
>       |                                  |
>       |                                  int
> 
> Fix it by including 'block/block-io.h' which contains the required
> declarations.
> 
> Fixes: e2c1c34f139f49ef909bb4322607fb8b39002312
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  block/blkio.c | 2 ++
>  1 file changed, 2 insertions(+)

Thanks, applied to my block-next tree:
https://gitlab.com/stefanha/qemu/commits/block-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-23 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 12:39 [PATCH] block/blkio: Fix inclusion of required headers Peter Krempa
2023-01-23 14:01 ` Markus Armbruster
2023-01-23 14:14   ` Peter Krempa
2023-01-23 20:02 ` Stefan Hajnoczi

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.