svn commit: r262734 - in stable/10/sys: kern net netinet
Gleb Smirnoff
glebius at FreeBSD.org
Tue Mar 4 14:01:13 UTC 2014
Author: glebius
Date: Tue Mar 4 14:01:12 2014
New Revision: 262734
URL: http://svnweb.freebsd.org/changeset/base/262734
Log:
Merge r261590, r261592 from head:
Remove identical vnet sysctl handlers, and handle CTLFLAG_VNET
in the sysctl_root().
Note: SYSCTL_VNET_* macros can be removed as well. All is
needed to virtualize a sysctl oid is set CTLFLAG_VNET on it.
But for now keep macros in place to avoid large code churn.
Modified:
stable/10/sys/kern/kern_sysctl.c
stable/10/sys/net/vnet.c
stable/10/sys/net/vnet.h
stable/10/sys/netinet/in_pcb.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/kern/kern_sysctl.c
==============================================================================
--- stable/10/sys/kern/kern_sysctl.c Tue Mar 4 14:00:49 2014 (r262733)
+++ stable/10/sys/kern/kern_sysctl.c Tue Mar 4 14:01:12 2014 (r262734)
@@ -1491,7 +1491,10 @@ sysctl_root(SYSCTL_HANDLER_ARGS)
#endif
oid->oid_running++;
SYSCTL_XUNLOCK();
-
+#ifdef VIMAGE
+ if ((oid->oid_kind & CTLFLAG_VNET) && arg1 != NULL)
+ arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
+#endif
if (!(oid->oid_kind & CTLFLAG_MPSAFE))
mtx_lock(&Giant);
error = oid->oid_handler(oid, arg1, arg2, req);
Modified: stable/10/sys/net/vnet.c
==============================================================================
--- stable/10/sys/net/vnet.c Tue Mar 4 14:00:49 2014 (r262733)
+++ stable/10/sys/net/vnet.c Tue Mar 4 14:01:12 2014 (r262734)
@@ -465,47 +465,6 @@ vnet_data_copy(void *start, int size)
}
/*
- * Variants on sysctl_handle_foo that know how to handle virtualized global
- * variables: if 'arg1' is a pointer, then we transform it to the local vnet
- * offset.
- */
-int
-vnet_sysctl_handle_int(SYSCTL_HANDLER_ARGS)
-{
-
- if (arg1 != NULL)
- arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
- return (sysctl_handle_int(oidp, arg1, arg2, req));
-}
-
-int
-vnet_sysctl_handle_opaque(SYSCTL_HANDLER_ARGS)
-{
-
- if (arg1 != NULL)
- arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
- return (sysctl_handle_opaque(oidp, arg1, arg2, req));
-}
-
-int
-vnet_sysctl_handle_string(SYSCTL_HANDLER_ARGS)
-{
-
- if (arg1 != NULL)
- arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
- return (sysctl_handle_string(oidp, arg1, arg2, req));
-}
-
-int
-vnet_sysctl_handle_uint(SYSCTL_HANDLER_ARGS)
-{
-
- if (arg1 != NULL)
- arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1);
- return (sysctl_handle_int(oidp, arg1, arg2, req));
-}
-
-/*
* Support for special SYSINIT handlers registered via VNET_SYSINIT()
* and VNET_SYSUNINIT().
*/
Modified: stable/10/sys/net/vnet.h
==============================================================================
--- stable/10/sys/net/vnet.h Tue Mar 4 14:00:49 2014 (r262733)
+++ stable/10/sys/net/vnet.h Tue Mar 4 14:01:12 2014 (r262734)
@@ -290,15 +290,10 @@ void vnet_data_free(void *start_arg, in
* arguments themselves, if required.
*/
#ifdef SYSCTL_OID
-int vnet_sysctl_handle_int(SYSCTL_HANDLER_ARGS);
-int vnet_sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
-int vnet_sysctl_handle_string(SYSCTL_HANDLER_ARGS);
-int vnet_sysctl_handle_uint(SYSCTL_HANDLER_ARGS);
-
#define SYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
- ptr, val, vnet_sysctl_handle_int, "I", descr)
+ ptr, val, sysctl_handle_int, "I", descr)
#define SYSCTL_VNET_PROC(parent, nbr, name, access, ptr, arg, handler, \
fmt, descr) \
CTASSERT(((access) & CTLTYPE) != 0); \
@@ -312,16 +307,16 @@ int vnet_sysctl_handle_uint(SYSCTL_HANDL
#define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_STRING|CTLFLAG_VNET|(access), \
- arg, len, vnet_sysctl_handle_string, "A", descr)
+ arg, len, sysctl_handle_string, "A", descr)
#define SYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, \
- sizeof(struct type), vnet_sysctl_handle_opaque, "S," #type, \
+ sizeof(struct type), sysctl_handle_opaque, "S," #type, \
descr)
#define SYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr) \
SYSCTL_OID(parent, nbr, name, \
CTLTYPE_UINT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access), \
- ptr, val, vnet_sysctl_handle_uint, "IU", descr)
+ ptr, val, sysctl_handle_int, "IU", descr)
#define VNET_SYSCTL_ARG(req, arg1) do { \
if (arg1 != NULL) \
arg1 = (void *)(TD_TO_VNET((req)->td)->vnet_data_base + \
Modified: stable/10/sys/netinet/in_pcb.c
==============================================================================
--- stable/10/sys/netinet/in_pcb.c Tue Mar 4 14:00:49 2014 (r262733)
+++ stable/10/sys/netinet/in_pcb.c Tue Mar 4 14:01:12 2014 (r262734)
@@ -144,11 +144,7 @@ sysctl_net_ipport_check(SYSCTL_HANDLER_A
{
int error;
-#ifdef VIMAGE
- error = vnet_sysctl_handle_int(oidp, arg1, arg2, req);
-#else
error = sysctl_handle_int(oidp, arg1, arg2, req);
-#endif
if (error == 0) {
RANGECHK(V_ipport_lowfirstauto, 1, IPPORT_RESERVED - 1);
RANGECHK(V_ipport_lowlastauto, 1, IPPORT_RESERVED - 1);
More information about the svn-src-stable
mailing list