From owner-freebsd-doc@FreeBSD.ORG Tue Oct 14 14:38:23 2003 Return-Path: Delivered-To: freebsd-doc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 060E816A4B3 for ; Tue, 14 Oct 2003 14:38:23 -0700 (PDT) Received: from mail.speakeasy.net (mail10.speakeasy.net [216.254.0.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id B232443FBF for ; Tue, 14 Oct 2003 14:38:21 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 7459 invoked from network); 14 Oct 2003 21:38:21 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 14 Oct 2003 21:38:21 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h9ELcHce049546; Tue, 14 Oct 2003 17:38:17 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20031014034838.GA20484@electra.cse.Buffalo.EDU> Date: Tue, 14 Oct 2003 17:38:26 -0400 (EDT) From: John Baldwin To: Ken Smith X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: freebsd-doc@freebsd.org Subject: RE: SYSINIT() fixes for Architecture Manual X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2003 21:38:23 -0000 On 14-Oct-2003 Ken Smith wrote: > > Murray suggested I just send this here, and he'd chime in if nobody > else feels like enough of an authority to say whether or not I'm > lying. :-) > > While working on PR docs/57568 to fix the SYSINIT() examples I > decided to try and clarify a little bit what SYSINIT() is/isn't > used for. Can anyone say one way or another if I hit the target? > > Thanks. > > [ snip ] > > void foo_null(void *unused) > { > foo_doo(); > } > -SYSINIT(foo_null, SI_SUB_FOO, SI_ORDER_FOO, NULL); > +SYSINIT(foo, SI_SUB_FOO, SI_ORDER_FOO, foo_null, NULL); > > struct foo foo_voodoo = { > FOO_VOODOO; > @@ -115,26 +126,34 @@ > struct foo *foo = (struct foo *)vdata; > foo_data(foo); > } > -SYSINIT(foo_arg, SI_SUB_FOO, SI_ORDER_FOO, foo_voodoo); > - > +SYSINIT(foo, SI_SUB_FOO, SI_ORDER_FOO, foo_arg, foo_voodoo); > + > + > + > + Note that SI_SUB_FOO and > + SI_ORDER_FOO need to be in the > + sysinit_sub_id and > + sysinit_elem_order enum's as mentioned above. > + Either use existing ones or add your own to the enum's. > You should make sure both SYSINITs have uniqe uniqifiers, maybe use 'bar' instead of 'foo' for the second example. Also, you might want to note that you can do math on the SYSINITs. For example, you can do something like this: static void mptable_register(void *dummy __unused) { apic_register_enumerator(&mptable_enumerator); } SYSINIT(mptable_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, mptable_register, NULL) Also, using 'Sysinit' seems really odd. I would either go with 'sysinit', 'SYSINIT', or 'system initialization function'. > > Shutdown > > - The SYSUNINIT() macro behaves similarly > + The SYSUNINIT() macro behaves similar > to the SYSINIT() macro except that it adds > the Sysinit data to Sysinit's shutdown data set. similar is an adjective, not an adverb. You are describing how it behaves, so it should be the adverb form: similarly. Even if it is a mouthful to say. :) > @@ -143,8 +162,9 @@ > void foo_flush(void *vdata) > { > } > -SYSUNINIT(foo_flush, SI_SUB_FOO, SI_ORDER_FOO, foo_stack); > - > +SYSUNINIT(foo, SI_SUB_FOO, SI_ORDER_FOO, foo_flush, foo_stack); > + > + > > > Again, make sure you have uniqe uniqifiers in this example as well. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/