public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Include header required for INT_MAX
@ 2007-11-10 14:55 Thomas Koeller
  2007-11-10 15:56 ` Christoph Hellwig
  2007-11-10 16:48 ` Alexander E. Patrakov
  0 siblings, 2 replies; 12+ messages in thread
From: Thomas Koeller @ 2007-11-10 14:55 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel

cdrom.h uses INT_MAX, so it must include kernel.h or
limits.h (userspace) for a definition.

Signed-off-by: Thomas Koeller <thomas@koeller.dyndns.org>

diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index c6d3e22..bd8064a 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -12,6 +12,11 @@
 #define	_LINUX_CDROM_H
 
 #include <asm/byteorder.h>
+#ifdef __KERNEL__
+#include <linux/kernel.h>
+#else
+#include <limits.h>
+#endif
 
 /*******************************************************
  * As of Linux 2.1.x, all Linux CD-ROM application programs will use this 
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* Re: [PATCH] Include header required for INT_MAX
@ 2007-11-11 22:52 Jan Engelhardt
  2007-11-12 10:21 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Jan Engelhardt @ 2007-11-11 22:52 UTC (permalink / raw)
  To: axboe, Linux Kernel Mailing List, Christoph Hellwig
  Cc: Linux Kernel Mailing List


>> Nack, we shoiuld never include userspace headers in kernel headers,
>> an even more never add !__KERNEL__ ifdefs.  Just make sure your
>> programs include limit.h before including linux/cdrom.h.
>
>I think header files should be complete, and should not use undefined
>macros, picking up every random definition that may be in effect when
>the header is included, don't you agree? 

No, because I be damn sure that some developers try compiling programs 
in non-linux environments (cygwin, solaris, andyourpersonaldistro, you 
name it) which do not have to adhere to <limits.h>. It might use 
<cosmiclimits.h> instead, or whatever.
Hence, such extra includes are a nogo.

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

end of thread, other threads:[~2007-11-12 20:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-10 14:55 [PATCH] Include header required for INT_MAX Thomas Koeller
2007-11-10 15:56 ` Christoph Hellwig
2007-11-11  0:52   ` Thomas Koeller
2007-11-10 16:48 ` Alexander E. Patrakov
  -- strict thread matches above, loose matches on Subject: below --
2007-11-11 22:52 Jan Engelhardt
2007-11-12 10:21 ` Peter Zijlstra
2007-11-12 10:46 ` Andreas Schwab
2007-11-12 10:51   ` Robert P. J. Day
2007-11-12 12:06     ` Andreas Schwab
2007-11-12 12:57       ` Vegard Nossum
2007-11-12 13:37         ` Jan Engelhardt
2007-11-12 20:50 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox