linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix XFree86 build
@ 2003-11-14 20:22 Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2003-11-14 20:22 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andries.Brouwer, linux-kernel


Hi Linus.

Andries changed the struct member's name from "period" to "rate"
back in October 2002.  This was great for kernel code, but not so good
when the header is used for userspace (ie the XFree86 build uses it).
The following patch restores the old name for the benefit of userspace.

Index: include/linux/kd.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/linux/kd.h,v
retrieving revision 1.1
diff -u -p -r1.1 kd.h
--- a/include/linux/kd.h	29 Jul 2003 17:02:13 -0000	1.1
+++ b/include/linux/kd.h	14 Nov 2003 20:18:38 -0000
@@ -134,8 +134,11 @@ struct kbkeycode {
 
 struct kbd_repeat {
 	int delay;	/* in msec; <= 0: don't change */
+#ifdef __KERNEL__
 	int period;	/* in msec; <= 0: don't change */
-			/* earlier this field was misnamed "rate" */
+#else
+	int rate;	/* earlier this field was misnamed "rate" */
+#endif
 };
 
 #define KDKBDREP        0x4B52  /* set keyboard delay/repeat rate;

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix XFree86 build
@ 2003-11-14 21:15 Andries.Brouwer
  0 siblings, 0 replies; 2+ messages in thread
From: Andries.Brouwer @ 2003-11-14 21:15 UTC (permalink / raw)
  To: torvalds, willy; +Cc: Andries.Brouwer, linux-kernel

	--- a/include/linux/kd.h	29 Jul 2003 17:02:13 -0000	1.1
	+++ b/include/linux/kd.h	14 Nov 2003 20:18:38 -0000

	+#ifdef __KERNEL__

>From maintaining things like mount and kbd I can tell you
that it is hopeless to try and have user space source that
is source compatible with all kernel source versions.

Today the rule is "avoid including kernel includes".
Thus, one has to write

  /* from <linux/kd.h> */
  struct kbd_repeat {
          int delay;        /* in msec; <= 0: don't change */
          int period;       /* in msec; <= 0: don't change */
  };

or so, repeating the kernel include data in the user source.

Usually this is not too bad. It only gets really messy if the
kernel definitions are architecture-dependent.

On the other hand, the kernel is fairly good at staying
binary compatible. Thus, such copies in user space code
do not harm so much - once copied, they tend to remain correct.

Of course everybody hates this situation, and several people
have proposed action to remedy. I think you were one.
I did too, and got half a dozen replies from people who would like to
help constructing a kernel include hierarchy suitable for user space.

But we don't have it yet.

Andries

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-14 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-14 20:22 [PATCH] Fix XFree86 build Matthew Wilcox
2003-11-14 21:15 Andries.Brouwer

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).