public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <randy.dunlap@oracle.com>
To: ankita@in.ibm.com
Cc: lkml <linux-kernel@vger.kernel.org>, akpm <akpm@osdl.org>
Subject: Re: [PATCH] lkdtm: cleanup headers and module_param/MODULE_PARM_DESC
Date: Wed, 25 Oct 2006 21:50:20 -0700	[thread overview]
Message-ID: <45403E8C.80801@oracle.com> (raw)
In-Reply-To: <20061026041341.GA6562@in.ibm.com>

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

      reply	other threads:[~2006-10-26  4:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-24  3:06 [PATCH] lkdtm: cleanup headers and module_param/MODULE_PARM_DESC Randy Dunlap
2006-10-26  4:13 ` Ankita Garg
2006-10-26  4:50   ` Randy.Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45403E8C.80801@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@osdl.org \
    --cc=ankita@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox