[PATCH] don't export fb.h internal structure to userland
From: GOTO Masanori <gotom@debian.or.jp>
Date: 2003-11-04 05:03:49
Hi,
This patch fixes not to compile with linux/fb.h:
> cat fb.c
#include <linux/fb.h>
int main() {}
> gcc fb.c
In file included from /usr/include/linux/timer.h:5,
from /usr/include/linux/workqueue.h:8,
from /usr/include/linux/fb.h:5,
from fb.c:1:
/usr/include/linux/list.h:576:2: warning: #warning "don't include kernel headers in userspace"
In file included from /usr/include/linux/timer.h:6,
from /usr/include/linux/workqueue.h:8,
from /usr/include/linux/fb.h:5,
from fb.c:1:
...
This sample program worked in kernel 2.4. Actually this problem is
occured by (1) including workqueue.h, and (2) struct fb_pixmap has
spinlock_t. This patch fixes with (1) move workqueue.h to internal of
__KERNEL__, (2) also move struct fb_pixmap to internal of __KERNEL__.
Now fb.h don't export kernel internal structure to userland.
Please apply it.
Regards,
-- gotom
--- include/linux/fb.h 2003-06-23 03:32:39.000000000 +0900
+++ include/linux/fb.h.new 2003-11-04 13:50:12.000000000 +0900@@ -2,7 +2,6 @@ #define _LINUX_FB_H #include <linux/tty.h> -#include <linux/workqueue.h> #include <asm/types.h> #include <asm/io.h>
@@ -331,23 +330,11 @@ #define FB_PIXMAP_IO 4 /* memory is iomapped */ #define FB_PIXMAP_SYNC 256 /* set if GPU can DMA */ -struct fb_pixmap { - __u8 *addr; /* pointer to memory */ - __u32 size; /* size of buffer in bytes */ - __u32 offset; /* current offset to buffer */ - __u32 buf_align; /* byte alignment of each bitmap */ - __u32 scan_align; /* alignment per scanline */ - __u32 flags; /* see FB_PIXMAP_* */ - /* access methods */ - void (*outbuf)(u8 *dst, u8 *addr, unsigned int size); - u8 (*inbuf) (u8 *addr); - spinlock_t lock; /* spinlock */ - atomic_t count; -}; #ifdef __KERNEL__ #include <linux/fs.h> #include <linux/init.h> +#include <linux/workqueue.h> struct fb_info; struct vm_area_struct;
@@ -395,6 +382,20 @@ int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma); }; +struct fb_pixmap { + __u8 *addr; /* pointer to memory */ + __u32 size; /* size of buffer in bytes */ + __u32 offset; /* current offset to buffer */ + __u32 buf_align; /* byte alignment of each bitmap */ + __u32 scan_align; /* alignment per scanline */ + __u32 flags; /* see FB_PIXMAP_* */ + /* access methods */ + void (*outbuf)(u8 *dst, u8 *addr, unsigned int size); + u8 (*inbuf) (u8 *addr); + spinlock_t lock; /* spinlock */ + atomic_t count; +}; + struct fb_info { int node; int flags; -------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/