10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*6940Ssuha * Common Development and Distribution License, Version 1.0 only 6*6940Ssuha * (the "License"). You may not use this file except in compliance 7*6940Ssuha * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*6940Ssuha * Copyright 1997 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 280Sstevel@tonic-gate /* All Rights Reserved */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate /* 310Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 320Sstevel@tonic-gate * The Regents of the University of California 330Sstevel@tonic-gate * All Rights Reserved 340Sstevel@tonic-gate * 350Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 360Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 370Sstevel@tonic-gate * contributors. 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate 400Sstevel@tonic-gate #ifndef _SYS_IOCCOM_H 410Sstevel@tonic-gate #define _SYS_IOCCOM_H 420Sstevel@tonic-gate 430Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 440Sstevel@tonic-gate 450Sstevel@tonic-gate #ifdef __cplusplus 460Sstevel@tonic-gate extern "C" { 470Sstevel@tonic-gate #endif 480Sstevel@tonic-gate 490Sstevel@tonic-gate /* 500Sstevel@tonic-gate * Ioctl's have the command encoded in the lower word, 510Sstevel@tonic-gate * and the size of any in or out parameters in the upper 520Sstevel@tonic-gate * word. The high 2 bits of the upper word are used 53*6940Ssuha * to encode the in/out status of the parameter; for now 54*6940Ssuha * we restrict parameters to at most 255 bytes. 550Sstevel@tonic-gate */ 56*6940Ssuha #define IOCPARM_MASK 0xff /* parameters must be < 256 bytes */ 570Sstevel@tonic-gate #define IOC_VOID 0x20000000 /* no parameters */ 580Sstevel@tonic-gate #define IOC_OUT 0x40000000 /* copy out parameters */ 590Sstevel@tonic-gate #define IOC_IN 0x80000000 /* copy in parameters */ 600Sstevel@tonic-gate #define IOC_INOUT (IOC_IN|IOC_OUT) 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* 630Sstevel@tonic-gate * The 0x20000000 is so we can distinguish new ioctl's from old. 640Sstevel@tonic-gate */ 650Sstevel@tonic-gate #define _IO(x, y) (IOC_VOID|(x<<8)|y) 660Sstevel@tonic-gate #define _IOR(x, y, t) \ 670Sstevel@tonic-gate ((int)((uint32_t) \ 680Sstevel@tonic-gate (IOC_OUT|(((sizeof (t))&IOCPARM_MASK)<<16)|(x<<8)|y))) 690Sstevel@tonic-gate 700Sstevel@tonic-gate #define _IORN(x, y, t) ((int)((uint32_t)(IOC_OUT|(((t)&IOCPARM_MASK)<<16)| \ 710Sstevel@tonic-gate (x<<8)|y))) 720Sstevel@tonic-gate 730Sstevel@tonic-gate #define _IOW(x, y, t) \ 740Sstevel@tonic-gate ((int)((uint32_t)(IOC_IN|(((sizeof (t))&IOCPARM_MASK)<<16)| \ 750Sstevel@tonic-gate (x<<8)|y))) 760Sstevel@tonic-gate 770Sstevel@tonic-gate #define _IOWN(x, y, t) ((int32_t)(uint32_t)(IOC_IN|(((t)&IOCPARM_MASK)<<16)| \ 780Sstevel@tonic-gate (x<<8)|y)) 790Sstevel@tonic-gate 800Sstevel@tonic-gate #define _IOWR(x, y, t) \ 810Sstevel@tonic-gate ((int)((uint32_t)(IOC_INOUT|(((sizeof (t))&IOCPARM_MASK)<<16)| \ 820Sstevel@tonic-gate (x<<8)|y))) 830Sstevel@tonic-gate 840Sstevel@tonic-gate #define _IOWRN(x, y, t) \ 850Sstevel@tonic-gate ((int)((uint32_t)(IOC_INOUT|(((t)&IOCPARM_MASK)<<16)| \ 860Sstevel@tonic-gate (x<<8)|y))) 870Sstevel@tonic-gate 880Sstevel@tonic-gate #ifdef __cplusplus 890Sstevel@tonic-gate } 900Sstevel@tonic-gate #endif 910Sstevel@tonic-gate 920Sstevel@tonic-gate #endif /* _SYS_IOCCOM_H */ 93