Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pgoyette-compat]: src/sys Yay - we got the ccd_ioctl_60 stuff to build!



details:   https://anonhg.NetBSD.org/src/rev/503726c48547
branches:  pgoyette-compat
changeset: 830716:503726c48547
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Sep 16 04:57:22 2018 +0000

description:
Yay - we got the ccd_ioctl_60 stuff to build!

Now we can use that as a template for cleaning up all the others.

diffstat:

 sys/compat/common/ccd_60.c |  11 +++++++----
 sys/dev/ccd.c              |  19 +++++++++++++++----
 sys/kern/compat_stub.c     |   6 +++---
 3 files changed, 25 insertions(+), 11 deletions(-)

diffs (114 lines):

diff -r 83d8e8cfb7fd -r 503726c48547 sys/compat/common/ccd_60.c
--- a/sys/compat/common/ccd_60.c        Sun Sep 16 04:56:26 2018 +0000
+++ b/sys/compat/common/ccd_60.c        Sun Sep 16 04:57:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd_60.c,v 1.1.2.6 2018/03/20 08:11:25 pgoyette Exp $  */
+/*     $NetBSD: ccd_60.c,v 1.1.2.7 2018/09/16 04:57:22 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.1.2.6 2018/03/20 08:11:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd_60.c,v 1.1.2.7 2018/09/16 04:57:22 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -91,16 +91,19 @@
        }
 }
 
+COMPAT_SET_HOOK(ccd_ioctl_60_hook, "ccd_60", compat_60_ccdioctl);
+COMPAT_UNSET_HOOK(ccd_ioctl_60_hook);
+
 void
 ccd_60_init(void)
 {
 
-       compat_ccd_ioctl_60 = compat_60_ccdioctl;
+       ccd_ioctl_60_hook_set();
 }
 
 void
 ccd_60_fini(void)
 {
 
-       compat_ccd_ioctl_60 = (void *)enosys;
+       ccd_ioctl_60_hook_unset();
 }
diff -r 83d8e8cfb7fd -r 503726c48547 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Sun Sep 16 04:56:26 2018 +0000
+++ b/sys/dev/ccd.c     Sun Sep 16 04:57:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.175.2.4 2018/03/23 09:22:24 pgoyette Exp $   */
+/*     $NetBSD: ccd.c,v 1.175.2.5 2018/09/16 04:57:22 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.175.2.4 2018/03/23 09:22:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.175.2.5 2018/09/16 04:57:22 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1056,6 +1056,16 @@
        return (physio(ccdstrategy, NULL, dev, B_READ, minphys, uio));
 }
 
+/* Hook the compat_60 ioctl code
+ *
+ * This looks ugly, since we pass the "real" ioctl function as an
+ * argument to the compat_xxx function.
+ */
+COMPAT_CALL_HOOK(ccd_ioctl_60_hook, f, (dev_t dev, u_long cmd, void *data,
+    int flag, struct lwp *l, int (*ff)(dev_t, u_long, void *, int,
+                                        struct lwp *)),
+    (dev, cmd, data, flag, l, ccdioctl), enosys());
+
 /* ARGSUSED */
 static int
 ccdwrite(dev_t dev, struct uio *uio, int flags)
@@ -1098,7 +1108,8 @@
                make = 1;
                break;
        default:
-               if ((*compat_ccd_ioctl_60)(0, cmd, NULL, 0, NULL, NULL) == 0)
+               if (ccd_ioctl_60_hook_f_call(0, cmd, NULL, 0, NULL, NULL)
+                   == 0)
                        make = 1;
                else
                        make = 0;
@@ -1109,7 +1120,7 @@
                return ENOENT;
        uc = kauth_cred_get();
 
-       error = (*compat_ccd_ioctl_60)(dev, cmd, data, flag, l, ccdioctl);
+       error = ccd_ioctl_60_hook_f_call(dev, cmd, data, flag, l, ccdioctl);
        if (error != ENOSYS)
                return error;
 
diff -r 83d8e8cfb7fd -r 503726c48547 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c    Sun Sep 16 04:56:26 2018 +0000
+++ b/sys/kern/compat_stub.c    Sun Sep 16 04:57:22 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.16 2018/09/15 05:56:50 pgoyette Exp $        */
+/* $NetBSD: compat_stub.c,v 1.1.2.17 2018/09/16 04:57:22 pgoyette Exp $        */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -64,8 +64,8 @@
 /*
  * ccd device compatability ioctl
  */
-int (*compat_ccd_ioctl_60)(dev_t, u_long, void *, int, struct lwp *,
-    int (*f)(dev_t, u_long, void *, int, struct lwp *)) = (void *)enosys;
+
+struct ccd_ioctl_60_hook_t ccd_ioctl_60_hook;
 
 /*
  * clockctl device compatability ioctl



Home | Main Index | Thread Index | Old Index