On Tue, Jun 06, 2000 at 11:54:52PM +0200, Martijn Lina wrote:
> i tried to compile e2fstools-1.18 and parted-1.0.15 and the both no longer
> compile after kernel 2.3.50. After contacting the parted developer, he said i
> should report it on this mailinglist.
>
> something goes wrong when including <fs.h> i guess, but i'm sure it's a
> kernel-header problem. output follows. last kernel i tried was 2.4.0test1-ac4
Funny - all these people with the same questions.
The answer is: if you write a program, and include <linux/foo.h>,
and it compiles and works today, then it will no longer compile tomorrow.
Or maybe it will still compile correctly, but now have some subtle elusive bugs.
The Linux kernel changes from day to day, and no guarantees are given
about namespace, types, etc. Just don't include kernel includes in user programs.
Then what to do? Turn
#include <linux/fs.h>
into
#include "my_linux_fs.h"
and do
% cp /usr/include/linux/fs.h my_linux_fs.h
and cut away all nonsense that you don't need.
The advantage is that your program source will not change automatically
whenever the kernel changes, so that if it compiled today it will still
do so next month. Most likely your program will remain correct with these
old headers, since one of the goals of Linux is not to break old programs -
old interfaces usually remain functional for a long time.
(Yes, there are unfortunate exceptions - no need to write about them.)
And when the old headers no longer suffice, update the program and make
a fresh copy of recent headers.
Maybe people have learned differently at school, and duplication of
information is unfortunate, but this is presently the Linux situation.
For examples, look at the util-linux distribution, which has linux_fs.h
and lp.h and loop.h and more, each introduced at a moment where it became
too painful to include the kernel version. No doubt other includes will
break later and make it necessary to remove further <linux/foo.h> includes
from that distribution's sources.
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/
This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:14 EST