qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC qom-cpu 2/4] qemu-common.h: Move fprintf_fun


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH RFC qom-cpu 2/4] qemu-common.h: Move fprintf_function to qemu-types.h
Date: Tue, 18 Dec 2012 15:25:41 -0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Dec 18, 2012 at 08:53:41AM +0100, Andreas Färber wrote:
> This avoids a dependency on qemu-common.h from qemu/cpu.h.
> 
> Signed-off-by: Andreas Färber <address@hidden>

When I introduced qemu-types.h, I just planned to use it for the trivial
"typedef struct Foobar Foobar" typedefs that can't be anywhere else
because it would cause circular header dependencies.

I am not against this patch, but I wonder if osdep.h (or even a new
qemu-stdio.h header) isn't more appropriate for this (and for other
I/O-related definitions currently on qemu-common.h).

> ---
>  include/qemu/cpu.h |    2 +-
>  qemu-common.h      |    5 -----
>  qemu-types.h       |    6 ++++++
>  3 Dateien geändert, 7 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
> 
> diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
> index 5fbb3f9..d737fcd 100644
> --- a/include/qemu/cpu.h
> +++ b/include/qemu/cpu.h
> @@ -21,7 +21,7 @@
>  #define QEMU_CPU_H
>  
>  #include "qemu/object.h"
> -#include "qemu-common.h"
> +#include "qemu-types.h"
>  #include "qemu-thread.h"
>  
>  /**
> diff --git a/qemu-common.h b/qemu-common.h
> index e674786..98ab78d 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -12,7 +12,6 @@
>  #ifndef QEMU_COMMON_H
>  #define QEMU_COMMON_H
>  
> -#include "compiler.h"
>  #include "config-host.h"
>  #include "qemu-types.h"
>  
> @@ -24,7 +23,6 @@
>  
>  /* we put basic includes here to avoid repeating them in device drivers */
>  #include <stdlib.h>
> -#include <stdio.h>
>  #include <stdarg.h>
>  #include <stdbool.h>
>  #include <string.h>
> @@ -95,9 +93,6 @@ struct iovec {
>  #include <sys/uio.h>
>  #endif
>  
> -typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
> -    GCC_FMT_ATTR(2, 3);
> -
>  #ifdef _WIN32
>  #define fsync _commit
>  #if !defined(lseek)
> diff --git a/qemu-types.h b/qemu-types.h
> index fd532a2..f7a7194 100644
> --- a/qemu-types.h
> +++ b/qemu-types.h
> @@ -1,6 +1,12 @@
>  #ifndef QEMU_TYPEDEFS_H
>  #define QEMU_TYPEDEFS_H
>  
> +#include "compiler.h"
> +#include <stdio.h>
> +
> +typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
> +    GCC_FMT_ATTR(2, 3);
> +
>  /* A load of opaque types so that device init declarations don't have to
>     pull in all the real definitions.  */
>  typedef struct QEMUTimer QEMUTimer;
> -- 
> 1.7.10.4
> 
> 

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]