Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Use the MP-safe hooks mechanism for the uipc_s...
details: https://anonhg.NetBSD.org/src/rev/b6416c2fbcf4
branches: pgoyette-compat
changeset: 830732:b6416c2fbcf4
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Thu Sep 20 07:34:09 2018 +0000
description:
Use the MP-safe hooks mechanism for the uipc_syscalls_40 and _50
routines.
diffstat:
sys/compat/common/uipc_syscalls_40.c | 12 ++++++++----
sys/compat/common/uipc_syscalls_50.c | 15 +++++++++------
sys/kern/compat_stub.c | 21 ++++++++++++++++++---
sys/net/if.c | 25 +++++++++++++++++++------
sys/sys/compat_stub.h | 26 +++++++++++++++++++++++---
5 files changed, 77 insertions(+), 22 deletions(-)
diffs (246 lines):
diff -r 61f4fe1efaf2 -r b6416c2fbcf4 sys/compat/common/uipc_syscalls_40.c
--- a/sys/compat/common/uipc_syscalls_40.c Thu Sep 20 07:32:50 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_40.c Thu Sep 20 07:34:09 2018 +0000
@@ -1,9 +1,9 @@
-/* $NetBSD: uipc_syscalls_40.c,v 1.15.2.9 2018/04/16 03:41:34 pgoyette Exp $ */
+/* $NetBSD: uipc_syscalls_40.c,v 1.15.2.10 2018/09/20 07:34:09 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.9 2018/04/16 03:41:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15.2.10 2018/09/20 07:34:09 pgoyette Exp $");
/*
* System call interface to the socket abstraction.
@@ -15,6 +15,7 @@
#include <sys/sysctl.h>
#include <sys/syscallargs.h>
#include <sys/errno.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
@@ -162,16 +163,19 @@
return error;
}
+MODULE_SET_HOOK(uipc_syscalls_40_hook, "uipc40", compat_ifconf);
+MODULE_UNSET_HOOK(uipc_syscalls_40_hook);
+
void
uipc_syscalls_40_init(void)
{
- vec_compat_ifconf = compat_ifconf;
+ uipc_syscalls_40_hook_set();
}
void
uipc_syscalls_40_fini(void)
{
- vec_compat_ifconf = (void *)enosys;
+ uipc_syscalls_40_hook_unset();
}
diff -r 61f4fe1efaf2 -r b6416c2fbcf4 sys/compat/common/uipc_syscalls_50.c
--- a/sys/compat/common/uipc_syscalls_50.c Thu Sep 20 07:32:50 2018 +0000
+++ b/sys/compat/common/uipc_syscalls_50.c Thu Sep 20 07:34:09 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls_50.c,v 1.3.56.8 2018/05/02 07:20:06 pgoyette Exp $ */
+/* $NetBSD: uipc_syscalls_50.c,v 1.3.56.9 2018/09/20 07:34:09 pgoyette 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.56.8 2018/05/02 07:20:06 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_50.c,v 1.3.56.9 2018/09/20 07:34:09 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -48,6 +48,7 @@
#include <sys/kauth.h>
#include <sys/proc.h>
#include <sys/time.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
@@ -108,18 +109,20 @@
}
}
-/* Save and restore compat vector as needed */
+MODULE_SET_HOOK(uipc_syscalls_50_hook, "uipc50", compat_ifdatareq);
+MODULE_UNSET_HOOK(uipc_syscalls_50_hook);
void
uipc_syscalls_50_init(void)
{
- vec_compat_ifdatareq = compat_ifdatareq;
+ uipc_syscalls_50_hook_set();
}
void
uipc_syscalls_50_fini(void)
{
+
+ uipc_syscalls_50_hook_unset();
+}
- vec_compat_ifdatareq = (void *)enosys;
- }
diff -r 61f4fe1efaf2 -r b6416c2fbcf4 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c Thu Sep 20 07:32:50 2018 +0000
+++ b/sys/kern/compat_stub.c Thu Sep 20 07:34:09 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.20 2018/09/19 04:12:43 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.21 2018/09/20 07:34:10 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -130,10 +130,25 @@
struct ieee80211_ostats_hook_t ieee80211_ostats_hook;
struct ieee80211_get_ostats_20_hook_t ieee80211_get_ostats_20_hook;
-int (*ieee80211_get_ostats_20)(struct ieee80211_ostats *,
+/*XXX PRG */int (*ieee80211_get_ostats_20)(struct ieee80211_ostats *,
struct ieee80211_stats *) = (void *)enosys;
-int (*if43_20_cvtcmd)(int) = (void *)enosys;
+/*
+ * if_43 compatability
+ */
+struct if_43_hook_t if_43_hook;
+
+/*
+ * upic_syscalls_40 compatability
+ */
+struct uipc_syscalls_40_hook_t uipc_syscalls_40_hook;
+
+/*
+ * upic_syscalls_50 compatability
+ */
+struct uipc_syscalls_50_hook_t uipc_syscalls_50_hook;
+
+/*XXX PRG */int (*if43_20_cvtcmd)(int) = (void *)enosys;
/*
* rtsock 14 compatability
diff -r 61f4fe1efaf2 -r b6416c2fbcf4 sys/net/if.c
--- a/sys/net/if.c Thu Sep 20 07:32:50 2018 +0000
+++ b/sys/net/if.c Thu Sep 20 07:34:09 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.419.2.10 2018/09/06 06:56:44 pgoyette Exp $ */
+/* $NetBSD: if.c,v 1.419.2.11 2018/09/20 07:34:10 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.419.2.10 2018/09/06 06:56:44 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.419.2.11 2018/09/20 07:34:10 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -120,6 +120,7 @@
#include <sys/xcall.h>
#include <sys/cpu.h>
#include <sys/intr.h>
+#include <sys/compat_stub.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -246,8 +247,6 @@
u_long (*vec_compat_cvtcmd)(u_long) = NULL;
int (*vec_compat_ifioctl)(struct socket *, u_long, u_long, void *,
struct lwp *) = NULL;
-int (*vec_compat_ifconf)(struct lwp *, u_long, void *) = (void *)enosys;
-int (*vec_compat_ifdatareq)(struct lwp *, u_long, void *) = (void *)enosys;
static int
if_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
@@ -3108,6 +3107,19 @@
}
/*
+ * Interface for calling the compat routines
+ */
+MODULE_CALL_HOOK_DECL(uipc_syscalls_40_hook, f,
+ (struct lwp *l, int cmd, void *data), (l, cmd, data), enosys());
+MODULE_CALL_HOOK(uipc_syscalls_40_hook, f,
+ (struct lwp *l, int cmd, void *data), (l, cmd, data), enosys());
+
+MODULE_CALL_HOOK_DECL(uipc_syscalls_50_hook, f,
+ (struct lwp *l, int cmd, void *data), (l, cmd, data), enosys());
+MODULE_CALL_HOOK(uipc_syscalls_50_hook, f,
+ (struct lwp *l, int cmd, void *data), (l, cmd, data), enosys());
+
+/*
* Interface ioctls.
*/
static int
@@ -3134,12 +3146,13 @@
case SIOCINITIFADDR:
return EPERM;
default:
- error = (*vec_compat_ifconf)(l, cmd, data);
+ error = uipc_syscalls_40_hook_f_call(l, cmd, data);
if (error != ENOSYS)
return error;
- error = (*vec_compat_ifdatareq)(l, cmd, data);
+ error = uipc_syscalls_50_hook_f_call(l, cmd, data);
if (error != ENOSYS)
return error;
+ error = 0;
break;
}
diff -r 61f4fe1efaf2 -r b6416c2fbcf4 sys/sys/compat_stub.h
--- a/sys/sys/compat_stub.h Thu Sep 20 07:32:50 2018 +0000
+++ b/sys/sys/compat_stub.h Thu Sep 20 07:34:09 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.29 2018/09/19 04:12:43 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.30 2018/09/20 07:34:10 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -158,10 +158,30 @@
struct ieee80211_stats *));
MODULE_HOOK(ieee80211_get_ostats_20_hook, (int));
-extern int (*ieee80211_get_ostats_20)(struct ieee80211_ostats *,
+/* XXX PRG*/extern int (*ieee80211_get_ostats_20)(struct ieee80211_ostats *,
struct ieee80211_stats *);
-extern int (*if43_20_cvtcmd)(int);
+/*
+ * if_43 compatability
+ */
+struct socket;
+
+MODULE_HOOK2(if_43_hook, (int),
+ (struct socket *, u_long, u_long, void *, struct lwp *));
+
+/* XXX PRG */extern int (*if43_20_cvtcmd)(int);
+
+/*
+ * uipc_syscalls_40 compatability
+ */
+
+MODULE_HOOK(uipc_syscalls_40_hook, (struct lwp *, u_long, void *));
+
+/*
+ * uipc_syscalls_50 compatability
+ */
+
+MODULE_HOOK(uipc_syscalls_50_hook, (struct lwp *, u_long, void *));
/*
* rtsock 14 compatability
Home |
Main Index |
Thread Index |
Old Index