Source-Changes-HG archive

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

[src/trunk]: src/sys PR/55777: Ruslan Nikolaev: Move the unp_sysctl_create to...



details:   https://anonhg.NetBSD.org/src/rev/c024a53247cb
branches:  trunk
changeset: 942091:c024a53247cb
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 06 14:50:13 2020 +0000

description:
PR/55777: Ruslan Nikolaev: Move the unp_sysctl_create to uipc_usrreq.c to
facilitate splitting rump modules and does not require a dummy function.

diffstat:

 sys/kern/uipc_domain.c              |   5 ++---
 sys/kern/uipc_usrreq.c              |  26 ++++++++++++++++----------
 sys/rump/librump/rumpnet/net_stub.c |  12 ++----------
 sys/sys/un.h                        |   3 +--
 4 files changed, 21 insertions(+), 25 deletions(-)

diffs (170 lines):

diff -r 9c20bffd8ee7 -r c024a53247cb sys/kern/uipc_domain.c
--- a/sys/kern/uipc_domain.c    Fri Nov 06 12:23:10 2020 +0000
+++ b/sys/kern/uipc_domain.c    Fri Nov 06 14:50:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_domain.c,v 1.107 2020/10/17 09:45:20 mlelstv Exp $        */
+/*     $NetBSD: uipc_domain.c,v 1.108 2020/11/06 14:50:13 christos Exp $       */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.107 2020/10/17 09:45:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.108 2020/11/06 14:50:13 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -692,7 +692,6 @@
                       SYSCTL_DESCR("SOCK_DGRAM protocol control block list"),
                       sysctl_unpcblist, 0, NULL, 0,
                       CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
-       unp_sysctl_create(&domain_sysctllog);
 }
 
 void
diff -r 9c20bffd8ee7 -r c024a53247cb sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Fri Nov 06 12:23:10 2020 +0000
+++ b/sys/kern/uipc_usrreq.c    Fri Nov 06 14:50:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_usrreq.c,v 1.199 2020/08/26 22:54:30 christos Exp $       */
+/*     $NetBSD: uipc_usrreq.c,v 1.200 2020/11/06 14:50:13 christos Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009, 2020 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.199 2020/08/26 22:54:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.200 2020/11/06 14:50:13 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -196,6 +196,8 @@
 static lwp_t *unp_thread_lwp;
 static SLIST_HEAD(,file) unp_thread_discard;
 static int unp_defer;
+static struct sysctllog *usrreq_sysctllog;
+static void unp_sysctl_create(void);
 
 /* Compat interface */
 
@@ -219,6 +221,8 @@
 {
        int error;
 
+       unp_sysctl_create();
+
        uipc_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
        cv_init(&unp_thread_cv, "unpgc");
 
@@ -1988,40 +1992,42 @@
        mutex_exit(&filelist_lock);
 }
 
-void
-unp_sysctl_create(struct sysctllog **clog)
+static void
+unp_sysctl_create(void)
 {
-       sysctl_createv(clog, 0, NULL, NULL,
+
+       KASSERT(usrreq_sysctllog == NULL);
+       sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_LONG, "sendspace",
                       SYSCTL_DESCR("Default stream send space"),
                       NULL, 0, &unpst_sendspace, 0,
                       CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
-       sysctl_createv(clog, 0, NULL, NULL,
+       sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_LONG, "recvspace",
                       SYSCTL_DESCR("Default stream recv space"),
                       NULL, 0, &unpst_recvspace, 0,
                       CTL_NET, PF_LOCAL, SOCK_STREAM, CTL_CREATE, CTL_EOL);
-       sysctl_createv(clog, 0, NULL, NULL,
+       sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_LONG, "sendspace",
                       SYSCTL_DESCR("Default datagram send space"),
                       NULL, 0, &unpdg_sendspace, 0,
                       CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
-       sysctl_createv(clog, 0, NULL, NULL,
+       sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_LONG, "recvspace",
                       SYSCTL_DESCR("Default datagram recv space"),
                       NULL, 0, &unpdg_recvspace, 0,
                       CTL_NET, PF_LOCAL, SOCK_DGRAM, CTL_CREATE, CTL_EOL);
-       sysctl_createv(clog, 0, NULL, NULL,
+       sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READONLY,
                       CTLTYPE_INT, "inflight",
                       SYSCTL_DESCR("File descriptors in flight"),
                       NULL, 0, &unp_rights, 0,
                       CTL_NET, PF_LOCAL, CTL_CREATE, CTL_EOL);
-       sysctl_createv(clog, 0, NULL, NULL,
+       sysctl_createv(&usrreq_sysctllog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READONLY,
                       CTLTYPE_INT, "deferred",
                       SYSCTL_DESCR("File descriptors deferred for close"),
diff -r 9c20bffd8ee7 -r c024a53247cb sys/rump/librump/rumpnet/net_stub.c
--- a/sys/rump/librump/rumpnet/net_stub.c       Fri Nov 06 12:23:10 2020 +0000
+++ b/sys/rump/librump/rumpnet/net_stub.c       Fri Nov 06 14:50:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: net_stub.c,v 1.40 2020/09/27 00:34:44 roy Exp $        */
+/*     $NetBSD: net_stub.c,v 1.41 2020/11/06 14:50:13 christos Exp $   */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.40 2020/09/27 00:34:44 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.41 2020/11/06 14:50:13 christos Exp $");
 
 #include <sys/mutex.h>
 #include <sys/param.h>
@@ -34,8 +34,6 @@
 #include <sys/socketvar.h>
 #include <sys/pslist.h>
 #include <sys/psref.h>
-#include <sys/sysctl.h>
-#include <sys/un.h>
 
 #include <net/if.h>
 #include <net/route.h>
@@ -88,12 +86,6 @@
 percpu_t *ipsecstat_percpu;
 u_int ipsec_spdgen;
 
-/* sysctl */
-void
-unp_sysctl_create(struct sysctllog **clog)
-{
-}
-
 __weak_alias(ah4_ctlinput,rumpnet_stub);
 __weak_alias(ah6_ctlinput,rumpnet_stub);
 __weak_alias(esp4_ctlinput,rumpnet_stub);
diff -r 9c20bffd8ee7 -r c024a53247cb sys/sys/un.h
--- a/sys/sys/un.h      Fri Nov 06 12:23:10 2020 +0000
+++ b/sys/sys/un.h      Fri Nov 06 14:50:13 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: un.h,v 1.58 2018/05/05 19:58:08 christos Exp $ */
+/*     $NetBSD: un.h,v 1.59 2020/11/06 14:50:13 christos Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -90,7 +90,6 @@
 int    unp_connect2(struct socket *, struct socket *);
 void   unp_dispose(struct mbuf *);
 int    unp_externalize(struct mbuf *, struct lwp *, int);
-void   unp_sysctl_create(struct sysctllog **);
 
 #else /* !_KERNEL */
 



Home | Main Index | Thread Index | Old Index