Source-Changes-HG archive

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

[src/pgoyette-compat]: src/sys Move if_spppsubr compat code into the compat50...



details:   https://anonhg.NetBSD.org/src/rev/160fe5404287
branches:  pgoyette-compat
changeset: 321077:160fe5404287
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Mar 21 10:12:48 2018 +0000

description:
Move if_spppsubr compat code into the compat50 module.

More prep work for compat80 module (for raidframe)

diffstat:

 sys/compat/common/Makefile.sysio  |    8 +-
 sys/compat/common/compat_80_mod.c |   24 +++--
 sys/compat/common/files.common    |    7 +-
 sys/compat/common/if_spppsubr50.c |  169 ++++++++++++++++++++++++++++++++++++++
 sys/compat/common/if_spppsubr50.h |   38 ++++++++
 sys/kern/compat_stub.c            |    6 +-
 sys/modules/compat_50/Makefile    |    4 +-
 sys/modules/compat_80/Makefile    |   13 ++
 sys/net/if_spppsubr.c             |   55 ++----------
 sys/sys/compat_stub.h             |    9 +-
 10 files changed, 271 insertions(+), 62 deletions(-)

diffs (truncated from 489 to 300 lines):

diff -r 5ef68075cc1f -r 160fe5404287 sys/compat/common/Makefile.sysio
--- a/sys/compat/common/Makefile.sysio  Wed Mar 21 10:01:04 2018 +0000
+++ b/sys/compat/common/Makefile.sysio  Wed Mar 21 10:12:48 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.sysio,v 1.7.18.6 2018/03/21 04:48:31 pgoyette Exp $
+#      $NetBSD: Makefile.sysio,v 1.7.18.7 2018/03/21 10:12:48 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -35,10 +35,14 @@
 
 # Compatibility code for NetBSD 5.0
 SRCS+= kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
-       vfs_syscalls_50.c  uipc_syscalls_50.c uvm_50.c clockctl_50.c
+       vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c clockctl_50.c \
+       if_spppsubr50.c
 
 # Compatibility code for NetBSD 6.0
 SRCS+= kern_sa_60.c tty_60.c kern_time_60.c kern_cpu_60.c ccd_60.c
 
 # Compatibility code for NetBSD 7.0
 SRCS+= rtsock_70.c uipc_usrreq_70.c
