Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Convert a couple more hooks to the MP-safe mec...



details:   https://anonhg.NetBSD.org/src/rev/6722467ee39c
branches:  pgoyette-compat
changeset: 445136:6722467ee39c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Oct 15 04:33:34 2018 +0000

description:
Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.

diffstat:

 sys/compat/common/compat_40_mod.c    |   6 +---
 sys/compat/common/if_40.h            |  46 -----------------------------------
 sys/compat/common/if_43.c            |   5 +--
 sys/compat/common/if_43.h            |  41 -------------------------------
 sys/compat/common/rtsock_70.c        |  47 +++++++++++++++++++----------------
 sys/compat/common/uipc_syscalls_40.c |   6 +---
 sys/compat/common/uipc_syscalls_50.c |   3 +-
 sys/compat/net/route.h               |   4 +-
 sys/compat/net/route_70.h            |   6 +---
 sys/compat/sys/if.h                  |  46 -----------------------------------
 sys/kern/compat_stub.c               |   7 ++++-
 sys/net/rtsock.c                     |  39 ++++++++++++++++++-----------
 sys/sys/compat_stub.h                |  10 ++++++-
 sys/sys/rnd.h                        |   5 +---
 14 files changed, 76 insertions(+), 195 deletions(-)

diffs (truncated from 530 to 300 lines):

diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/compat_40_mod.c
--- a/sys/compat/common/compat_40_mod.c Fri Oct 12 22:30:54 2018 +0000
+++ b/sys/compat/common/compat_40_mod.c Mon Oct 15 04:33:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_40_mod.c,v 1.1.2.6 2018/09/22 04:56:28 pgoyette Exp $   */
+/*     $NetBSD: compat_40_mod.c,v 1.1.2.7 2018/10/15 04:33:34 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_40_mod.c,v 1.1.2.6 2018/09/22 04:56:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_40_mod.c,v 1.1.2.7 2018/10/15 04:33:34 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -50,8 +50,6 @@
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
 
-#include <compat/common/if_40.h>
-
 int
 compat_40_init(void)
 {
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/if_40.h
--- a/sys/compat/common/if_40.h Fri Oct 12 22:30:54 2018 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*     $NetBSD: if_40.h,v 1.1.2.3 2018/04/16 03:41:34 pgoyette Exp $   */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Paul Goyette
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef        _COMPAT_IF_40_H_
-#define        _COMPAT_IF_40_H_
-
-#if defined(COMPAT_40)
-
-#include <net/if.h>
-#include <compat/sys/sockio.h>
-
-extern u_long (*vec_compat_cvtcmd)(u_long); 
-extern int (*vec_compat_ifioctl)(struct socket *, u_long, u_long, 
-    void *, struct lwp *);
-
-#endif
-
-#endif /* !_COMPAT_IF_40_H_ */
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Fri Oct 12 22:30:54 2018 +0000
+++ b/sys/compat/common/if_43.c Mon Oct 15 04:33:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_43.c,v 1.14.2.9 2018/10/03 21:52:02 pgoyette Exp $  */
+/*     $NetBSD: if_43.c,v 1.14.2.10 2018/10/15 04:33:34 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.9 2018/10/03 21:52:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14.2.10 2018/10/15 04:33:34 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -74,7 +74,6 @@
 
 #include <compat/common/compat_util.h>
 #include <compat/common/compat_mod.h>
-#include <compat/common/if_43.h>
 #include <uvm/uvm_extern.h>
 
 #if defined(COMPAT_43)
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/if_43.h
--- a/sys/compat/common/if_43.h Fri Oct 12 22:30:54 2018 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*     $NetBSD: if_43.h,v 1.1.20.2 2018/10/03 21:52:02 pgoyette Exp $  */
-
-/*-
- * Copyright (c) 2016 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Paul Goyette
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef        _COMPAT_IF_43_H_
-#define        _COMPAT_IF_43_H_
-
-#if defined(COMPAT_43)
-extern u_long (*vec_compat_cvtcmd)(u_long); 
-extern int (*vec_compat_ifioctl)(struct socket *, u_long, u_long, 
-    void *, struct lwp *);
-#endif
-
-#endif /* !_COMPAT_IF_43_H_ */
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/rtsock_70.c
--- a/sys/compat/common/rtsock_70.c     Fri Oct 12 22:30:54 2018 +0000
+++ b/sys/compat/common/rtsock_70.c     Mon Oct 15 04:33:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_70.c,v 1.2.2.1 2018/03/15 05:10:05 pgoyette Exp $       */
+/*     $NetBSD: rtsock_70.c,v 1.2.2.2 2018/10/15 04:33:34 pgoyette Exp $       */
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,13 +30,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.2.2.1 2018/03/15 05:10:05 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.2.2.2 2018/10/15 04:33:34 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
 #endif
 
 #include <sys/mbuf.h>
