public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.18 Headers - Long
@ 2006-07-12  0:35 Jim Gifford
  2006-07-14  0:25 ` David Woodhouse
  0 siblings, 1 reply; 35+ messages in thread
From: Jim Gifford @ 2006-07-12  0:35 UTC (permalink / raw)
  To: LKML

I was really glad to see that something was going to be done with the 
headers, but I don't think it's enough. I'm going to share my concerns 
and hopefully we can all figure what is the right thing to do.

First off, my research in this has been going on since LLH announced 
that it was not going to produce any more headers. I started a project 
to sanitize the headers myself. http://headers.cross-lfs.org.

I will only document one issue, but there are several more like this in 
the kernel.

I'm going to use the MIPS architecture in my example, along with the 
file page.h.

With the 2.6.18 headers, the file that gets created looks like this. If 
you notice on lines 17, 20, 23, 26, and 34 they all use CONFIG_{...}, 
these variables are called from linux/autoconf.h. Yes, the simple fix 
would be to include this file.

   1.
      /*
   2.
       * This file is subject to the terms and conditions of the GNU
      General Public
   3.
       * License.  See the file "COPYING" in the main directory of this
      archive
   4.
       * for more details.
   5.
       *
   6.
       * Copyright (C) 1994 - 1999, 2000, 03 Ralf Baechle
   7.
       * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
   8.
       */
   9.
      #ifndef _ASM_PAGE_H
  10.
      #define _ASM_PAGE_H
  11.
       
  12.
       
  13.
       
  14.
      /*
  15.
       * PAGE_SHIFT determines the page size
  16.
       */
  17.
      #ifdef CONFIG_PAGE_SIZE_4KB
  18.
      #define PAGE_SHIFT      12
  19.
      #endif
  20.
      #ifdef CONFIG_PAGE_SIZE_8KB
  21.
      #define PAGE_SHIFT      13
  22.
      #endif
  23.
      #ifdef CONFIG_PAGE_SIZE_16KB
  24.
      #define PAGE_SHIFT      14
  25.
      #endif
  26.
      #ifdef CONFIG_PAGE_SIZE_64KB
  27.
      #define PAGE_SHIFT      16
  28.
      #endif
  29.
      #define PAGE_SIZE       (1UL << PAGE_SHIFT)
  30.
      #define PAGE_MASK       (~((1 << PAGE_SHIFT) - 1))
  31.
       
  32.
       
  33.
       
  34.
      #ifdef CONFIG_LIMITED_DMA
  35.
      #define WANT_PAGE_VIRTUAL
  36.
      #endif
  37.
       
  38.
      #include <asm-generic/memory_model.h>
  39.
      #include <asm-generic/page.h>
  40.
       
  41.
      #endif /* _ASM_PAGE_H */

Here's the header I produce with my sanitize script, I use a glibc call 
to get the information, which would be more appropriate for the user 
space. This is very similar to what LLH provided. Even my example is not 
prefect due to line 14.

   1.
      #define _ASM_PAGE_H
   2.
       
   3.
      #include <unistd.h>
   4.
       
   5.
      #define PAGE_SIZE       (getpagesize())
   6.
      static __inline__ int getpageshift()
   7.
      {
   8.
          int pagesize = getpagesize();
   9.
          return (__builtin_clz(pagesize) ^ 31);
  10.
      }
  11.
      #define PAGE_SHIFT      (getpageshift())
  12.
      #define PAGE_MASK       (~(PAGE_SIZE-1))
  13.
       
  14.
      #ifdef CONFIG_LIMITED_DMA
  15.
      #define WANT_PAGE_VIRTUAL
  16.
      #endif
  17.
       
  18.
      #endif /* !(_ASM_PAGE_H) */


So even with the new headers_install, the headers still need to be 
sanitized to overcome the missing variables from linux/autoconf.h.

Just wanted to bring this up to everyone's attention and look forward to 
helping get things resolved.

^ permalink raw reply	[flat|nested] 35+ messages in thread
* Re: 2.6.18 Headers - Long
@ 2006-07-15 21:09 Albert Cahalan
  2006-07-15 21:19 ` Arjan van de Ven
                   ` (4 more replies)
  0 siblings, 5 replies; 35+ messages in thread
From: Albert Cahalan @ 2006-07-15 21:09 UTC (permalink / raw)
  To: dwmw2, arjan, maillist, ralf, linux-kernel, davem

David Woodhouse writes:

> Kernel headers are _not_ a library of random crap for userspace to use.

The attraction is that the kernel abstractions are very nice.
Much of the POSIX API sucks ass. The kernel stuff is NOT crap.

Here we have a full-featured set of atomic ops, byte swapping
with readable names and a distinction for pointers, nice macros
for efficient data structure manipulation...

Sure, you'd like all the app developers to write bloated C++
and use sucky POSIX threads stuff, but then you're not the
one who has to write or maintain it.

Don't blame app developers if they go for what is good.
To stop them, provide the goodness in a sane way.
(alternately, make the Linux code suck ass more than POSIX)

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

end of thread, other threads:[~2006-08-29 12:25 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-12  0:35 2.6.18 Headers - Long Jim Gifford
2006-07-14  0:25 ` David Woodhouse
2006-07-14  2:18   ` Jim Gifford
2006-07-14 18:55     ` David Woodhouse
2006-07-14 19:28       ` Jim Gifford
2006-07-14 19:39         ` Arjan van de Ven
2006-07-14 20:16           ` David Woodhouse
2006-07-14 20:19             ` David Miller
2006-07-14 20:57               ` Jim Gifford
2006-07-15  4:33                 ` Randy.Dunlap
2006-07-16 14:08                   ` Nix
2006-07-15  7:19                 ` David Woodhouse
2006-07-15  7:08               ` David Woodhouse
2006-07-14 19:57         ` David Woodhouse
2006-07-14 20:06         ` Erik Andersen
2006-07-14 20:19   ` Christoph Hellwig
2006-08-26 16:09   ` David Woodhouse
2006-08-29 12:25     ` Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2006-07-15 21:09 Albert Cahalan
2006-07-15 21:19 ` Arjan van de Ven
2006-07-17  5:21   ` Ralf Baechle
2006-07-15 21:44 ` Adrian Bunk
2006-07-15 21:47 ` David Woodhouse
2006-07-16  6:18   ` Albert Cahalan
2006-07-16  6:26     ` Arjan van de Ven
2006-07-16  8:05     ` David Woodhouse
2006-07-16  8:20 ` Jakub Jelinek
2006-07-16 12:34 ` Kyle Moffett
2006-07-16 12:48   ` Russell King
2006-07-16 18:38   ` Albert Cahalan
2006-07-16 18:53     ` Russell King
2006-07-16 19:22       ` Albert Cahalan
2006-07-16 19:41         ` Russell King
2006-07-17  1:26         ` Arjan van de Ven
2006-07-17  1:23   ` David Miller

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