From owner-freebsd-arch Sun Jul 2 23: 1:33 2000 Delivered-To: freebsd-arch@freebsd.org Received: from gateway.posi.net (c1096725-a.smateo1.sfba.home.com [24.20.139.104]) by hub.freebsd.org (Postfix) with ESMTP id 89B6537B797; Sun, 2 Jul 2000 23:01:30 -0700 (PDT) (envelope-from kbyanc@posi.net) Received: from localhost (kbyanc@localhost) by gateway.posi.net (8.9.3/8.9.3) with ESMTP id XAA08696; Sun, 2 Jul 2000 23:02:42 -0700 (PDT) (envelope-from kbyanc@posi.net) Date: Sun, 2 Jul 2000 23:02:41 -0700 (PDT) From: Kelly Yancey To: Andrzej Bialecki Cc: dfr@FreeBSD.ORG, jlemon@FreeBSD.ORG, freebsd-arch@FreeBSD.ORG Subject: Re: UPDATE: Re: Dynamic sysctls, next round (please review) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 2 Jul 2000, Andrzej Bialecki wrote: > Hi, > > Ok, I think I solved all bad scenarios (described in the message at the > end). Instead of implementing some complex referencing mechanism, I just > added a possibility to do "safe delete" of context, so that it's possible > to rollback the changes if it fails in the middle. > > I tested that creating partially overlapping subtrees, and deleting them > independently works properly. > > The new patches are available at the same URL: > > http://www.freebsd.org/~abial/dyn_sysctl.tgz > > Please review and send me your comments. Thanks! > I think these look very good and I believe that most of my nits have already been mentioned by Brian. I do have a couple more issues though: It strikes me that the patch actually includes 2 semi-related changes: 1. The ability to create/delete oids at run-time, "dynamic sysctls". 2. Assistance to modules for managing these dynamic sysctls, "contexts". I should think that the former is not dependent on the latter. As such, I think that sysctl_add_oid should be able to accept a NULL clist pointer. Or, better yet, the context code should be completely independent to the extent that if the module wants to use contexts as a convenience for managing their dynamic sysctls, they should call sysctl_add_oid (which knows nothing of contexts now), return the syctl_oid * back, and pass that to the sysctl_ctx_add routine itself. The statements might look something like: oid = sysctl_add_oid(...) sysctl_ctx_add(myctx, oid); Of course, if the module didn't care about the oid handle for anything else, the two calls could be combined into one statement. In any event, I think this is cleaner and makes the purpose of contexts more clear. The other issue is with sysctl_remove_oid: it should never actually remove a node for which at least one child has a reference count > 0. As it stands, sysctl_remove_oid will recursively try to remove child nodes (which may only decrement their reference count to a value still > 0). But it will then proceed to delete the still-referenced children (presumably this was the justification for the warning comment). But this can be solved simply by checking if there are any nodes left after recursion, and if so, do not delete (but return success). Of course, none of this should matter if references counts are maintained correctly (in which case, I simply don't understand why the warning is there at all). But overall, I am looking forward to seeing this get into -current. This is very neat, and I'm already thinking of how it integrates with some sysctl work I've been up to. :) Kelly -- Kelly Yancey - kbyanc@posi.net - Belmont, CA System Administrator, eGroups.com http://www.egroups.com/ Maintainer, BSD Driver Database http://www.posi.net/freebsd/drivers/ Coordinator, Team FreeBSD http://www.posi.net/freebsd/Team-FreeBSD/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message