Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Create and build the compat_20 module
details: https://anonhg.NetBSD.org/src/rev/49ed4c3b253f
branches: pgoyette-compat
changeset: 321123:49ed4c3b253f
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Fri Mar 30 02:28:49 2018 +0000
description:
Create and build the compat_20 module
diffstat:
sys/compat/common/compat_20_mod.c | 100 +++++++++++++++++++++++++++++++++
sys/compat/common/compat_mod.c | 12 +---
sys/compat/common/compat_mod.h | 13 ++++-
sys/compat/common/files.common | 6 +-
sys/compat/common/ieee80211_20.c | 108 ++++++++++++++++++++++++++++++++++++
sys/compat/common/if43_20.c | 91 ++++++++++++++++++++++++++++++
sys/compat/common/if_43.c | 14 ++--
sys/compat/common/vfs_syscalls_20.c | 30 +++++++++-
sys/kern/compat_stub.c | 10 +++-
sys/modules/Makefile | 4 +-
sys/net80211/ieee80211_ioctl.c | 43 ++++----------
sys/net80211/ieee80211_ioctl.h | 6 +-
sys/sys/compat_stub.h | 13 ++++-
13 files changed, 388 insertions(+), 62 deletions(-)
diffs (truncated from 706 to 300 lines):
diff -r 573de9eaacfc -r 49ed4c3b253f sys/compat/common/compat_20_mod.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/compat_20_mod.c Fri Mar 30 02:28:49 2018 +0000
@@ -0,0 +1,100 @@
+/* $NetBSD: compat_20_mod.c,v 1.1.2.1 2018/03/30 02:28:49 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for 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.
+ */
+
+/*
+ * Linkage for the compat module: spaghetti.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: compat_20_mod.c,v 1.1.2.1 2018/03/30 02:28:49 pgoyette Exp $");
+
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/sysctl.h>
+#include <sys/syscall.h>
+#include <sys/syscallvar.h>
+#include <sys/syscallargs.h>
+
+#include <compat/common/compat_util.h>
+#include <compat/common/compat_mod.h>
+
+int
+compat_20_init(void)
+{
+ int error = 0;
+
+ error = vfs_syscalls_20_init();
+ if (error != 0)
+ return error;
+
+ if43_20_init();
+ ieee80211_20_init();
+
+ return error;
+}
+
+int
+compat_20_fini(void)
+{
+ int error = 0;
+
+ ieee80211_20_fini();
+ if43_20_fini();
+
+ error = vfs_syscalls_20_fini();
+ if (error != 0) {
+ if43_20_init();
+ ieee80211_20_init();
+ }
+
+ return error;
+}
+
+#ifdef _MODULE
+
+#define REQD_20 "compat_80,compat_70,compat_60,compat_50,compat_40,compat_30"
+
+MODULE(MODULE_CLASS_EXEC, compat_20, REQD_20);
+
+static int
+compat_20_modcmd(modcmd_t cmd, void *arg)
+{
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ return compat_20_init();
+ case MODULE_CMD_FINI:
+ return compat_20_init();
+ default:
+ return ENOTTY;
+ }
+}
+#endif
diff -r 573de9eaacfc -r 49ed4c3b253f sys/compat/common/compat_mod.c
--- a/sys/compat/common/compat_mod.c Fri Mar 30 02:28:25 2018 +0000
+++ b/sys/compat/common/compat_mod.c Fri Mar 30 02:28:49 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.c,v 1.24.14.23 2018/03/29 11:20:02 pgoyette Exp $ */
+/* $NetBSD: compat_mod.c,v 1.24.14.24 2018/03/30 02:28:49 pgoyette 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.24.14.23 2018/03/29 11:20:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.24 2018/03/30 02:28:49 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -167,12 +167,6 @@
#endif
#endif
-#if defined(COMPAT_20)
- { SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs },
- { SYS_compat_20_fstatfs, 0, (sy_call_t *)compat_20_sys_fstatfs },
- { SYS_compat_20_getfsstat, 0, (sy_call_t *)compat_20_sys_getfsstat },
- { SYS_compat_20_statfs, 0, (sy_call_t *)compat_20_sys_statfs },
-#endif
{ 0, 0, NULL },
};
@@ -195,10 +189,10 @@
#ifdef COMPAT_30
{ compat_30_init, compat_30_fini },
#endif
-#if 0 /* NOT YET */
#ifdef COMPAT_20
{ compat_20_init, compat_20_fini },
#endif
+#if 0 /* NOT YET */
#ifdef COMPAT_16
{ compat_16_init, compat_16_fini },
#endif
diff -r 573de9eaacfc -r 49ed4c3b253f sys/compat/common/compat_mod.h
--- a/sys/compat/common/compat_mod.h Fri Mar 30 02:28:25 2018 +0000
+++ b/sys/compat/common/compat_mod.h Fri Mar 30 02:28:49 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_mod.h,v 1.1.42.12 2018/03/29 11:20:02 pgoyette Exp $ */
+/* $NetBSD: compat_mod.h,v 1.1.42.13 2018/03/30 02:28:49 pgoyette Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -105,4 +105,15 @@
void usb_30_fini(void);
#endif
+#ifdef COMPAT_20
+int compat_20_init(void);
+int compat_20_fini(void);
+int vfs_syscalls_20_init(void);
+int vfs_syscalls_20_fini(void);
+void ieee80211_20_init(void);
+void ieee80211_20_fini(void);
+void if43_20_init(void);
+void if43_20_fini(void);
+#endif
+
#endif /* !_COMPAT_MOD_H_ */
diff -r 573de9eaacfc -r 49ed4c3b253f sys/compat/common/files.common
--- a/sys/compat/common/files.common Fri Mar 30 02:28:25 2018 +0000
+++ b/sys/compat/common/files.common Fri Mar 30 02:28:49 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.common,v 1.1.2.23 2018/03/29 23:23:03 pgoyette Exp $
+# $NetBSD: files.common,v 1.1.2.24 2018/03/30 02:28:49 pgoyette Exp $
#
# Generic files, used by all compat options.
@@ -46,8 +46,8 @@
# Compatibility code for NetBSD 2.0
file compat/common/compat_20_mod.c compat_20
file compat/common/vfs_syscalls_20.c compat_20
-file compat_common/if43_20.c compat_20
-file compat_common/ieee80211_20.c compat_20
+file compat/common/if43_20.c compat_20
+file compat/common/ieee80211_20.c compat_20
# Compatibility code for NetBSD 3.0
file compat/common/compat_30_mod.c compat_30
diff -r 573de9eaacfc -r 49ed4c3b253f sys/compat/common/ieee80211_20.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/common/ieee80211_20.c Fri Mar 30 02:28:49 2018 +0000
@@ -0,0 +1,108 @@
+/* $NetBSD: ieee80211_20.c,v 1.1.2.1 2018/03/30 02:28:49 pgoyette Exp $ */
+/*-
+ * Copyright (c) 2001 Atsushi Onoe
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * 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.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+#ifdef __FreeBSD__
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $");
+#endif
+#ifdef __NetBSD__
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_20.c,v 1.1.2.1 2018/03/30 02:28:49 pgoyette Exp $");
+#endif
+
+/*
+ * IEEE 802.11 ioctl support
+ */
+
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#include "opt_compat_netbsd.h"
+#endif
+
+#include <sys/endian.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/kauth.h>
+#include <sys/compat_stub.h>
+
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+
+#include <net80211/ieee80211_var.h>
+#include <net80211/ieee80211_ioctl.h>
+
+#include <dev/ic/wi_ieee.h>
+
+#include <compat/common/compat_mod.h>
+
+#include <compat/sys/sockio.h>
+
+static int
+ieee80211_get_ostats(struct ieee80211_ostats *ostats,
+ struct ieee80211_stats *stats)
+{
+#define COPYSTATS1(__ostats, __nstats, __dstmemb, __srcmemb, __lastmemb)\
+ (void)memcpy(&(__ostats)->__dstmemb, &(__nstats)->__srcmemb, \
+ offsetof(struct ieee80211_stats, __lastmemb) - \
+ offsetof(struct ieee80211_stats, __srcmemb))
+#define COPYSTATS(__ostats, __nstats, __dstmemb, __lastmemb) \
+ COPYSTATS1(__ostats, __nstats, __dstmemb, __dstmemb, __lastmemb)
+
+ COPYSTATS(ostats, stats, is_rx_badversion, is_rx_unencrypted);
+ COPYSTATS(ostats, stats, is_rx_wepfail, is_rx_beacon);
+ COPYSTATS(ostats, stats, is_rx_rstoobig, is_rx_auth_countermeasures);
+ COPYSTATS(ostats, stats, is_rx_assoc_bss, is_rx_assoc_badwpaie);
+ COPYSTATS(ostats, stats, is_rx_deauth, is_rx_unauth);
+ COPYSTATS1(ostats, stats, is_tx_nombuf, is_tx_nobuf, is_tx_badcipher);
+ COPYSTATS(ostats, stats, is_scan_active, is_crypto_tkip);
+
+ return 0;
+}
+
+void
+ieee80211_20_init(void)
+{
+
+ ieee80211_get_ostats_20 = ieee80211_get_ostats;
+}
+void
+ieee80211_20_fini(void)
Home |
Main Index |
Thread Index |
Old Index