From 4813ad54f87e014a4f7385034f1914ff1bf13cd0 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Sat, 28 Jun 2014 17:36:18 +0000 Subject: [PATCH] Compile fixes: Remove duplicate "debug_ktr.mask" sysctl definition. Remove now unused variable from "kern_ktr.c". This fixes build of "ktr" which was broken by r267961. Let the default value for "vm_kmem_size_scale" be zero. It is setup after that the sysctl has been initialized from "getenv()" in the "kmeminit()" function to equal the "VM_KMEM_SIZE_MAX" value, if zero. On Sparc64 the "VM_KMEM_SIZE_MAX" macro is not a constant. This fixes build of Sparc64 which was broken by r267961. Add a special macro to dynamically create SYSCTL root nodes, because root nodes have a special parent. This fixes build of existing OFED module and CANBUS module for pc98 which was broken by r267961. Add missing "sysctl.h" includes to get the needed sysctl header file declarations. This is needed after r267961. MFC after: 2 weeks --- sys/kern/kern_ktr.c | 6 +----- sys/kern/kern_malloc.c | 2 +- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 1 + sys/ofed/drivers/net/mlx4/en_netdev.c | 1 + sys/ofed/include/linux/linux_compat.c | 2 +- sys/pc98/pc98/canbus.c | 5 ++--- sys/sys/sysctl.h | 4 ++++ 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index c377f36e09a..60e0a86a49f 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -102,13 +102,9 @@ int ktr_version = KTR_VERSION; struct ktr_entry ktr_buf_init[KTR_BOOT_ENTRIES]; struct ktr_entry *ktr_buf = ktr_buf_init; cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK); -static char ktr_cpumask_str[CPUSETBUFSIZ]; static SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options"); -SYSCTL_INT(_debug_ktr, OID_AUTO, mask, CTLFLAG_RDTUN, - &ktr_mask, 0, "KTR mask"); - SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD, &ktr_version, 0, "Version of the KTR interface"); @@ -175,7 +171,7 @@ sysctl_debug_ktr_mask(SYSCTL_HANDLER_ARGS) return (error); } -SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, CTLTYPE_UINT|CTLFLAG_RW, 0, 0, +SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, CTLTYPE_UINT|CTLFLAG_RWTUN, 0, 0, sysctl_debug_ktr_mask, "IU", "Bitmask of KTR event classes for which logging is enabled"); diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index f16d4d50081..464303a0fa4 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -191,7 +191,7 @@ static u_long vm_kmem_size_max; SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RDTUN, &vm_kmem_size_max, 0, "Maximum size of kernel memory"); -static u_int vm_kmem_size_scale = VM_KMEM_SIZE_SCALE; +static u_int vm_kmem_size_scale; SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RDTUN, &vm_kmem_size_scale, 0, "Scale factor for kernel memory size"); diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index f02c3335d45..910424dd768 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include uma_zone_t sdp_zone; struct rwlock sdp_lock; diff --git a/sys/ofed/drivers/net/mlx4/en_netdev.c b/sys/ofed/drivers/net/mlx4/en_netdev.c index a992ae97599..97dd5b2d2e6 100644 --- a/sys/ofed/drivers/net/mlx4/en_netdev.c +++ b/sys/ofed/drivers/net/mlx4/en_netdev.c @@ -42,6 +42,7 @@ #include #include #include +#include static void mlx4_en_init_locked(struct mlx4_en_priv *priv); static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv); diff --git a/sys/ofed/include/linux/linux_compat.c b/sys/ofed/include/linux/linux_compat.c index 80d1e1e8cf1..01c95e8884e 100644 --- a/sys/ofed/include/linux/linux_compat.c +++ b/sys/ofed/include/linux/linux_compat.c @@ -678,7 +678,7 @@ linux_compat_init(void) struct sysctl_oid *rootoid; int i; - rootoid = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(), + rootoid = SYSCTL_ADD_ROOT_NODE(NULL, OID_AUTO, "sys", CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, "sys"); kobject_init(&class_root, &class_ktype); kobject_set_name(&class_root, "class"); diff --git a/sys/pc98/pc98/canbus.c b/sys/pc98/pc98/canbus.c index 96190473ff0..daacdbd3e46 100644 --- a/sys/pc98/pc98/canbus.c +++ b/sys/pc98/pc98/canbus.c @@ -188,9 +188,8 @@ canbus_attach(device_t dev) /* Dynamic sysctl tree setup */ sysctl_ctx_init(&sc->canbus_sysctl_ctx); - canbus_sysctl_tree = SYSCTL_ADD_NODE(&sc->canbus_sysctl_ctx, - SYSCTL_STATIC_CHILDREN(/* tree top */), OID_AUTO, - "canbus", CTLFLAG_RD, 0, "CanBe I/O Bus"); + canbus_sysctl_tree = SYSCTL_ADD_ROOT_NODE(&sc->canbus_sysctl_ctx, + OID_AUTO, "canbus", CTLFLAG_RD, 0, "CanBe I/O Bus"); SYSCTL_ADD_INT(&sc->canbus_sysctl_ctx, SYSCTL_CHILDREN(canbus_sysctl_tree), OID_AUTO, "io_delay_time", CTLFLAG_RW, &sc->io_delay_time, 0, "CanBe Bus I/O delay time"); diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 0473eb72ebb..209e732c3f3 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -325,6 +325,10 @@ SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; ); sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", __DESCR(descr)) +#define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \ + sysctl_add_oid(ctx, &sysctl__children, nbr, name, \ + CTLTYPE_NODE|(access), NULL, 0, handler, "N", __DESCR(descr)) + /* Oid for a string. len can be 0 to indicate '\0' termination. */ #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \