* 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 _IOCPARM_MASK 0x0FFF
+#define _IOCPARM_MASK_BIG 0x0FFFFF
+#define _IOC_VOID 0x20000000
+#define _IOCTYPE_MASK 0xFFFF
+#define _IOC_IN 0x40000000
+#define _IOC_OUT 0x80000000
+#define _IOC_INOUT (_IOC_IN | _IOC_OUT)
+
+/* Flag indicating ioctl format with only one type field, and more bits
+ * for the size field (using mask _IOCPARM_MASK_BIG).
+ */
+#define _IOC_BIG 0x10000000
#define _IO(x,y) ((x << 8) | y | _IOC_VOID)
#define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
#define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_INOUT)
+#define _IOW_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
+ | _IOC_IN | _IOC_BIG)
+#define _IOR_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
+ | _IOC_OUT | _IOC_BIG)
+#define _IORW_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
+ | _IOC_INOUT | _IOC_BIG)
+
/* 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)
+#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)
+
+/* Recognize and decode size of a 'big' ioctl call. */
+#define _MINIX_IOCTL_BIG(i) ((i) & _IOC_BIG)
+#define _MINIX_IOCTL_SIZE_BIG(i) (((i) >> 8) & _IOCPARM_MASK_BIG)
#else
/* No fancy encoding on a 16-bit machine. */
#define TIOCSWINSZ _IOW('T', 17, struct winsize)
#define TIOCGPGRP _IOW('T', 18, int)
#define TIOCSPGRP _IOW('T', 19, int)
-#define TIOCSFON _IOW('T', 20, u8_t [8192])
+#define TIOCSFON_OLD _IOW('T', 20, u8_t [8192])
+#define TIOCSFON _IOW_BIG(1, u8_t [8192])
/* Legacy <sgtty.h> */
#define TIOCGETP _IOR('t', 1, struct sgttyb)
#include <minix/com.h>
#include <minix/endpoint.h>
#include <minix/ioctl.h>
+#include <sys/ioc_tty.h>
#include "file.h"
#include "fproc.h"
#include "inode.h"
*op = DEV_IOCTL_S;
if(_MINIX_IOCTL_IOR(m_in.REQUEST)) access |= CPF_WRITE;
if(_MINIX_IOCTL_IOW(m_in.REQUEST)) access |= CPF_READ;
- size = _MINIX_IOCTL_SIZE(m_in.REQUEST);
+ if(_MINIX_IOCTL_BIG(m_in.REQUEST))
+ size = _MINIX_IOCTL_SIZE_BIG(m_in.REQUEST);
+ else
+ size = _MINIX_IOCTL_SIZE(m_in.REQUEST);
/* Do this even if no I/O happens with the ioctl, in
* order to disambiguate requests with DEV_IOCTL_S.