Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2000 14:07:00 +0200 (CEST)
From:      Andrzej Bialecki <abial@webgiro.com>
To:        Neil Blakey-Milner <nbm@mithrandr.moria.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: RFC: Dynamic sysctls, next round
Message-ID:  <Pine.BSF.4.20.0006281359270.97950-100000@mx.webgiro.com>
In-Reply-To: <20000628122049.A47648@mithrandr.moria.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Jun 2000, Neil Blakey-Milner wrote:

> On Wed 2000-06-28 (11:25), Andrzej Bialecki wrote:
> > These patches provide support for fully dynamic sysctl manipulation.
> > They are based on ideas of several people, including Arun Sharma,
> > Jonathan Lemon and Doug Rabson. Thank you, guys!
> 
> I've had something like this for a few weeks, but yours is much better,
> I think.  
> 
> My only comment is that I don't see the need for the 'nbr' fields, as we
> should always use OID_AUTO.

You mean 'in the macros', right? Well, I'm not sure. There are reserved
oids that are currently allocated statically, that perhaps might be moved
to dynamic allocation, but still they would need to use their original oid
number (some userland utilities use oids instead of names). Also, I think
removing them from macros could cause more confusion than necessary... or
not...

Other than that, I agree. :-)

> 
> Otherwise, this will greatly simplify my life. (:
> 
> Now if you can create a method to only walk through the direct children,
> and not the children's children too, I can show my irq/drq/iomem/ioport
> exportation via sysctl and the userland 'sysinfo' without shuddering at
> the ugly code.

This issue doesn't depend on the dynamic vs. static allocation. It's
rather an issue of knowing a little secret: in struct sysctl_oid, for oids
type of CTLTYPE_NODE the *arg1 points to a singly-linked list containing
all children. You can just traverse this, and you're set. I defined a
helpful macro SYSCTL_CHILDREN(struct sysctl_oid *parent) that returns the
head of the list, if any.

Andrzej Bialecki

//  <abial@webgiro.com> WebGiro AB, Sweden (http://www.webgiro.com)
// -------------------------------------------------------------------
// ------ FreeBSD: The Power to Serve. http://www.freebsd.org --------
// --- Small & Embedded FreeBSD: http://www.freebsd.org/~picobsd/ ----




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.20.0006281359270.97950-100000>