mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* any thoughts yet on a "generic" ioctl.h?
@ 2007-03-08 21:03 Robert P. J. Day
  2007-03-09  3:42 ` Stefan Richter
  0 siblings, 1 reply; 7+ messages in thread
From: Robert P. J. Day @ 2007-03-08 21:03 UTC (permalink / raw)
  To: Linux Kernel Mailing List


  i asked about this a while back, but i still haven't heard a
definitive response as to whether it's acceptable.  that is, extending
the header file "asm-generic/ioctl.h" to allow arch-specific ioctl.h
header files to override what little might need to be changed from the
generic file:

==================================================
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index cd02729..e035e6d 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -21,8 +21,15 @@
  */
 #define _IOC_NRBITS	8
 #define _IOC_TYPEBITS	8
-#define _IOC_SIZEBITS	14
-#define _IOC_DIRBITS	2
+/*
+ *  Let any architecture override either of the following.
+ */
+#ifndef _IOC_SIZEBITS
+# define _IOC_SIZEBITS	14
+#endif
+#ifndef _IOC_DIRBITS
+# define _IOC_DIRBITS	2
+#endif

 #define _IOC_NRMASK	((1 << _IOC_NRBITS)-1)
 #define _IOC_TYPEMASK	((1 << _IOC_TYPEBITS)-1)
@@ -35,11 +42,17 @@
 #define _IOC_DIRSHIFT	(_IOC_SIZESHIFT+_IOC_SIZEBITS)

 /*
- * Direction bits.
+ * Direction bits, which any architecture can choose to override.
  */
-#define _IOC_NONE	0U
-#define _IOC_WRITE	1U
-#define _IOC_READ	2U
+#ifndef _IOC_NONE
+# define _IOC_NONE	0U
+#endif
+#ifndef _IOC_WRITE
+# define _IOC_WRITE	1U
+#endif
+#ifndef _IOC_READ
+# define _IOC_READ	2U
+#endif

 #define _IOC(dir,type,nr,size) \
 	(((dir)  << _IOC_DIRSHIFT) | \
========================================

  from just a cursory examination, the only values that seem to ever
need to be different are the ones mentioned above, which would make
some of those arch-specific ioctl.h files *way* shorter than they are
now.

  is this considered an acceptable kernel programming practise?  or is
it understood that, if an arch-specific header file differs *at* *all*
from the generic one, it will be a *complete* replacement for that
generic version?

rday

p.s.  i haven't looked but i'd have to guess that there are some other
header files that could be modified the same way.

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

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

end of thread, other threads:[~2007-03-09 12:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-08 21:03 any thoughts yet on a "generic" ioctl.h? Robert P. J. Day
2007-03-09  3:42 ` Stefan Richter
2007-03-09  9:53   ` Robert P. J. Day
2007-03-09 11:17     ` Stefan Richter
2007-03-09 11:22       ` Robert P. J. Day
2007-03-09 12:38         ` Stefan Richter
2007-03-09 12:48           ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®