+#include <sys/compat_stub.h>
+
 #include <net/if.h>
 #include <net/route.h>
 
@@ -44,24 +46,7 @@
 #include <compat/net/route.h>
 #include <compat/net/route_70.h>
 
-static void (*orig_70_rt_newaddrmsg1)(int, struct ifaddr *);
-
-void
-rtsock_70_init(void)
-{
-
-       orig_70_rt_newaddrmsg1 = vec_70_rt_newaddrmsg1;
-       vec_70_rt_newaddrmsg1 = compat_70_rt_newaddrmsg1;
-}
-
-void
-rtsock_70_fini(void)
-{
-
-       vec_70_rt_newaddrmsg1 = orig_70_rt_newaddrmsg1;
-}
-
-void
+int
 compat_70_rt_newaddrmsg1(int cmd, struct ifaddr *ifa)
 {
        struct rt_addrinfo info;
@@ -102,10 +87,12 @@
 
        m = rt_msg1(ncmd, &info, &ifam, sizeof(ifam));
        if (m == NULL)
-               return;
+               return 0;
 
        mtod(m, struct ifa_msghdr70 *)->ifam_addrs = info.rti_addrs;
        route_enqueue(m, sa ? sa->sa_family : 0);
+
+       return 0;
 }
 
 int
@@ -129,3 +116,21 @@
        }
        return error;
 }
+
+MODULE_SET_HOOK2(rtsock_70_hook, "rts_70", compat_70_rt_newaddrmsg1,
+    compat_70_iflist_addr);
+MODULE_UNSET_HOOK2(rtsock_70_hook);
+
+void
+rtsock_70_init(void)
+{
+
+       rtsock_70_hook_set();
+}
+
+void
+rtsock_70_fini(void)
+{
+
+       rtsock_70_hook_unset();
+}
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/uipc_syscalls_40.c
--- a/sys/compat/common/uipc_syscalls_40.c      Fri Oct 12 22:30:54 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_40.c      Mon Oct 15 04:33:34 2018 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: uipc_syscalls_40.c,v 1.15.2.11 2018/09/22 04:56:28 pgoyette Exp $      */
+/*     $NetBSD: uipc_syscalls_40.c,v 1.15.2.12 2018/10/15 04:33:34 pgoyette Exp $      */
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15.2.11 2018/09/22 04:56:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15.2.12 2018/10/15 04:33:34 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -23,11 +23,9 @@
 
 #include <net/if.h>
 
-#include <compat/sys/if.h>
 #include <compat/sys/socket.h>
 #include <compat/sys/sockio.h>
 
-#include <compat/common/if_40.h>
 #include <compat/common/compat_mod.h>
 
 /*
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/common/uipc_syscalls_50.c
--- a/sys/compat/common/uipc_syscalls_50.c      Fri Oct 12 22:30:54 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_50.c      Mon Oct 15 04:33:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls_50.c,v 1.3.56.11 2018/09/30 01:45:49 pgoyette Exp $      */
+/*     $NetBSD: uipc_syscalls_50.c,v 1.3.56.12 2018/10/15 04:33:34 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,6 @@
 #include <compat/sys/time.h>
 #include <compat/sys/socket.h>
 #include <compat/sys/sockio.h>
-#include <compat/sys/if.h>
 
 #include <compat/common/compat_mod.h>
 
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/net/route.h
--- a/sys/compat/net/route.h    Fri Oct 12 22:30:54 2018 +0000
+++ b/sys/compat/net/route.h    Mon Oct 15 04:33:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.2 2016/09/21 10:50:23 roy Exp $    */
+/*     $NetBSD: route.h,v 1.2.14.1 2018/10/15 04:33:34 pgoyette Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -88,7 +88,7 @@
 struct mbuf *
        compat_50_rt_msg1(int, struct rt_addrinfo *, void *, int);
 void   compat_50_rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
-void   compat_70_rt_newaddrmsg1(int, struct ifaddr *);
+int    compat_70_rt_newaddrmsg1(int, struct ifaddr *);
 #endif
 
 #define RTM_OVERSION   3       /* Up the ante and ignore older versions */
diff -r b0f5d707f718 -r 6722467ee39c sys/compat/net/route_70.h
--- a/sys/compat/net/route_70.h Fri Oct 12 22:30:54 2018 +0000



Home | Main Index | Thread Index | Old Index