qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers
@ 2008-08-28 16:24 Ian Jackson
  2008-08-28 20:06 ` Anthony Liguori
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2008-08-28 16:24 UTC (permalink / raw)
  To: qemu-devel

Really we would like to #include <linux/compiler.h> but according
to changelogs in xen-unstable, at least FC6R3 doesn't have it.

So instead we do this: we  #define __user  ourselves, which is
what <linux/compiler.h> does on systems which are not broken.

(This change is identical to xen-unstable
 11601:ba7487569374378b398a1b134ea108a6a8209b4b.
 and qemu-xen 1f153e0706851b43bb5c2083e531fd7b64b75be1.)

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 usb-linux.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/usb-linux.c b/usb-linux.c
index c31d56a..db51fe6 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -33,6 +33,9 @@
 #if defined(__linux__)
 #include <dirent.h>
 #include <sys/ioctl.h>
+/* Some versions of usbdevice_fs.h need __user to be defined for them.   */
+/* This may (harmlessly) conflict with a definition in linux/compiler.h. */
+#define __user
 #include <linux/usbdevice_fs.h>
 #include <linux/version.h>
 #include <signal.h>
-- 
1.4.4.4

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

* Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers
  2008-08-28 16:24 [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers Ian Jackson
@ 2008-08-28 20:06 ` Anthony Liguori
  2008-08-28 20:41   ` Thiemo Seufer
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2008-08-28 20:06 UTC (permalink / raw)
  To: qemu-devel

Ian Jackson wrote:
> Really we would like to #include <linux/compiler.h> but according
> to changelogs in xen-unstable, at least FC6R3 doesn't have it.
>
> So instead we do this: we  #define __user  ourselves, which is
> what <linux/compiler.h> does on systems which are not broken.
>
> (This change is identical to xen-unstable
>  11601:ba7487569374378b398a1b134ea108a6a8209b4b.
>  and qemu-xen 1f153e0706851b43bb5c2083e531fd7b64b75be1.)
>   

This was applied at one point in time, but then reverted IIRC.  I think 
Fabrice objected?

Regards,

Anthony Liguori

> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> ---
>  usb-linux.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/usb-linux.c b/usb-linux.c
> index c31d56a..db51fe6 100644
> --- a/usb-linux.c
> +++ b/usb-linux.c
> @@ -33,6 +33,9 @@
>  #if defined(__linux__)
>  #include <dirent.h>
>  #include <sys/ioctl.h>
> +/* Some versions of usbdevice_fs.h need __user to be defined for them.   */
> +/* This may (harmlessly) conflict with a definition in linux/compiler.h. */
> +#define __user
>  #include <linux/usbdevice_fs.h>
>  #include <linux/version.h>
>  #include <signal.h>
>   

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

* Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers
  2008-08-28 20:06 ` Anthony Liguori
@ 2008-08-28 20:41   ` Thiemo Seufer
  2008-08-28 20:49     ` Anthony Liguori
  2008-08-29  9:47     ` Ian Jackson
  0 siblings, 2 replies; 6+ messages in thread
From: Thiemo Seufer @ 2008-08-28 20:41 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

Anthony Liguori wrote:
> Ian Jackson wrote:
>> Really we would like to #include <linux/compiler.h> but according
>> to changelogs in xen-unstable, at least FC6R3 doesn't have it.
>>
>> So instead we do this: we  #define __user  ourselves, which is
>> what <linux/compiler.h> does on systems which are not broken.
>>
>> (This change is identical to xen-unstable
>>  11601:ba7487569374378b398a1b134ea108a6a8209b4b.
>>  and qemu-xen 1f153e0706851b43bb5c2083e531fd7b64b75be1.)
>>   
>
> This was applied at one point in time, but then reverted IIRC.  I think  
> Fabrice objected?

It was rejected because distros should fix their broken headers instead.


Thiemo

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

* Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers
  2008-08-28 20:41   ` Thiemo Seufer
@ 2008-08-28 20:49     ` Anthony Liguori
  2008-08-29  9:47     ` Ian Jackson
  1 sibling, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2008-08-28 20:49 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: qemu-devel

Thiemo Seufer wrote:
> Anthony Liguori wrote:
>   
> It was rejected because distros should fix their broken headers instead.
>   

In all fairness the headers in /usr/include/linux are not meant for 
application consumption.  The are for private use by glibc.  
Applications are suppose to copy and fixup Linux headers into their 
local trees.

Regards,

Anthony Liguori

> Thiemo
>   

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

* Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers
  2008-08-28 20:41   ` Thiemo Seufer
  2008-08-28 20:49     ` Anthony Liguori
@ 2008-08-29  9:47     ` Ian Jackson
  2008-09-07  2:50       ` Anthony Liguori
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2008-08-29  9:47 UTC (permalink / raw)
  To: qemu-devel

Thiemo Seufer writes ("Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers"):
> It was rejected because distros should fix their broken headers instead.

I think this is an absurd response.

On that theory, why do we bother with any of the other portability
stuff in qemu ?  We could do away with the hideously complicated
emulation of openpty and just say `distros should get openpty'.

Why do we bother with special cases like this one (block-raw-posix.c):

  #if defined(__GLIBC__) && defined(__linux__)
      {
	  /* XXX: aio thread exit seems to hang on RedHat 9 and this init
	     seems to fix the problem. */

etc. etc.

I agree that distros should fix their broken headers.  Indeed none of
the systems I have here and which I use for testing have headers which
are broken in this way.

However, it would be nice to be able to make qemu work on old systems,
even if those systems have bugs.  Unless you have a time machine which
we can use to fix up this kind of thing in (say) Fedora Core 6 ?

Ian.

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

* Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers
  2008-08-29  9:47     ` Ian Jackson
@ 2008-09-07  2:50       ` Anthony Liguori
  0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2008-09-07  2:50 UTC (permalink / raw)
  To: Ian Jackson; +Cc: qemu-devel

Ian Jackson wrote:
> Thiemo Seufer writes ("Re: [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers"):
>   
>> It was rejected because distros should fix their broken headers instead.
>>     
>
> I think this is an absurd response.
>   

I tend to agree with you.  I think the proper fix though is not to 
#define __user but to copy the Linux headers into QEMU and made sure 
they compiled properly.  I would apply a patch that did that.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2008-09-07  2:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28 16:24 [Qemu-devel] [PATCH] usb-linux.c: #define __user to work around broken Linux headers Ian Jackson
2008-08-28 20:06 ` Anthony Liguori
2008-08-28 20:41   ` Thiemo Seufer
2008-08-28 20:49     ` Anthony Liguori
2008-08-29  9:47     ` Ian Jackson
2008-09-07  2:50       ` Anthony Liguori

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