qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] net: Include iov.h in checksum.h
@ 2014-02-06 15:30 Alexander Graf
  2014-02-07  7:05 ` Michael Tokarev
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2014-02-06 15:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dmitry Fleytman, Stefan Hajnoczi, Anthony Liguori

The checksum calculation header exports a function that refers to struct
iov which is defined in iov.h. Include the header so that the compiler
knows what this struct is about.

Fixes the following compile failure for me:

  In file included from hw/net/fsl_etsec/rings.c:24:0:
  include/net/checksum.h:51:31: error: ‘struct iovec’ declared inside parameter list [-Werror]
  include/net/checksum.h:51:31: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 include/net/checksum.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/checksum.h b/include/net/checksum.h
index 80203fb..a81cf65 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -19,6 +19,7 @@
 #define QEMU_NET_CHECKSUM_H
 
 #include <stdint.h>
+#include "qemu/iov.h"
 
 uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq);
 uint16_t net_checksum_finish(uint32_t sum);
-- 
1.8.1.4

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

* Re: [Qemu-devel] [PATCH] net: Include iov.h in checksum.h
  2014-02-06 15:30 [Qemu-devel] [PATCH] net: Include iov.h in checksum.h Alexander Graf
@ 2014-02-07  7:05 ` Michael Tokarev
  2014-02-07  7:54   ` Alexander Graf
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2014-02-07  7:05 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Dmitry Fleytman, qemu-trivial, qemu-devel, Stefan Hajnoczi,
	Anthony Liguori

06.02.2014 19:30, Alexander Graf wrote:
> The checksum calculation header exports a function that refers to struct
> iov which is defined in iov.h. Include the header so that the compiler
> knows what this struct is about.

Alternatively (and I sometimes prefer it this way), one can just
declare `struct iovec;' instead of including whole header, because
we don't actually use any definitions from there, and users of
checksum.h wont be including extra dependencies which they don't
use...  Like this:

--- cut ---
Subject: net: declare struct iovec in checksum.h to fix compiler warning
From: Michael Tokarev <mjt@tls.msk.ru>

The checksum calculation header exports a function that refers to
struct iov defined in iov.h.  Without including the former, build
fails like this:

  In file included from hw/net/fsl_etsec/rings.c:24:0:
  include/net/checksum.h:51:31: error: ‘struct iovec’ declared inside parameter list [-Werror]
  include/net/checksum.h:51:31: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]

Mention struct iovec there.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

diff --git a/include/net/checksum.h b/include/net/checksum.h
index 80203fb..2d7a363 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -19,6 +19,7 @@
 #define QEMU_NET_CHECKSUM_H

 #include <stdint.h>
+struct iovec;

 uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq);
 uint16_t net_checksum_finish(uint32_t sum);
--- cut ---
BTW, this is a -trivial matherial ;)

/mjt

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

* Re: [Qemu-devel] [PATCH] net: Include iov.h in checksum.h
  2014-02-07  7:05 ` Michael Tokarev
@ 2014-02-07  7:54   ` Alexander Graf
  2014-02-10 10:20     ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2014-02-07  7:54 UTC (permalink / raw)
  To: Michael Tokarev
  Cc: Dmitry Fleytman, qemu-trivial, qemu-devel@nongnu.org,
	Stefan Hajnoczi, Anthony Liguori