+
+# Compatability code for NetBSD 8.0
+SRCS+= raidframe80.c
diff -r 5ef68075cc1f -r 160fe5404287 sys/compat/common/compat_80_mod.c
--- a/sys/compat/common/compat_80_mod.c Wed Mar 21 10:01:04 2018 +0000
+++ b/sys/compat/common/compat_80_mod.c Wed Mar 21 10:12:48 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_80_mod.c,v 1.1.2.1 2018/03/21 10:01:04 pgoyette Exp $   */
+/*     $NetBSD: compat_80_mod.c,v 1.1.2.2 2018/03/21 10:12:48 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.1 2018/03/21 10:01:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.1.2.2 2018/03/21 10:12:48 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -54,20 +54,24 @@
 #include <compat/net/route.h>
 #include <compat/net/route_70.h>
 
-int compat_70_init(void)
+int compat_80_init(void)
 {
+       int error;
 
-       vec_ocreds_valid = true;
-       rtsock_70_init();
+       error = raidframe_80_init();
+       if (error != 0)
+               return error;
 
        return 0;
 }
 
-int compat_70_fini(void)
+int compat_80_fini(void)
 {
+       int error;
 
-       rtsock_70_fini();
-       vec_ocreds_valid = false;
+       error = raidframe_80_fini();
+       if (error != 0)
+               return error;
 
        return 0;
 }
@@ -83,10 +87,10 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-               return compat_70_init();
+               return compat_80_init();
 
        case MODULE_CMD_FINI:
-               return compat_70_fini();
+               return compat_80_fini();
 
        default:
                return ENOTTY;
diff -r 5ef68075cc1f -r 160fe5404287 sys/compat/common/files.common
--- a/sys/compat/common/files.common    Wed Mar 21 10:01:04 2018 +0000
+++ b/sys/compat/common/files.common    Wed Mar 21 10:12:48 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.common,v 1.1.2.15 2018/03/21 04:48:31 pgoyette Exp $
+#      $NetBSD: files.common,v 1.1.2.16 2018/03/21 10:12:48 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -65,6 +65,7 @@
 file   compat/common/vfs_syscalls_50.c         compat_50
 file   compat/common/uipc_syscalls_50.c        compat_50
 file   compat/common/clockctl_50.c             compat_50 & clockctl
+file   compat/common/if_spppsubr50.c           compat_50 & sppp
 file   compat/common/uvm_50.c                  compat_50
 
 # Compatibility code for NetBSD 6.0
@@ -80,6 +81,10 @@
 file   compat/common/rtsock_70.c               compat_70
 file   compat/common/uipc_usrreq_70.c          compat_70
 
+# Compatability code for NetBSD 8.0
+file   compat/common/compat_80_mod.c           compat_80
+file   compat/common/raidframe80.c             compat_80 & raid
+
 #
 # Sources for sysv ipc compatibility across the versions.
 #
diff -r 5ef68075cc1f -r 160fe5404287 sys/compat/common/if_spppsubr50.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/if_spppsubr50.c Wed Mar 21 10:12:48 2018 +0000
@@ -0,0 +1,169 @@
+/*     $NetBSD: if_spppsubr50.c,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $    */
+
+/*
+ * Synchronous PPP/Cisco link level subroutines.
+ * Keepalive protocol implemented in both Cisco and PPP modes.
+ *
+ * Copyright (C) 1994-1996 Cronyx Engineering Ltd.
+ * Author: Serge Vakulenko, <vak%cronyx.ru@localhost>
+ *
+ * Heavily revamped to conform to RFC 1661.
+ * Copyright (C) 1997, Joerg Wunsch.
+ *
+ * RFC2472 IPv6CP support.
+ * Copyright (C) 2000, Jun-ichiro itojun Hagino <itojun%iijlab.net@localhost>.
+ *
+ * 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 FREEBSD PROJECT ``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 FREEBSD PROJECT 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.
+ *
+ * From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
+ *
+ * From: if_spppsubr.c,v 1.39 1998/04/04 13:26:03 phk Exp
+ *
+ * From: Id: if_spppsubr.c,v 1.23 1999/02/23 14:47:50 hm Exp
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr50.c,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_inet.h"
+#include "opt_modular.h"
+#include "opt_compat_netbsd.h"
+#include "opt_net_mpsafe.h"
+#endif
+
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/callout.h>
+#include <sys/md5.h>
+#include <sys/inttypes.h>
+#include <sys/kauth.h>
+#include <sys/cprng.h>
+#include <sys/module.h>
+#include <sys/workqueue.h>
+#include <sys/atomic.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/netisr.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <net/ppp_defs.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#ifdef INET
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#endif
+#include <net/ethertypes.h>
+
+#ifdef INET6
+#include <netinet6/scope6_var.h>
+#endif
+
+#include <net/if_sppp.h>
+#include <net/if_spppvar.h>
+
+#include <compat/common/if_spppsubr50.h>
+
+#ifdef NET_MPSAFE
+#define SPPPSUBR_MPSAFE        1
+#endif
+
+#define SPPP_LOCK(_sp, _op)    rw_enter(&(_sp)->pp_lock, (_op))
+#define SPPP_UNLOCK(_sp)       rw_exit(&(_sp)->pp_lock)
+
+int sppp_compat50_params(struct sppp *, u_long, void *);
+
+int
+sppp_compat50_params(struct sppp *sp, u_long cmd, void *data)
+{
+       switch (cmd) {
+       case __SPPPGETIDLETO50:
+           {
+               struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+
+               SPPP_LOCK(sp, RW_READER);
+               to->idle_seconds = (uint32_t)sp->pp_idle_timeout;
+               SPPP_UNLOCK(sp);
+           }
+           break;
+       case __SPPPSETIDLETO50:
+           {
+               struct spppidletimeout50 *to = (struct spppidletimeout50 *)data;
+
+               SPPP_LOCK(sp, RW_WRITER);
+               sp->pp_idle_timeout = (time_t)to->idle_seconds;
+               SPPP_UNLOCK(sp);
+           }
+           break;
+       case __SPPPGETKEEPALIVE50:
+           {
+               struct spppkeepalivesettings50 *settings =
+                    (struct spppkeepalivesettings50*)data;
+
+               SPPP_LOCK(sp, RW_READER);
+               settings->maxalive = sp->pp_maxalive;
+               settings->max_noreceive = (uint32_t)sp->pp_max_noreceive;
+               SPPP_UNLOCK(sp);
+           }
+           break;
+       case __SPPPSETKEEPALIVE50:
+           {
+               struct spppkeepalivesettings50 *settings =
+                    (struct spppkeepalivesettings50*)data;
+
+               SPPP_LOCK(sp, RW_WRITER);
+               sp->pp_maxalive = settings->maxalive;
+               sp->pp_max_noreceive = (time_t)settings->max_noreceive;
+               SPPP_UNLOCK(sp);
+           }
+           break;
+       default:
+           return EINVAL;
+       }
+
+       return 0;
+}
+
+void
+if_spppsubr_50_init(void)
+{
+
+       sppp_params50 = sppp_compat50_params;
+}
+
+void
+if_spppsubr_50_fini(void)
+{
+
+       sppp_params50 = (void *)enosys;
+}
diff -r 5ef68075cc1f -r 160fe5404287 sys/compat/common/if_spppsubr50.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/if_spppsubr50.h Wed Mar 21 10:12:48 2018 +0000
@@ -0,0 +1,38 @@
+/* $NetBSD: if_spppsubr50.h,v 1.1.2.1 2018/03/21 10:12:48 pgoyette Exp $       */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Paul Goyette



Home | Main Index | Thread Index | Old Index