Take advantage of the dev sysctl tree.
Approved by: wpaul
This commit is contained in:
parent
17b52df3d7
commit
95045d6bb3
@ -611,6 +611,7 @@ ndis_create_sysctls(arg)
|
||||
|
||||
TAILQ_INIT(&sc->ndis_cfglist_head);
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
/* Create the sysctl tree. */
|
||||
|
||||
sc->ndis_tree = SYSCTL_ADD_NODE(&sc->ndis_ctx,
|
||||
@ -618,6 +619,7 @@ ndis_create_sysctls(arg)
|
||||
device_get_nameunit(sc->ndis_dev), CTLFLAG_RD, 0,
|
||||
device_get_desc(sc->ndis_dev));
|
||||
|
||||
#endif
|
||||
/* Add the driver-specific registry keys. */
|
||||
|
||||
vals = sc->ndis_regvals;
|
||||
@ -628,8 +630,13 @@ ndis_create_sysctls(arg)
|
||||
vals++;
|
||||
continue;
|
||||
}
|
||||
#if __FreeBSD_version < 502113
|
||||
SYSCTL_ADD_STRING(&sc->ndis_ctx,
|
||||
SYSCTL_CHILDREN(sc->ndis_tree),
|
||||
#else
|
||||
SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)),
|
||||
#endif
|
||||
OID_AUTO, vals->nc_cfgkey,
|
||||
CTLFLAG_RW, vals->nc_val,
|
||||
sizeof(vals->nc_val),
|
||||
@ -698,7 +705,12 @@ ndis_add_sysctl(arg, key, desc, val, flag)
|
||||
|
||||
TAILQ_INSERT_TAIL(&sc->ndis_cfglist_head, cfg, link);
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
SYSCTL_ADD_STRING(&sc->ndis_ctx, SYSCTL_CHILDREN(sc->ndis_tree),
|
||||
#else
|
||||
SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev),
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)),
|
||||
#endif
|
||||
OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag,
|
||||
cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val),
|
||||
cfg->ndis_cfg.nc_cfgdesc);
|
||||
|
@ -613,7 +613,11 @@ ndis_read_cfg(status, parm, cfg, key, type)
|
||||
* See if registry key is already in a list of known keys
|
||||
* included with the driver.
|
||||
*/
|
||||
#if __FreeBSD_version < 502113
|
||||
TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
|
||||
#else
|
||||
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
||||
#endif
|
||||
oidp = e->entry;
|
||||
if (my_strcasecmp(oidp->oid_name, keystr) == 0) {
|
||||
if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) {
|
||||
@ -709,7 +713,11 @@ ndis_write_cfg(status, cfg, key, parm)
|
||||
|
||||
/* See if the key already exists. */
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
|
||||
#else
|
||||
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
||||
#endif
|
||||
oidp = e->entry;
|
||||
if (my_strcasecmp(oidp->oid_name, keystr) == 0) {
|
||||
/* Found it, set the value. */
|
||||
|
@ -43,7 +43,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/queue.h>
|
||||
#if __FreeBSD_version < 502113
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
@ -389,8 +391,10 @@ ndis_attach(dev)
|
||||
|
||||
sc->ndis_regvals = ndis_regvals;
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
sysctl_ctx_init(&sc->ndis_ctx);
|
||||
|
||||
#endif
|
||||
/* Create sysctl registry nodes */
|
||||
ndis_create_sysctls(sc);
|
||||
|
||||
@ -741,8 +745,10 @@ ndis_detach(dev)
|
||||
if (sc->ndis_iftype == PCIBus)
|
||||
bus_dma_tag_destroy(sc->ndis_parent_tag);
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
sysctl_ctx_free(&sc->ndis_ctx);
|
||||
|
||||
#endif
|
||||
mtx_destroy(&sc->ndis_mtx);
|
||||
mtx_destroy(&sc->ndis_intrmtx);
|
||||
|
||||
|
@ -113,8 +113,10 @@ struct ndis_softc {
|
||||
int ndis_if_flags;
|
||||
int ndis_skip;
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
struct sysctl_ctx_list ndis_ctx;
|
||||
struct sysctl_oid *ndis_tree;
|
||||
#endif
|
||||
int ndis_devidx;
|
||||
interface_type ndis_iftype;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user