[BusyBox] [patch] Cleanup for libbb/loop.c

Aurelien Jacobs aurel at gnuage.org
Wed Nov 17 01:40:27 UTC 2004


On Tue, 16 Nov 2004 13:18:18 -0700
Erik Andersen <andersen at codepoet.org> wrote:

> On Tue Nov 16, 2004 at 06:51:39AM -0600, Rob Landley wrote:
> > P.S.  Why are we including kernel_types.h in a userspace program
> > at all?  Anybody know?
> 
> Because we need to define structure which communicates
> between the kernel and user space.
> 
> > --- busybox/busybox/libbb/loop.c	2004-08-16 04:36:28.000000000 -0400
> > +++ lfs/newbuild/lfs/tools/sources/busybox-new/libbb/loop.c	2004-11-16 05:50:57.000000000 -0500
> > @@ -19,6 +19,9 @@
> >   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> >   */
> >  
> > +#include <asm/posix_types.h>
> > +#include <linux/loop.h>
> 
> 
> No no no no no no no no no!
> 
> Rule #1: Never ever include kernel header files in user space.
> Rule #2: See Rule #1
> Rule #3: See Rule #2

I won't advocate for this patch, but those rules seem a little bit
basic to me.

Here is a better quote of the patch :

+#include <asm/posix_types.h>
+#include <linux/loop.h>

-#include <linux/version.h>
-#include <asm/posix_types.h>

So I can't see more or less kernel header include after than before !
I understand that including version.h is not the same as loop.h,
but Rule #1 do not specifie this ;-)

This don't mean that the patch is right, but that Rule #1 is wrong ;-)

Aurel



More information about the busybox mailing list