Dear folks,
picking up an old thread on the added FKIOCTL flag :
On Thu, Feb 17, 2005 at 12:26:36AM +0100, Reinoud Zandijk wrote:
I've defined COPYIN and COPYOUT macros wich allways DTRT for ioctls in the
following proposed patch :
------------------
diff -u -r1.179 systm.h
--- sys/systm.h 23 Jun 2005 00:30:28 -0000 1.179
+++ sys/systm.h 25 Aug 2005 16:22:28 -0000
@@ -240,6 +240,21 @@
int copyin(const void *, void *, size_t);
int copyout(const void *, void *, size_t);
+#ifdef _KERNEL
+#define COPYIN(ioctlflags, uaddr, kaddr, len)\
+ if ((ioctlflags) & FKIOCTL) {\
+ memcpy((kaddr), (uaddr), (len));\
+ } else {\
+ copyin((uaddr), (kaddr), (len));\
+ };
+#define COPYOUT(ioctlflags, kaddr, uaddr, len)\
+ if ((ioctlflags) & FKIOCTL) {\
+ memcpy((uaddr), (kaddr), (len));\
+ } else {\
+ copyout((kaddr), (uaddr), (len));\
+ };
+#endif /* KERNEL */
+
int copyin_proc(struct proc *, const void *, void *, size_t);
int copyout_proc(struct proc *, const void *, void *, size_t);
----------------------
*BUT* a grep in src/sys pointed to the following problems:
arch/pc532/fpu/ieee_handler.c
dist/pf/net/pf_table.c
dist/ipf/netinet/ip_compat.h
all define their own COPYIN() and COPYOUT() macro's.... now what to do?
a) don't use COPYIN/COPYOUT but use IOCTL_COPYIN and IOCTL_COPYOUT ?
b) patch somehow pc532/pf/ipf to not use such generic names?
c) ...
(a) would do justice to the fact that they are only usable for IOCTL flags
(b) might cause problems with importing newer pf/ipf or are those imports
mainly scripted?
(c) other suggestions?
Reinoud