Source-Changes-HG archive

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

[src/trunk]: src/sys steal an idea from uwe@ and implement gcc-8 function typ...



details:   https://anonhg.NetBSD.org/src/rev/2be3e7ff6fdd
branches:  trunk
changeset: 455116:2be3e7ff6fdd
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Oct 08 07:33:14 2019 +0000

description:
steal an idea from uwe@ and implement gcc-8 function type cast
friendly methods for sys/conf.h that needs it.

one alias per return type and first function are are needed,
though they can be stubbed to existing code.  the only cost is
the symbol itself, the codegen it the same.

diffstat:

 sys/kern/kern_stub.c |  14 ++++++++++++--
 sys/sys/conf.h       |  45 ++++++++++++++++++++++++++-------------------
 2 files changed, 38 insertions(+), 21 deletions(-)

diffs (100 lines):

diff -r e4e225867bc2 -r 2be3e7ff6fdd sys/kern/kern_stub.c
--- a/sys/kern/kern_stub.c      Tue Oct 08 07:30:58 2019 +0000
+++ b/sys/kern/kern_stub.c      Tue Oct 08 07:33:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $  */
+/*     $NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $       */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ktrace.h"
@@ -185,6 +185,16 @@
 __strong_alias(sa_stacks1,sys_nosys);
 
 /*
+ * Stubs for drivers.  See sys/conf.h.
+ */
+__strong_alias(devenodev,enodev);
+__strong_alias(deveopnotsupp,eopnotsupp);
+__strong_alias(devnullop,nullop);
+__strong_alias(ttyenodev,enodev);
+__strong_alias(ttyvenodev,voidop);
+__strong_alias(ttyvnullop,nullop);
+
+/*
  * Stubs for architectures that do not support kernel preemption.
  */
 #ifndef __HAVE_PREEMPTION
diff -r e4e225867bc2 -r 2be3e7ff6fdd sys/sys/conf.h
--- a/sys/sys/conf.h    Tue Oct 08 07:30:58 2019 +0000
+++ b/sys/sys/conf.h    Tue Oct 08 07:33:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.h,v 1.152 2019/10/08 07:16:25 mrg Exp $   */
+/*     $NetBSD: conf.h,v 1.153 2019/10/08 07:33:14 mrg Exp $   */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -126,30 +126,37 @@
 #define        dev_type_kqfilter(n)    int n (dev_t, struct knote *)
 #define dev_type_discard(n)    int n (dev_t, off_t, off_t)
 
-#define        noopen          ((dev_type_open((*)))enodev)
-#define        noclose         ((dev_type_close((*)))enodev)
-#define        noread          ((dev_type_read((*)))enodev)
-#define        nowrite         ((dev_type_write((*)))enodev)
-#define        noioctl         ((dev_type_ioctl((*)))enodev)
-#define        nostop          ((dev_type_stop((*)))enodev)
+int devenodev(dev_t, ...);
+int deveopnotsupp(dev_t, ...);
+int devnullop(dev_t, ...);
+int ttyenodev(struct tty *, ...);
+void ttyvenodev(struct tty *, ...);
+void ttyvnullop(struct tty *, ...);
+
+#define        noopen          ((dev_type_open((*)))devenodev)
+#define        noclose         ((dev_type_close((*)))devenodev)
+#define        noread          ((dev_type_read((*)))devenodev)
+#define        nowrite         ((dev_type_write((*)))devenodev)
+#define        noioctl         ((dev_type_ioctl((*)))devenodev)
+#define        nostop          ((dev_type_stop((*)))ttyvenodev)
 #define        notty           NULL
 #define        nopoll          seltrue
 paddr_t        nommap(dev_t, off_t, int);
-#define        nodump          ((dev_type_dump((*)))enodev)
+#define        nodump          ((dev_type_dump((*)))devenodev)
 #define        nosize          NULL
 #define        nokqfilter      seltrue_kqfilter
-#define nodiscard      ((dev_type_discard((*)))enodev)
+#define        nodiscard       ((dev_type_discard((*)))devenodev)
 
-#define        nullopen        ((dev_type_open((*)))nullop)
-#define        nullclose       ((dev_type_close((*)))nullop)
-#define        nullread        ((dev_type_read((*)))nullop)
-#define        nullwrite       ((dev_type_write((*)))nullop)
-#define        nullioctl       ((dev_type_ioctl((*)))nullop)
-#define        nullstop        ((dev_type_stop((*)))nullop)
-#define        nullpoll        ((dev_type_poll((*)))nullop)
-#define        nulldump        ((dev_type_dump((*)))nullop)
-#define        nullkqfilter    ((dev_type_kqfilter((*)))eopnotsupp)
-#define nulldiscard    ((dev_type_discard((*)))nullop)
+#define        nullopen        ((dev_type_open((*)))devnullop)
+#define        nullclose       ((dev_type_close((*)))devnullop)
+#define        nullread        ((dev_type_read((*)))devnullop)
+#define        nullwrite       ((dev_type_write((*)))devnullop)
+#define        nullioctl       ((dev_type_ioctl((*)))devnullop)
+#define        nullstop        ((dev_type_stop((*)))ttyvnullop)
+#define        nullpoll        ((dev_type_poll((*)))devnullop)
+#define        nulldump        ((dev_type_dump((*)))devnullop)
+#define        nullkqfilter    ((dev_type_kqfilter((*)))deveopnotsupp)
+#define        nulldiscard     ((dev_type_discard((*)))devnullop)
 
 /* device access wrappers. */
 



Home | Main Index | Thread Index | Old Index