> Am 07.02.2014 um 08:05 schrieb Michael Tokarev <mjt@tls.msk.ru>:
> 
> 06.02.2014 19:30, Alexander Graf wrote:
>> The checksum calculation header exports a function that refers to struct
>> iov which is defined in iov.h. Include the header so that the compiler
>> knows what this struct is about.
> 
> Alternatively (and I sometimes prefer it this way), one can just
> declare `struct iovec;' instead of including whole header, because
> we don't actually use any definitions from there, and users of
> checksum.h wont be including extra dependencies which they don't
> use...  Like this:

Either way works for me :)

Alex

> 
> --- cut ---
> Subject: net: declare struct iovec in checksum.h to fix compiler warning
> From: Michael Tokarev <mjt@tls.msk.ru>
> 
> The checksum calculation header exports a function that refers to
> struct iov defined in iov.h.  Without including the former, build
> fails like this:
> 
>  In file included from hw/net/fsl_etsec/rings.c:24:0:
>  include/net/checksum.h:51:31: error: ‘struct iovec’ declared inside parameter list [-Werror]
>  include/net/checksum.h:51:31: error: its scope is only this definition or declaration, which is probably not what you want [-Werror]
> 
> Mention struct iovec there.
> 
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> 
> diff --git a/include/net/checksum.h b/include/net/checksum.h
> index 80203fb..2d7a363 100644
> --- a/include/net/checksum.h
> +++ b/include/net/checksum.h
> @@ -19,6 +19,7 @@
> #define QEMU_NET_CHECKSUM_H
> 
> #include <stdint.h>
> +struct iovec;
> 
> uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq);
> uint16_t net_checksum_finish(uint32_t sum);
> --- cut ---
> BTW, this is a -trivial matherial ;)
> 
> /mjt

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

* Re: [Qemu-devel] [PATCH] net: Include iov.h in checksum.h
  2014-02-07  7:54   ` Alexander Graf
@ 2014-02-10 10:20     ` Stefan Hajnoczi
  2014-02-11 10:30       ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2014-02-10 10:20 UTC (permalink / raw)
  To: Michael Tokarev
  Cc: Dmitry Fleytman, qemu-trivial, Alexander Graf, Anthony Liguori,
	qemu-devel@nongnu.org

On Fri, Feb 07, 2014 at 08:54:00AM +0100, Alexander Graf wrote:
> 
> 
> > Am 07.02.2014 um 08:05 schrieb Michael Tokarev <mjt@tls.msk.ru>:
> > 
> > 06.02.2014 19:30, Alexander Graf wrote:
> >> The checksum calculation header exports a function that refers to struct
> >> iov which is defined in iov.h. Include the header so that the compiler
> >> knows what this struct is about.
> > 
> > Alternatively (and I sometimes prefer it this way), one can just
> > declare `struct iovec;' instead of including whole header, because
> > we don't actually use any definitions from there, and users of
> > checksum.h wont be including extra dependencies which they don't
> > use...  Like this:
> 
> Either way works for me :)

Yes, please take one of them via -trivial.

Stefan

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] net: Include iov.h in checksum.h
  2014-02-10 10:20     ` Stefan Hajnoczi
@ 2014-02-11 10:30       ` Michael Tokarev
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2014-02-11 10:30 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Dmitry Fleytman, qemu-trivial, Alexander Graf, Anthony Liguori,
	qemu-devel@nongnu.org

10.02.2014 14:20, Stefan Hajnoczi пишет:
> On Fri, Feb 07, 2014 at 08:54:00AM +0100, Alexander Graf wrote:
>>
>>
>>> Am 07.02.2014 um 08:05 schrieb Michael Tokarev <mjt@tls.msk.ru>:
>>>
>>> 06.02.2014 19:30, Alexander Graf wrote:
>>>> The checksum calculation header exports a function that refers to struct
>>>> iov which is defined in iov.h. Include the header so that the compiler
>>>> knows what this struct is about.
>>>
>>> Alternatively (and I sometimes prefer it this way), one can just
>>> declare `struct iovec;' instead of including whole header, because
>>> we don't actually use any definitions from there, and users of
>>> checksum.h wont be including extra dependencies which they don't
>>> use...  Like this:
>>
>> Either way works for me :)
> 
> Yes, please take one of them via -trivial.

I've applied my version to -trivial.

Thanks,

/mjt

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

end of thread, other threads:[~2014-02-11 10:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-06 15:30 [Qemu-devel] [PATCH] net: Include iov.h in checksum.h Alexander Graf
2014-02-07  7:05 ` Michael Tokarev
2014-02-07  7:54   ` Alexander Graf
2014-02-10 10:20     ` Stefan Hajnoczi
2014-02-11 10:30       ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev

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).