[PATCH] remove unnecessary #includes from <linux/fs.h>

From: Jörn Engel
Date: Thu Oct 02 2003 - 11:17:55 EST


On Sun, 28 September 2003 22:00:01 +0200, Jörn Engel wrote:
> On Sun, 28 September 2003 20:42:24 +0100, Russell King wrote:
> >
> > and that will prevent the #include maze of 2.4, which resulted in
> > everything being rebuilt just because one header file was touched.
>
> Ok, how about this:
>
> for each header file {
> make header.o
> 1) if it doesn't build {
> print out a warning
> continue
> }
> for each #include line {
> remove the #include line
> make header.o
> 2) if it build {
> print out a warning
> }
> 3) if there are less than x gcc warnings {
> print out a warning
> }
> }
> }

You didn't comment on my suggestion, so I've done it manually once for
linux/fs.h and was shocked. It still passes my compile-standalone
test after removing 11! #include lines.

Another one was a false hit, because I compiled UP only, and some of
the remaining may be as well, but it looks like we recompile way too
much after changes to a random header.

Russell, can you comment this time, or should I shove the patch to
Linus and wait if anyone starts screaming?

Jörn

--
Sometimes, asking the right question is already the answer.
-- Unknown

--- linux-2.6.0-test5/include/linux/fs.h~include_prune 2003-10-02 18:07:20.000000000 +0200
+++ linux-2.6.0-test5/include/linux/fs.h 2003-10-02 18:09:41.000000000 +0200
@@ -6,20 +6,11 @@
* structures etc.
*/

-#include <linux/config.h>
-#include <linux/linkage.h>
-#include <linux/limits.h>
-#include <linux/wait.h>
-#include <linux/types.h>
#include <linux/kdev_t.h>
-#include <linux/ioctl.h>
-#include <linux/list.h>
#include <linux/dcache.h>
#include <linux/stat.h>
-#include <linux/cache.h>
#include <linux/radix-tree.h>
#include <linux/kobject.h>
-#include <asm/atomic.h>

struct iovec;
struct nameidata;
@@ -208,7 +199,6 @@
#ifdef __KERNEL__

#include <asm/semaphore.h>
-#include <asm/byteorder.h>

/* Used to be a macro which just called the function, now just a function */
extern void update_atime (struct inode *);
@@ -1236,8 +1226,6 @@
extern int is_subdir(struct dentry *, struct dentry *);
extern ino_t find_inode_number(struct dentry *, struct qstr *);

-#include <linux/err.h>
-
/* needed for stackable file system support */
extern loff_t default_llseek(struct file *file, loff_t offset, int origin);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/