diff options
author | imp <imp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f> | 2020-10-30 22:00:35 +0000 |
---|---|---|
committer | imp <imp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f> | 2020-10-30 22:00:35 +0000 |
commit | 51637d040e3f83da64294a8239075a2bc23b8582 (patch) | |
tree | 70e6edeade2548c200e71bda7c7cdf453ec0f3d3 | |
parent | cb5818214d7d321898de92e1652fe575011f750b (diff) | |
download | freebsd-51637d040e3f83da64294a8239075a2bc23b8582.tar.gz freebsd-51637d040e3f83da64294a8239075a2bc23b8582.tar.bz2 |
Integrate 4.4BSD-Lite2 changes to IOC_* definitions
Bring in the long-overdue 4.4BSD-Lite2 rev 8.3 by cgd of
sys/ioccom.h. This uses UL suffix for the IOC_* constants so they
don't sign extend. Also bring in the handy diagram from NetBSD's
version of this file. This alters the 4.4BSD-Lite2 code slightly
in a way that's semantically the same but more compact.
This should stop the warnings from Chrome for bogus sign extension.
Reviewed by: kib@, jhb@
Differential Revision: https://reviews.freebsd.org/D26423
git-svn-id: http://svn.freebsd.org/base/head@367189 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
-rw-r--r-- | sys/sys/ioccom.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/sys/ioccom.h b/sys/sys/ioccom.h index 3e5f7200fb1..0329ac35849 100644 --- a/sys/sys/ioccom.h +++ b/sys/sys/ioccom.h @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 + * @(#)ioccom.h 8.3 (Berkeley) 1/9/95 * $FreeBSD$ */ @@ -39,6 +39,11 @@ * 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. + * + * 31 29 28 16 15 8 7 0 + * +---------------------------------------------------------------+ + * | I/O | Parameter Length | Command Group | Command | + * +---------------------------------------------------------------+ */ #define IOCPARM_SHIFT 13 /* number of bits for ioctl size */ #define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */ @@ -47,11 +52,12 @@ #define IOCGROUP(x) (((x) >> 8) & 0xff) #define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */ -#define IOC_VOID 0x20000000 /* no parameters */ -#define IOC_OUT 0x40000000 /* copy out parameters */ -#define IOC_IN 0x80000000 /* copy in parameters */ -#define IOC_INOUT (IOC_IN|IOC_OUT) -#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN) + +#define IOC_VOID 0x20000000UL /* no parameters */ +#define IOC_OUT 0x40000000UL /* copy out parameters */ +#define IOC_IN 0x80000000UL /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT)/* copy parameters in and out */ +#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN)/* mask for IN/OUT/VOID */ #define _IOC(inout,group,num,len) ((unsigned long) \ ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) |