Patchwork [PATCHv4,07/12] virtio: move typedef to qemu-common

login
register
mail settings
Submitter Michael S. Tsirkin
Date March 3, 2010, 5:16 p.m.
Message ID <9075331a15707f770788ed361f2228b88bb7a7c5.1267636215.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/46848/
State New
Headers show

Comments

Michael S. Tsirkin - March 3, 2010, 5:16 p.m.
make it possible to use type without header include

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio.h   |    1 -
 qemu-common.h |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)
Michael S. Tsirkin - March 4, 2010, 12:19 p.m.
On Thu, Mar 04, 2010 at 05:50:19PM +0530, Amit Shah wrote:
> On (Wed) Mar 03 2010 [19:16:28], Michael S. Tsirkin wrote:
> > make it possible to use type without header include
> 
> Why?

So that vhost.h does not need to include virtio.h

> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  hw/virtio.h   |    1 -
> >  qemu-common.h |    1 +
> >  2 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/hw/virtio.h b/hw/virtio.h
> > index 58b06bf..6f2fab0 100644
> > --- a/hw/virtio.h
> > +++ b/hw/virtio.h
> > @@ -69,7 +69,6 @@ static inline target_phys_addr_t vring_align(target_phys_addr_t addr,
> >  }
> >  
> >  typedef struct VirtQueue VirtQueue;
> > -typedef struct VirtIODevice VirtIODevice;
> >  
> >  #define VIRTQUEUE_MAX_SIZE 1024
> >  
> > diff --git a/qemu-common.h b/qemu-common.h
> > index f12a8f5..90ca3b8 100644
> > --- a/qemu-common.h
> > +++ b/qemu-common.h
> > @@ -228,6 +228,7 @@ typedef struct I2SCodec I2SCodec;
> >  typedef struct DeviceState DeviceState;
> >  typedef struct SSIBus SSIBus;
> >  typedef struct EventNotifier EventNotifier;
> > +typedef struct VirtIODevice VirtIODevice;
> >  
> >  typedef uint64_t pcibus_t;
> 
> 		Amit
Amit Shah - March 4, 2010, 12:20 p.m.
On (Wed) Mar 03 2010 [19:16:28], Michael S. Tsirkin wrote:
> make it possible to use type without header include

Why?

> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/virtio.h   |    1 -
>  qemu-common.h |    1 +
>  2 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/virtio.h b/hw/virtio.h
> index 58b06bf..6f2fab0 100644
> --- a/hw/virtio.h
> +++ b/hw/virtio.h
> @@ -69,7 +69,6 @@ static inline target_phys_addr_t vring_align(target_phys_addr_t addr,
>  }
>  
>  typedef struct VirtQueue VirtQueue;
> -typedef struct VirtIODevice VirtIODevice;
>  
>  #define VIRTQUEUE_MAX_SIZE 1024
>  
> diff --git a/qemu-common.h b/qemu-common.h
> index f12a8f5..90ca3b8 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -228,6 +228,7 @@ typedef struct I2SCodec I2SCodec;
>  typedef struct DeviceState DeviceState;
>  typedef struct SSIBus SSIBus;
>  typedef struct EventNotifier EventNotifier;
> +typedef struct VirtIODevice VirtIODevice;
>  
>  typedef uint64_t pcibus_t;

		Amit
Amit Shah - March 4, 2010, 12:29 p.m.
On (Thu) Mar 04 2010 [14:19:58], Michael S. Tsirkin wrote:
> On Thu, Mar 04, 2010 at 05:50:19PM +0530, Amit Shah wrote:
> > On (Wed) Mar 03 2010 [19:16:28], Michael S. Tsirkin wrote:
> > > make it possible to use type without header include
> > 
> > Why?
> 
> So that vhost.h does not need to include virtio.h

But what's the benefit in doing that?

Either way, a better commit msg would help.

		Amit
Michael S. Tsirkin - March 4, 2010, 12:31 p.m.
On Thu, Mar 04, 2010 at 05:59:11PM +0530, Amit Shah wrote:
> On (Thu) Mar 04 2010 [14:19:58], Michael S. Tsirkin wrote:
> > On Thu, Mar 04, 2010 at 05:50:19PM +0530, Amit Shah wrote:
> > > On (Wed) Mar 03 2010 [19:16:28], Michael S. Tsirkin wrote:
> > > > make it possible to use type without header include
> > > 
> > > Why?
> > 
> > So that vhost.h does not need to include virtio.h
> 
> But what's the benefit in doing that?

Simpler dependencies. E.g. tap calls vhost
init/cleanup but we do not want it to include virtio.h
An alternative would be to split init/cleanup
(does not need virtio), and start/stop (needs virtio).
But typedef in qemu-common is already used
for everything else.

> Either way, a better commit msg would help.

ok

> 		Amit

Patch

diff --git a/hw/virtio.h b/hw/virtio.h
index 58b06bf..6f2fab0 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -69,7 +69,6 @@  static inline target_phys_addr_t vring_align(target_phys_addr_t addr,
 }
 
 typedef struct VirtQueue VirtQueue;
-typedef struct VirtIODevice VirtIODevice;
 
 #define VIRTQUEUE_MAX_SIZE 1024
 
diff --git a/qemu-common.h b/qemu-common.h
index f12a8f5..90ca3b8 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -228,6 +228,7 @@  typedef struct I2SCodec I2SCodec;
 typedef struct DeviceState DeviceState;
 typedef struct SSIBus SSIBus;
 typedef struct EventNotifier EventNotifier;
+typedef struct VirtIODevice VirtIODevice;
 
 typedef uint64_t pcibus_t;