kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: rpjday@crashcourse.ca (Robert P. J. Day)
To: kernelnewbies@lists.kernelnewbies.org
Subject: should include/uapi include header files *unused* in kernel space?
Date: Sat, 4 Feb 2017 07:07:27 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.20.1702040657140.17706@localhost.localdomain> (raw)
In-Reply-To: <CA+r1Zhj33eD5-O_VkC6Q+BnLVpy7aqhv=_v3pNHCSbY_rXL8PQ@mail.gmail.com>

On Fri, 3 Feb 2017, Jim Davis wrote:

> On Sun, Jan 22, 2017 at 6:18 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> >
> >   was perusing the UAPI content in the kernel source, prepping for a
> > course i'm teaching tomorrow, and just noticed there is a header file:
> >
> >   $ find . -name mtd-user.h
> >   ./include/uapi/mtd/mtd-user.h
> >   $
> >
> > which appears to be *entirely* unreferenced in the entire kernel code
> > base (outside of the Kbuild file that refers to it):
> >
> >   $ grep -r 'mtd-user.h' *
> >   include/uapi/mtd/Kbuild:header-y += mtd-user.h
> >   $
>
> Someone has a patch to remove msr-index.h which, in a similar way,
> only ended up being exported because of a Kbuild rule.  So I'd
> imagine this file would be a candidate for a similar patch.
> https://lkml.org/lkml/2017/2/2/228.

  i'm not sure we're talking about the same situations here.

  in the case you mention, it appears that msr-index.h could be
dropped from exporting since (i'm assuming) nothing in user space
needs it. but it's still included from several places in kernel space:

$ grep -r "msr-index.h" *
arch/x86/realmode/rm/wakeup_asm.S:#include <asm/msr-index.h>
arch/x86/realmode/rm/reboot.S:#include <asm/msr-index.h>
arch/x86/xen/enlighten.c:#include <asm/msr-index.h>
arch/x86/boot/cpuflags.c:#include <asm/msr-index.h>
arch/x86/boot/cpucheck.c:#include <asm/msr-index.h>
arch/x86/kernel/verify_cpu.S:#include <asm/msr-index.h>
arch/x86/kernel/head_32.S:#include <asm/msr-index.h>
... etc etc ...
$

so, in this case, that header file is still useful in kernel space and
must be kept.

  in the case *i* mention (mtd-user.h), it appears that that header
file *does* need to exist in user space, but it is totally unused in
kernel space:

$ grep -r "mtd-user.h" *
include/uapi/mtd/Kbuild:header-y += mtd-user.h
$

in cases like this, is it really appropriate for that header file to
exist in kernel space when nothing in kernel space includes it?

  yes, i appreciate the convenience of having all those mtd-related
header files defined in one place; i'm just curious about what the
standard practice is for kernel space defining header files it has no
need for.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22 13:18 should include/uapi include header files *unused* in kernel space? Robert P. J. Day
2017-02-03 21:53 ` Jim Davis
2017-02-04 12:07   ` Robert P. J. Day [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=alpine.LFD.2.20.1702040657140.17706@localhost.localdomain \
    --to=rpjday@crashcourse.ca \
    --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).