kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Kernel header inclusion practice
Date: Wed, 5 Jul 2017 14:07:42 +0200	[thread overview]
Message-ID: <20170705120742.GB9714@kroah.com> (raw)
In-Reply-To: <CAJQX3DxAap_pUXXA3DNEnqQp2JGWzbsXw=zaXyKLim0NUFV6nQ@mail.gmail.com>

On Wed, Jul 05, 2017 at 02:50:59PM +0800, Shiyao MA wrote:
> Hi,
> 
> How do you include the kernel headers?
> 
> For example,
> Currently I have the headers:
> #include <linux/module.h>
> #include <linux/kthread.h>
> #include <linux/delay.h>
> 
> And now I wanna use the  `struct workqueue_struct'. It turns out I
> don't have to include the "linux/workqueue.h".
> 
> So it must have already been included by the three headers above.
> 
> My question is:
> 
> What's the practice of including headers?
> Should I specifically include "linux/workqueue.h" ?

To be safe, yes, please do, sometimes other arches will not pull in the
.h files automatically that you expect them to.  So be specific.

> Another question is particular to the above three headers: does any of
> them guarantee to include the "linux/queue.h"?

Nope, if you need it, list it.

> If there is any documentation about the API of the headers (e.g., what
> they include), that will be great.

What exactly do you mean by this?

thanks,

greg k-h

  reply	other threads:[~2017-07-05 12:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05  6:50 Kernel header inclusion practice Shiyao MA
2017-07-05 12:07 ` Greg KH [this message]
2017-07-05 12:13   ` Shiyao Ma
2017-07-05 12:32     ` Greg KH

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=20170705120742.GB9714@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).