[haiku-commits] r34612 - in haiku/trunk: headers/posix/sys src/libs/compat/freebsd_network/compat/sys

  • From: coling@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 10 Dec 2009 12:11:03 +0100 (CET)

Author: colin
Date: 2009-12-10 12:11:03 +0100 (Thu, 10 Dec 2009)
New Revision: 34612
Changeset: http://dev.haiku-os.org/changeset/34612/haiku

Modified:
   haiku/trunk/headers/posix/sys/sockio.h
   haiku/trunk/src/libs/compat/freebsd_network/compat/sys/ioccom.h
   haiku/trunk/src/libs/compat/freebsd_network/compat/sys/sockio.h
Log:
* Moved socket ioctls from FreeBSD compat layer into the corresponding Haiku
  header. This shall ensure uniqueness of the ioctls.
* Added a special SIOCEND define to Haiku's sockio.h, so that drivers can define
  private ioctls as can be seen in 
src/add-ons/kernel/drivers/network/wlan/atheros/dev/ath/if_athioctl.h.
* Modified ioccom.h of the FreeBSD compat layer, to make use of the special
  SIOCEND define.


Modified: haiku/trunk/headers/posix/sys/sockio.h
===================================================================
--- haiku/trunk/headers/posix/sys/sockio.h      2009-12-10 10:29:37 UTC (rev 
34611)
+++ haiku/trunk/headers/posix/sys/sockio.h      2009-12-10 11:11:03 UTC (rev 
34612)
@@ -52,4 +52,11 @@
 #define SIOCSPGRP                      8939    /* set process group */
 #define SIOCGPGRP                      8940    /* get process group */
 
+#define SIOCGPRIVATE_0         8941    /* device private 0 */
+#define SIOCGPRIVATE_1         8942    /* device private 1 */
+#define SIOCSDRVSPEC           8943    /* set driver-specific parameters */
+#define SIOCGDRVSPEC           8944    /* get driver-specific parameters */
+
+#define SIOCEND                                8944    /* Always set to 
highest SIOC* */
+
 #endif /* _SYS_SOCKIO_H */

Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/ioccom.h
===================================================================
--- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/ioccom.h     
2009-12-10 10:29:37 UTC (rev 34611)
+++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/ioccom.h     
2009-12-10 11:11:03 UTC (rev 34612)
@@ -6,23 +6,7 @@
 #define _FBSD_COMPAT_SYS_IOCCOM_H_
 
 
-/*
- * Ioctl's have the command encoded in the lower word, and the size of
- * any in or out parameters in the upper word.  The high 3 bits of the
- * upper word are used to encode the in/out status of the parameter.
- */
-#define        IOCPARM_MASK 0x1fff             /* parameter length, at most 13 
bits */
+#define        _IOW(g,n,t)             SIOCEND + n
+#define        _IOWR(g,n,t)    SIOCEND + n
 
-#define        IOC_OUT         0x40000000      /* copy out parameters */
-#define        IOC_IN          0x80000000      /* copy in parameters */
-#define        IOC_INOUT       (IOC_IN|IOC_OUT)
-
-
-#define        _IOC(inout,group,num,len) ((unsigned long) \
-       ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
-
-#define        _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
-/* this should be _IORW, but stdio got there first */
-#define        _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
-
 #endif /* _FBSD_COMPAT_SYS_IOCCOM_H_ */

Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/sockio.h
===================================================================
--- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/sockio.h     
2009-12-10 10:29:37 UTC (rev 34611)
+++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/sockio.h     
2009-12-10 11:11:03 UTC (rev 34612)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Haiku Inc. All rights reserved.
+ * Copyright 2007-2009 Haiku Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  */
 #ifndef _FBSD_COMPAT_SYS_SOCKIO_H_
@@ -13,14 +13,4 @@
 
 #define SIOCSIFCAP     SIOCSPACKETCAP
 
-// TODO look whether those ioctls are already used by Haiku
-// and add them to Haiku's sockio.h eventually
-#define        SIOCGPRIVATE_0  _IOWR('i', 80, struct ifreq)    /* device 
private 0 */
-#define        SIOCGPRIVATE_1  _IOWR('i', 81, struct ifreq)    /* device 
private 1 */
-
-#define        SIOCSDRVSPEC    _IOW('i', 123, struct ifdrv)    /* set 
driver-specific
-                                                                 parameters */
-#define        SIOCGDRVSPEC    _IOWR('i', 123, struct ifdrv)   /* get 
driver-specific
-                                                                 parameters */
-
 #endif


Other related posts: