Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/ioccom.h
Show All 22 Lines | |||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* @(#)ioccom.h 8.2 (Berkeley) 3/28/94 | * @(#)ioccom.h 8.3 (Berkeley) 1/9/95 | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _SYS_IOCCOM_H_ | #ifndef _SYS_IOCCOM_H_ | ||||
#define _SYS_IOCCOM_H_ | #define _SYS_IOCCOM_H_ | ||||
/* | /* | ||||
* Ioctl's have the command encoded in the lower word, and the size of | * 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 | * 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. | * 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_SHIFT 13 /* number of bits for ioctl size */ | ||||
#define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */ | #define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */ | ||||
#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) | #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) | ||||
#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) | #define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) | ||||
#define IOCGROUP(x) (((x) >> 8) & 0xff) | #define IOCGROUP(x) (((x) >> 8) & 0xff) | ||||
#define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */ | #define IOCPARM_MAX (1 << IOCPARM_SHIFT) /* max size of ioctl */ | ||||
#define IOC_VOID 0x20000000 /* no parameters */ | /* no parameters */ | ||||
#define IOC_OUT 0x40000000 /* copy out parameters */ | #define IOC_VOID (unsigned long)0x20000000 | ||||
kib: Why not write it as `0x20000000UL` ? More, I think that `0x20000000U` would be enough. | |||||
jhbUnsubmitted Done Inline ActionsThis would also avoid the need to move the comments around and make for a smaller diff in general. jhb: This would also avoid the need to move the comments around and make for a smaller diff in… | |||||
#define IOC_IN 0x80000000 /* copy in parameters */ | /* copy out parameters */ | ||||
#define IOC_OUT (unsigned long)0x40000000 | |||||
/* copy in parameters */ | |||||
#define IOC_IN (unsigned long)0x80000000 | |||||
/* copy parameters in and out */ | |||||
#define IOC_INOUT (IOC_IN|IOC_OUT) | #define IOC_INOUT (IOC_IN|IOC_OUT) | ||||
/* mask for IN/OUT/VOID */ | |||||
#define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN) | #define IOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN) | ||||
#define _IOC(inout,group,num,len) ((unsigned long) \ | #define _IOC(inout,group,num,len) ((unsigned long) \ | ||||
((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) | ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num))) | ||||
#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) | #define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) | ||||
#define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int)) | #define _IOWINT(g,n) _IOC(IOC_VOID, (g), (n), sizeof(int)) | ||||
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) | #define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) | ||||
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) | #define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) | ||||
Show All 25 Lines |
Why not write it as 0x20000000UL ? More, I think that 0x20000000U would be enough.