lkml.org 
[lkml]   [2006]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lkdtm: cleanup headers and module_param/MODULE_PARM_DESC
Ankita Garg wrote:
> Hi,
>
>> #include <linux/kernel.h>
>> +#include <linux/fs.h>
>> #include <linux/module.h>
>> +#include <linux/buffer_head.h>
>> #include <linux/kprobes.h>
>> -#include <linux/kallsyms.h>
>> +#include <linux/list.h>
>> #include <linux/init.h>
>> -#include <linux/irq.h>
>> #include <linux/interrupt.h>
>> +#include <linux/hrtimer.h>
>> #include <scsi/scsi_cmnd.h>
>
> Why does the module require fs.h, hrtimer.h, list.h and buffer_head.h? It works fine for me without these header files. I do not get any gcc warning. Moreover, I found that even init.h and interrupt.h are also not required.

fs.h: struct file *, struct block_device *
hrtimer.h: struct hrtimer *
list.h: struct list_head *
buffer_head.h: struct buffer_head *

struct buffer_head is what triggered this. gcc warns like this:

CC [M] drivers/misc/lkdtm.o
drivers/misc/lkdtm.c:150: warning: 'struct buffer_head' declared inside parameter list
drivers/misc/lkdtm.c:150: warning: its scope is only this definition or declaration, which is probably not what you want

or you could not #include those files and just do new source code lines like:

struct hrtimer;
struct buffer_head;
struct file;
struct block_dev;
struct list_head;

What we want to see is that source files explicly #include all header files
that they need or use, for structs, unions, extern data, function APIs, etc.
What is happening with lkdtm is that one or more header files is doing
this for you. We want it to be more explicit than that.

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

\
 
 \ /
  Last update: 2006-10-26 06:53    [W:0.030 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site