aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-10-01 16:37:54 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-10-01 16:37:54 +0000
commit550374efe620fac25d9504fcaafd00adec5d9ee5 (patch)
tree68705a8066e12399b583f13fdf33f05c1f37b33b /sys
parent7d5c6491f0665f36741c82effc23c9dd684d4041 (diff)
downloadsrc-550374efe620fac25d9504fcaafd00adec5d9ee5.tar.gz
src-550374efe620fac25d9504fcaafd00adec5d9ee5.zip
revert r324166, it has an unrelated change in it
Notes
Notes: svn path=/head/; revision=324167
Diffstat (limited to 'sys')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c6
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c2
-rw-r--r--sys/kern/kern_linker.c37
-rw-r--r--sys/kern/kern_sysctl.c48
-rw-r--r--sys/sys/sysctl.h3
5 files changed, 11 insertions, 85 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
index e34dec3be677..313ca17a405a 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
@@ -1808,10 +1808,10 @@ get_clones_stat(dsl_dataset_t *ds, nvlist_t *nv)
fnvlist_add_nvlist(propval, ZPROP_VALUE, val);
fnvlist_add_nvlist(nv, zfs_prop_to_name(ZFS_PROP_CLONES),
propval);
+ } else {
+ nvlist_free(val);
+ nvlist_free(propval);
}
-
- nvlist_free(val);
- nvlist_free(propval);
}
/*
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
index 87649a421ca8..f2235cecca51 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -3096,8 +3096,6 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig,
if (config && (rewind_error || state != SPA_LOAD_RECOVER))
spa_config_set(spa, config);
- else
- nvlist_free(config);
if (state == SPA_LOAD_RECOVER) {
ASSERT3P(loadinfo, ==, NULL);
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index fc9c8fb33cd7..06cd3c0a5750 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -288,7 +288,7 @@ linker_file_sysuninit(linker_file_t lf)
}
static void
-linker_file_register_sysctls(linker_file_t lf, bool enable)
+linker_file_register_sysctls(linker_file_t lf)
{
struct sysctl_oid **start, **stop, **oidp;
@@ -303,34 +303,8 @@ linker_file_register_sysctls(linker_file_t lf, bool enable)
sx_xunlock(&kld_sx);
sysctl_wlock();
- for (oidp = start; oidp < stop; oidp++) {
- if (enable)
- sysctl_register_oid(*oidp);
- else
- sysctl_register_disabled_oid(*oidp);
- }
- sysctl_wunlock();
- sx_xlock(&kld_sx);
-}
-
-static void
-linker_file_enable_sysctls(linker_file_t lf)
-{
- struct sysctl_oid **start, **stop, **oidp;
-
- KLD_DPF(FILE,
- ("linker_file_enable_sysctls: enable SYSCTLs for %s\n",
- lf->filename));
-
- sx_assert(&kld_sx, SA_XLOCKED);
-
- if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0)
- return;
-
- sx_xunlock(&kld_sx);
- sysctl_wlock();
for (oidp = start; oidp < stop; oidp++)
- sysctl_enable_oid(*oidp);
+ sysctl_register_oid(*oidp);
sysctl_wunlock();
sx_xlock(&kld_sx);
}
@@ -456,9 +430,8 @@ linker_load_file(const char *filename, linker_file_t *result)
return (error);
}
modules = !TAILQ_EMPTY(&lf->modules);
- linker_file_register_sysctls(lf, false);
+ linker_file_register_sysctls(lf);
linker_file_sysinit(lf);
- linker_file_enable_sysctls(lf);
lf->flags |= LINKER_FILE_LINKED;
/*
@@ -719,8 +692,8 @@ linker_file_unload(linker_file_t file, int flags)
*/
if (file->flags & LINKER_FILE_LINKED) {
file->flags &= ~LINKER_FILE_LINKED;
- linker_file_unregister_sysctls(file);
linker_file_sysuninit(file);
+ linker_file_unregister_sysctls(file);
}
TAILQ_REMOVE(&linker_files, file, link);
@@ -1669,7 +1642,7 @@ restart:
if (linker_file_lookup_set(lf, "sysinit_set", &si_start,
&si_stop, NULL) == 0)
sysinit_add(si_start, si_stop);
- linker_file_register_sysctls(lf, true);
+ linker_file_register_sysctls(lf);
lf->flags |= LINKER_FILE_LINKED;
continue;
fail:
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 12b7b6342c31..b70e8fa8a5d6 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -408,8 +408,8 @@ SYSCTL_PROC(_sysctl, 0, reuse_test, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE,
0, 0, sysctl_reuse_test, "-", "");
#endif
-static void
-sysctl_register_oid_impl(struct sysctl_oid *oidp, bool enable)
+void
+sysctl_register_oid(struct sysctl_oid *oidp)
{
struct sysctl_oid_list *parent = oidp->oid_parent;
struct sysctl_oid *p;
@@ -491,17 +491,6 @@ retry:
}
/* update the OID number, if any */
oidp->oid_number = oid_number;
-
- /*
- * Mark the leaf as dormant if it's not to be immediately enabled.
- * We do not disable nodes as they can be shared between modules
- * and it is always safe to access a node.
- */
- if (!enable && (oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) {
- KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0,
- ("internal flag is set in oid_kind"));
- oidp->oid_kind |= CTLFLAG_DORMANT;
- }
if (q != NULL)
SLIST_INSERT_AFTER(q, oidp, oid_link);
else
@@ -521,35 +510,6 @@ retry:
}
void
-sysctl_register_oid(struct sysctl_oid *oidp)
-{
-
- sysctl_register_oid_impl(oidp, true);
-}
-
-void
-sysctl_register_disabled_oid(struct sysctl_oid *oidp)
-{
-
- sysctl_register_oid_impl(oidp, false);
-}
-
-void
-sysctl_enable_oid(struct sysctl_oid *oidp)
-{
-
- SYSCTL_ASSERT_WLOCKED();
- if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
- KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) == 0,
- ("sysctl node is marked as dormant"));
- return;
- }
- KASSERT((oidp->oid_kind & CTLFLAG_DORMANT) != 0,
- ("enabling already enabled sysctl oid"));
- oidp->oid_kind &= ~CTLFLAG_DORMANT;
-}
-
-void
sysctl_unregister_oid(struct sysctl_oid *oidp)
{
struct sysctl_oid *p;
@@ -1097,7 +1057,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen,
*next = oidp->oid_number;
*oidpp = oidp;
- if ((oidp->oid_kind & (CTLFLAG_SKIP | CTLFLAG_DORMANT)) != 0)
+ if (oidp->oid_kind & CTLFLAG_SKIP)
continue;
if (!namelen) {
@@ -1918,8 +1878,6 @@ sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
}
lsp = SYSCTL_CHILDREN(oid);
} else if (indx == namelen) {
- if ((oid->oid_kind & CTLFLAG_DORMANT) != 0)
- return (ENOENT);
*noid = oid;
if (nindx != NULL)
*nindx = indx;
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 5fcdc11630c1..d7721618cbba 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -83,7 +83,6 @@ struct ctlname {
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
-#define CTLFLAG_DORMANT 0x20000000 /* This sysctl is not active yet */
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */
@@ -220,8 +219,6 @@ int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS);
* These functions are used to add/remove an oid from the mib.
*/
void sysctl_register_oid(struct sysctl_oid *oidp);
-void sysctl_register_disabled_oid(struct sysctl_oid *oidp);
-void sysctl_enable_oid(struct sysctl_oid *oidp);
void sysctl_unregister_oid(struct sysctl_oid *oidp);
/* Declare a static oid to allow child oids to be added to it. */