From ccc02f719a95d2d4c4a48e65e7ce24342ed0e62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20G=C3=BCnther?= Date: Thu, 10 Dec 2009 11:11:03 +0000 Subject: [PATCH] * 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34612 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/sys/sockio.h | 7 +++++++ .../freebsd_network/compat/sys/ioccom.h | 20 ++----------------- .../freebsd_network/compat/sys/sockio.h | 12 +---------- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/headers/posix/sys/sockio.h b/headers/posix/sys/sockio.h index 176a13eb0a..c5c3dc5f27 100644 --- a/headers/posix/sys/sockio.h +++ b/headers/posix/sys/sockio.h @@ -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 */ diff --git a/src/libs/compat/freebsd_network/compat/sys/ioccom.h b/src/libs/compat/freebsd_network/compat/sys/ioccom.h index 158c95f18e..f6ba2deb2d 100644 --- a/src/libs/compat/freebsd_network/compat/sys/ioccom.h +++ b/src/libs/compat/freebsd_network/compat/sys/ioccom.h @@ -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 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)) +#define _IOW(g,n,t) SIOCEND + n +#define _IOWR(g,n,t) SIOCEND + n #endif /* _FBSD_COMPAT_SYS_IOCCOM_H_ */ diff --git a/src/libs/compat/freebsd_network/compat/sys/sockio.h b/src/libs/compat/freebsd_network/compat/sys/sockio.h index 909b207a96..7d469d7e38 100644 --- a/src/libs/compat/freebsd_network/compat/sys/sockio.h +++ b/src/libs/compat/freebsd_network/compat/sys/sockio.h @@ -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