(i) It is a form of documentation.
We could even fix a format, so that automatic tools could read it,
and pretty printers could print a text: The Linux API.
Today kernel-internal and public stuff is intermingled.
Today most ioctls are undocumented.
(ii) It increases stability.
Just because kernel-internal and public stuff is intermingled today,
it happens regularly that someone by accident breaks a public
interface.
(iii) Only about ten? Perhaps.
I just released util-linux-2.10b. It refers to
<linux/blkpg.h>
<linux/cyclades.h>
<linux/fd.h>
<linux/fs.h>
<linux/hdreg.h>
<linux/ipc.h>
<linux/kd.h>
<linux/linkage.h>
<linux/loop.h>
<linux/major.h>
<linux/mc146818rtc.h>
<linux/minix_fs.h>
<linux/nfs.h>
<linux/nfs_mount.h>
<linux/posix_types.h>
<linux/tqueue.h>
<linux/tty.h>
<linux/types.h>
<linux/unistd.h>
<linux/version.h>
<asm/io.h>
<asm/ioctls.h>
<asm/kbio.h>
<asm/page.h>
<asm/param.h>
<asm/rtc.h>
and used to refer to a few more, like <linux/lp.h>, <linux/mount.h>
and <linux/swap.h> before that became impossible.
Many of these headers again include further headers. For example,
fs.h includes autoconf.h config.h dcache.h ioctl.h kdev_t.h limits.h
linkage.h list.h net.h posix_types.h socket.h sockios.h stat.h types.h
uio.h vfs.h wait.h.
But you may be right that if one knows libc is glibc 2.1 several of
these can be avoided. Unfortunately one cannot assume that.
(iv) It may prevent unfortunate decisions.
Today we have
union swap_header {
struct
{
char reserved[PAGE_SIZE - 10];
char magic[10];
} magic;
...
}
a rather unfortunate construct. PAGE_SIZE is a kernel-internal constant.
With a clear separation between public and kernel-internal data nobody
would have used a kernel-internal constant for a public interface.
4096 would have been so much better than the architecture- and model-
dependent PAGE_SIZE.
[Please - don't discuss the example. If you think PAGE_SIZE is public,
I disagree, outside the kernel one has getpagesize(), but it is irrelevant.
There are many other examples. A bad case is <linux/loop.h> where the dev_t
exposed by the kernel is not the dev_t used by glibc, which leads to lots
of problems.]
Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/