Patchwork [v2,2/8] hw/hw.h: Add include of qemu-log.h

login
register
mail settings
Submitter Peter Maydell
Date Oct. 18, 2012, 1:11 p.m.
Message ID <1350565902-23940-3-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/192318/
State New
Headers show

Comments

Peter Maydell - Oct. 18, 2012, 1:11 p.m.
Add an include of qemu-log.h to hw.h, so that device model
code has access to these logging functions without the need
to directly include qemu-log.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/hw.h |    1 +
 1 file changed, 1 insertion(+)
Igor Mammedov - Oct. 18, 2012, 2:26 p.m.
On Thu, 18 Oct 2012 14:11:36 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> Add an include of qemu-log.h to hw.h, so that device model
> code has access to these logging functions without the need
> to directly include qemu-log.h.
It would be better to include qemu-log.h to files that have
immediate dependency on it, then creating another include all
"qemu-common.h." and compile/preprocess it for every hw file.

> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/hw.h |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/hw.h b/hw/hw.h
> index 16101de..b337ee3 100644
> --- a/hw/hw.h
> +++ b/hw/hw.h
> @@ -12,6 +12,7 @@
>  #include "irq.h"
>  #include "qemu-file.h"
>  #include "vmstate.h"
> +#include "qemu-log.h"
>  
>  #ifdef NEED_CPU_H
>  #if TARGET_LONG_BITS == 64
Peter Maydell - Oct. 18, 2012, 2:30 p.m.
On 18 October 2012 15:26, Igor Mammedov <imammedo@redhat.com> wrote:
> Peter Maydell <peter.maydell@linaro.org> wrote:
>> Add an include of qemu-log.h to hw.h, so that device model
>> code has access to these logging functions without the need
>> to directly include qemu-log.h.
> It would be better to include qemu-log.h to files that have
> immediate dependency on it, then creating another include all
> "qemu-common.h." and compile/preprocess it for every hw file.

That is what v1 of this patch did; Blue suggested it would
be better to put it in a common header, and I agree:
basically every device model will have cases where it will
want to diagnose bad guest behaviour, and so we would end
up including qemu-log.h in every file in hw/.

-- PMM

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 16101de..b337ee3 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -12,6 +12,7 @@ 
 #include "irq.h"
 #include "qemu-file.h"
 #include "vmstate.h"
+#include "qemu-log.h"
 
 #ifdef NEED_CPU_H
 #if TARGET_LONG_BITS == 64