Re: Why 'linux/fs.h' cannot be included? I *can*...

From: Pete Zaitcev (zaitcev@redhat.com)
Date: Wed Jan 30 2002 - 13:24:22 EST


> The problem is that I don't want to copy the definitions I need
> from linux/fs.h, because this will lead to problems if those
> definitions change.

This is a common misconception. Traditional UNIX operates
this way, indeed. They do "make world" and build everything
in one go, so programs are automatically compatible with
the kernel (in theory, anyways). Once programs outside
of "make world" start to need access to these interfaces,
the scheme crumbles to the ground.

Linus (and thus Linux) consciously decided that this
so-called "souce compatibility" is a mirage. Only binary
compatibility matters. So, you must copy headers that
you wish to use, including linux/fs.h. Then, your program
is binary compatible with the kernel from which you took
them. New kernels may support your program by providing
the same interface, and they may have NO linux/fs.h
at all. If you included headers, you would not be
able to compile your program at all, but the old binary
would continue to work, and copied headers would continue
to work.

Those who come from UNIX background keep insisting to
include kernel headers, especially when they write
drivers with ioctl argument structures. But there is
no other way for them, but to educate themselves in
the Linux lore. Kernel headers are not to be included
in applications.

-- Pete
-
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/



This archive was generated by hypermail 2b29 : Thu Jan 31 2002 - 21:01:22 EST