Source-Changes-HG archive

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

[src/trunk]: src/sys/compat provide vectors for the ifconf compat code and if...



details:   https://anonhg.NetBSD.org/src/rev/d4ec90fe275f
branches:  trunk
changeset: 321980:d4ec90fe275f
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 12 18:50:13 2018 +0000

description:
provide vectors for the ifconf compat code and ifdatareq compat code.

diffstat:

 sys/compat/common/compat_mod.c       |  13 +++++++++++--
 sys/compat/common/uipc_syscalls_40.c |  30 ++++++++++++++++++++++++------
 sys/compat/common/uipc_syscalls_50.c |  22 ++++++++++++++++------
 sys/compat/sys/sockio.h              |  21 ++++++++++++++++-----
 4 files changed, 67 insertions(+), 19 deletions(-)

diffs (218 lines):

diff -r fadfdce2bb8c -r d4ec90fe275f sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c    Thu Apr 12 18:45:57 2018 +0000
+++ b/sys/compat/common/compat_mod.c    Thu Apr 12 18:50:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_mod.c,v 1.27 2018/03/18 20:33:52 christos Exp $ */
+/*     $NetBSD: compat_mod.c,v 1.28 2018/04/12 18:50:13 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.27 2018/03/18 20:33:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.28 2018/04/12 18:50:13 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -63,6 +63,7 @@
 #include <compat/sys/uvm.h>
 #include <compat/sys/cpuio.h>
 #include <compat/sys/ccdvar.h>
+#include <compat/sys/sockio.h>
 
 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_50)
 static struct sysctllog *compat_clog = NULL;
@@ -257,7 +258,11 @@
 #endif
 #endif
                compat_sysctl_init();
+#ifdef COMPAT_40
+               uipc_syscalls_40_init();
+#endif
 #ifdef COMPAT_50
+               uipc_syscalls_50_init();
                uvm_50_init();
 #endif
 #ifdef COMPAT_60
@@ -324,7 +329,11 @@
 #endif
 #endif /* COMPAT_16 */
                compat_sysctl_fini();
+#ifdef COMPAT_40
+               uipc_syscalls_40_fini();
+#endif
 #ifdef COMPAT_50
+               uipc_syscalls_50_fini();
                uvm_50_fini();
 #endif
 #ifdef COMPAT_60
diff -r fadfdce2bb8c -r d4ec90fe275f sys/compat/common/uipc_syscalls_40.c
--- a/sys/compat/common/uipc_syscalls_40.c      Thu Apr 12 18:45:57 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_40.c      Thu Apr 12 18:50:13 2018 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $     */
+/*     $NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christos Exp $   */
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.16 2018/04/12 18:50:13 christos Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -21,7 +21,6 @@
 #include <compat/sys/socket.h>
 #include <compat/sys/sockio.h>
 
-#ifdef COMPAT_OIFREQ
 /*
  * Return interface configuration
  * of system.  List may be used
@@ -29,8 +28,8 @@
  * other information.
  */
 /*ARGSUSED*/
-int
-compat_ifconf(u_long cmd, void *data)
+static int
+compat_ifconf(struct lwp *l, u_long cmd, void *data)
 {
        struct oifconf *ifc = data;
        struct ifnet *ifp;
@@ -42,6 +41,14 @@
        int bound;
        struct psref psref;
 
+       switch (cmd) {
+       case OSIOCGIFCONF:
+       case OOSIOCGIFCONF:
+               break;
+       default:
+               return ENOSYS;
+       }
+
        if (docopy) {
                space = ifc->ifc_len;
                ifrp = ifc->ifc_req;
@@ -150,4 +157,15 @@
        curlwp_bindx(bound);
        return error;
 }
-#endif
+
+void
+uipc_syscalls_40_init(void)
+{
+       vec_compat_ifconf = compat_ifconf;
+}
+
+void
+uipc_syscalls_40_fini(void)
+{
+       vec_compat_ifconf = (void *)enosys;
+}
diff -r fadfdce2bb8c -r d4ec90fe275f sys/compat/common/uipc_syscalls_50.c
--- a/sys/compat/common/uipc_syscalls_50.c      Thu Apr 12 18:45:57 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_50.c      Thu Apr 12 18:50:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $     */
+/*     $NetBSD: uipc_syscalls_50.c,v 1.4 2018/04/12 18:50:13 christos Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.4 2018/04/12 18:50:13 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -55,9 +55,8 @@
 #include <compat/sys/socket.h>
 #include <compat/sys/sockio.h>
 
-#ifdef COMPAT_OIFDATA
 /*ARGSUSED*/
-int
+static int
 compat_ifdatareq(struct lwp *l, u_long cmd, void *data)
 {
        struct oifdatareq *ifdr = data;
@@ -92,7 +91,18 @@
                return 0;
 
        default:
-               return EINVAL;
+               return ENOSYS;
        }
 }
-#endif
+
+void
+uipc_syscalls_50_init(void)
+{
+       vec_compat_ifdatareq = compat_ifdatareq;
+}
+
+void
+uipc_syscalls_50_fini(void)
+{
+       vec_compat_ifdatareq = (void *)enosys;
+}
diff -r fadfdce2bb8c -r d4ec90fe275f sys/compat/sys/sockio.h
--- a/sys/compat/sys/sockio.h   Thu Apr 12 18:45:57 2018 +0000
+++ b/sys/compat/sys/sockio.h   Thu Apr 12 18:50:13 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sockio.h,v 1.10 2010/11/14 15:36:47 uebayasi Exp $     */
+/*     $NetBSD: sockio.h,v 1.11 2018/04/12 18:50:13 christos Exp $     */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993, 1994
@@ -56,8 +56,10 @@
 
 #endif /* _KERNEL_OPT */
 
+#define OIFNAMSIZ      16
+
 struct oifreq {
-       char    ifr_name[IFNAMSIZ];             /* if name, e.g. "en0" */
+       char    ifr_name[OIFNAMSIZ];            /* if name, e.g. "en0" */
        union {
                struct  sockaddr ifru_addr;
                struct  sockaddr ifru_dstaddr;
@@ -114,7 +116,7 @@
 };
 
 struct oifdatareq {
-       char    ifdr_name[IFNAMSIZ];            /* if name, e.g. "en0" */
+       char    ifdr_name[OIFNAMSIZ];           /* if name, e.g. "en0" */
        struct  oif_data ifdr_data;
 };
 
@@ -178,10 +180,19 @@
                (ni)->ifi_lastchange.tv_nsec = \
                    (oi)->ifi_lastchange.tv_usec * 1000; \
        } while (/*CONSTCOND*/0)
+
 #ifdef _KERNEL
+
 __BEGIN_DECLS
-int compat_ifconf(u_long, void *);
-int compat_ifdatareq(struct lwp *, u_long, void *);
+extern int (*vec_compat_ifconf)(struct lwp *, u_long, void *);
+extern int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *);
+
+void uipc_syscalls_40_init(void);
+void uipc_syscalls_40_fini(void);
+void uipc_syscalls_50_init(void);
+void uipc_syscalls_50_fini(void);
 __END_DECLS
+
 #endif
+
 #endif /* _COMPAT_SYS_SOCKIO_H_ */



Home | Main Index | Thread Index | Old Index