public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Sasha Levin <levinsasha928@gmail.com>,
	kvm@vger.kernel.org, mingo@elte.hu
Subject: Re: [PATCH 1/2] tools/kvm/9p: Always include system header before our headers
Date: Sat, 18 Jun 2011 10:50:30 +0300	[thread overview]
Message-ID: <1308383431.28516.6.camel@jaguar> (raw)
In-Reply-To: <87sjr71utd.fsf@linux.vnet.ibm.com>

On Sat, 2011-06-18 at 12:37 +0530, Aneesh Kumar K.V wrote:
> On Fri, 17 Jun 2011 22:47:39 +0300, Pekka Enberg <penberg@kernel.org> wrote:
> > On Fri, 2011-06-17 at 15:45 -0400, Sasha Levin wrote:
> > > On Fri, 2011-06-17 at 23:41 +0530, Aneesh Kumar K.V wrote:
> > > > Otherwise many things can break, such as mapping of stat to stat64
> > > 
> > > We always include our headers before system headers to make sure we
> > > don't have any hidden prerequisites or dependencies within the headers.
> > > 
> > > Why did you need to move system headers before our headers in this case?
> > 
> > The stat64() breakage seems rather odd since we do this in the Makefile:
> > 
> > DEFINES	+= -D_FILE_OFFSET_BITS=64
> > DEFINES	+= -D_GNU_SOURCE
> > 
> > Aneesh, what kind of build problems are you seeing?
> 
> Ok the below change also fix the issue for me. So it could be some
> mapping in the kernel headers
> 
> diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
> index 38a997d..730f4a1 100644
> --- a/tools/kvm/virtio/9p.c
> +++ b/tools/kvm/virtio/9p.c
> @@ -9,16 +9,16 @@
>  #include "kvm/threadpool.h"
>  #include "kvm/irq.h"
>  
> -#include <linux/virtio_ring.h>
> -#include <linux/virtio_9p.h>
> -#include <net/9p/9p.h>
> -
>  #include <fcntl.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <pthread.h>
>  #include <dirent.h>
>  
> +#include <linux/virtio_ring.h>
> +#include <linux/virtio_9p.h>
> +#include <net/9p/9p.h>
> +
>  #define NUM_VIRT_QUEUES		1
>  #define VIRTIO_P9_QUEUE_SIZE	128
>  #define	VIRTIO_P9_TAG		"kvm_9p"

Yes, makes sense. Can you send that as a proper patch and I'll apply it?

The ordering of #includes is as follows:

  1. Our own headers. This helps in ensuring there's no missing
     #includes in the headers themselves.

  2. Library headers and glibc headers

  3. Linux kernel headers.

Code that doesn't follow that is a bug waiting to happen.

				Pekka


      reply	other threads:[~2011-06-18  7:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 18:11 [PATCH 1/2] tools/kvm/9p: Always include system header before our headers Aneesh Kumar K.V
2011-06-17 18:11 ` [PATCH 2/2] tools/kvm/9p: Add support for multiple 9p export dirs Aneesh Kumar K.V
2011-06-17 20:06   ` Sasha Levin
2011-06-17 19:45 ` [PATCH 1/2] tools/kvm/9p: Always include system header before our headers Sasha Levin
2011-06-17 19:47   ` Pekka Enberg
2011-06-18  6:48     ` Aneesh Kumar K.V
2011-06-18  7:07     ` Aneesh Kumar K.V
2011-06-18  7:50       ` Pekka Enberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308383431.28516.6.camel@jaguar \
    --to=penberg@kernel.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox