
and DEV_IOCTL_S as replacements for DEV_READ, DEV_WRITE, DEV_SCATTER, DEV_GATHER and DEV_IOCTL. Instead of a direct address, the *_S commands pass 'grant ids' to the drivers which are referenced through a new set of copy calls (sys_safecopyfrom and sys_safecopyto). in order for this copy to succeed, the grant must have previously been created in the address space of the granter. . bitmap manipulation functions moved to <minix/bitmap.h> . HIGHPOS introduced as field containing high 32 bits of position in device I/O message; TTY_FLAGS no longer used . IO_GRANT field introduced for GRANTs, to replace ADDRESS . REP_IO_GRANT field for un-SUSPEND messages introduced to indicate grant for which I/O was done to disambiguate messages . SYS_SAFECOPYFROM and SYS_SAFECOPYTO introduced as new calls . SYS_PRIV_SET_GRANTS code introduced as a code to set the address and size of the grant table in a process' own address space . 'type' and 'direction' field of _ins* and _outs* I/O functions are merged into one by ORing _DIO_INPUT/_DIO_OUTPUT and _DIO_BYTE/_DIO_WORD etc. This allows for an additional parameter, _DIO_SAFE, which indicates the address in another address space isn't actually an address, but a grant id. Also needs an offset, for which fields had to be merged. . SCP_* are field names for SYS_SAFECOPY* functions . DIAGNOSTICS and GET_KMESS moved to their own range above DIAG_BASE, added DIAGNOSTICS_S which is a grant-based variant of DIAGNOSTICS . removed obsolete BINCOMPAT and SRCCOMPAT options . added GRANT_SEG type for use in vircopy - allows copying to a grant id (without offset) . added _MINIX_IOCTL_* macros that decode information encoded by _IO* macros in ioctl codes, used to check which grants are necessary for an ioctl . introduced the type endpoint_t for process endpoints, changed some prototypes and struct field types to match . renamed protected to prot for g++
52 lines
1.4 KiB
C
Executable File
52 lines
1.4 KiB
C
Executable File
/* minix/ioctl.h - Ioctl helper definitions. Author: Kees J. Bot
|
|
* 23 Nov 2002
|
|
*
|
|
* This file is included by every header file that defines ioctl codes.
|
|
*/
|
|
|
|
#ifndef _M_IOCTL_H
|
|
#define _M_IOCTL_H
|
|
|
|
#ifndef _TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
|
|
#if _EM_WSIZE >= 4
|
|
/* Ioctls have the command encoded in the low-order word, and the size
|
|
* of the parameter in the high-order word. The 3 high bits of the high-
|
|
* order word are used to encode the in/out/void status of the parameter.
|
|
*/
|
|
#define _IOCPARM_MASK 0x1FFF
|
|
#define _IOC_VOID 0x20000000
|
|
#define _IOCTYPE_MASK 0xFFFF
|
|
#define _IOC_IN 0x40000000
|
|
#define _IOC_OUT 0x80000000
|
|
#define _IOC_INOUT (_IOC_IN | _IOC_OUT)
|
|
|
|
#define _IO(x,y) ((x << 8) | y | _IOC_VOID)
|
|
#define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
|
|
_IOC_OUT)
|
|
#define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
|
|
_IOC_IN)
|
|
#define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
|
|
_IOC_INOUT)
|
|
|
|
/* Decode an ioctl call. */
|
|
#define _MINIX_IOCTL_SIZE(i) (((i) >> 16) & _IOCPARM_MASK)
|
|
#define _MINIX_IOCTL_IOR(i) ((i) & _IOC_OUT)
|
|
#define _MINIX_IOCTL_IORW(i) ((i) & _IOC_INOUT)
|
|
#define _MINIX_IOCTL_IOW(i) ((i) & _IOC_IN)
|
|
|
|
#else
|
|
/* No fancy encoding on a 16-bit machine. */
|
|
|
|
#define _IO(x,y) ((x << 8) | y)
|
|
#define _IOR(x,y,t) _IO(x,y)
|
|
#define _IOW(x,y,t) _IO(x,y)
|
|
#define _IORW(x,y,t) _IO(x,y)
|
|
#endif
|
|
|
|
int ioctl(int _fd, int _request, void *_data);
|
|
|
|
#endif /* _M_IOCTL_H */
|