From owner-svn-src-head@FreeBSD.ORG Fri Nov 19 22:32:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D10DC106564A; Fri, 19 Nov 2010 22:32:01 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 379B18FC14; Fri, 19 Nov 2010 22:32:00 +0000 (UTC) Received: by qwi4 with SMTP id 4so377431qwi.13 for ; Fri, 19 Nov 2010 14:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=7frISmsVwNx+6Esee14fFwDlzDu3keEmd5+vgN74SWQ=; b=ZJlq5REm+S+mP+XIOIKy8LvnUBx4e78VqqMsBoWlSubPEvYF/RDGKmrig/FvV4VJXM 6LKJDNZHtPIYek/Np8l7cQxzdoJ4szzKGE12ERnUDR82Iaj6gg6wWyNr0UjybxJkrmNW wJ4WF9MisTOnfNdR13E0yNWFwB1dUnK2i85uU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=j6zOpb1tGAfOup/Dxcfhlay7LEMOpJrBDhb7NYjUXWZqV7djQcxE3Z6wJiTM1CtctX GxDIdHqPlxRNFtUjXmZfO2UWkvjG+eruYA7Q4NELQzTWWbqxa7sLF9Xt1/utf9A2E6iJ bWWkCUo7a2kzmfH2FvWW++3KVr9qVVr5kTmws= MIME-Version: 1.0 Received: by 10.229.191.130 with SMTP id dm2mr2216021qcb.256.1290205920263; Fri, 19 Nov 2010 14:32:00 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.229.31.9 with HTTP; Fri, 19 Nov 2010 14:32:00 -0800 (PST) In-Reply-To: <201011191642.00761.jhb@freebsd.org> References: <201011191943.oAJJhv3i087205@svn.freebsd.org> <201011191617.51552.jhb@freebsd.org> <201011191642.00761.jhb@freebsd.org> Date: Fri, 19 Nov 2010 23:32:00 +0100 X-Google-Sender-Auth: upgcOOZLbIrz_zJ1UxOksVtobMk Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215544 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2010 22:32:01 -0000 2010/11/19 John Baldwin : > On Friday, November 19, 2010 4:27:27 pm Attilio Rao wrote: >> 2010/11/19 John Baldwin : >> > On Friday, November 19, 2010 2:43:57 pm Attilio Rao wrote: >> >> Author: attilio >> >> Date: Fri Nov 19 19:43:56 2010 >> >> New Revision: 215544 >> >> URL: http://svn.freebsd.org/changeset/base/215544 >> >> >> >> Log: >> >> =C2=A0 Scan the list in reverse order for the shutdown handlers of lo= aded modules. >> >> =C2=A0 This way, when there is a dependency between two modules, the = handler of the >> >> =C2=A0 latter probed runs first. >> >> >> >> =C2=A0 This is a similar approach as the modules are unloaded in the = same >> >> =C2=A0 linkerfile. >> >> >> >> =C2=A0 Sponsored by: =C2=A0 =C2=A0 =C2=A0 Sandvine Incorporated >> >> =C2=A0 Submitted by: =C2=A0 =C2=A0 =C2=A0 Nima Misaghian >> >> =C2=A0 MFC after: =C2=A01 week >> >> >> >> Modified: >> >> =C2=A0 head/sys/kern/kern_module.c >> >> >> >> Modified: head/sys/kern/kern_module.c >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >> >> --- head/sys/kern/kern_module.c =C2=A0 =C2=A0 =C2=A0 Fri Nov 19 18:59= :35 2010 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r215543) >> >> +++ head/sys/kern/kern_module.c =C2=A0 =C2=A0 =C2=A0 Fri Nov 19 19:43= :56 2010 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r215544) >> >> @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); >> >> >> >> =C2=A0static MALLOC_DEFINE(M_MODULE, "module", "module data structure= s"); >> >> >> >> -typedef TAILQ_HEAD(, module) modulelist_t; >> >> +typedef TAILQ_HEAD(modulelst, module) modulelist_t; >> > >> > Is modulelist already taken? =C2=A0If not, we should probably just ret= ire >> > 'modulelist_t' and replace it with 'struct modulelist'. >> >> Note that I used modulelst, not modulelist. >> Probabilly, if you think the name may be still confusing, we can >> pickup one another further. > > Yes, I'd much prefer 'modulelist' with the extra 'i' as it is more readab= le. > If you go that route, I think you can drop modulelist_t since style(9) > discourages foo_t types unless they are required by a standard. I think that this patch should make it? Thanks, Attilio Index: sys/kern/kern_module.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/kern/kern_module.c (revision 215544) +++ sys/kern/kern_module.c (working copy) @@ -46,7 +46,6 @@ static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); -typedef TAILQ_HEAD(modulelst, module) modulelist_t; struct module { TAILQ_ENTRY(module) link; /* chain together all modules */ TAILQ_ENTRY(module) flink; /* all modules in a file */ @@ -61,7 +60,7 @@ #define MOD_EVENT(mod, type) (mod)->handler((mod), (type), (mod)->arg) -static modulelist_t modules; +static TAILQ_HEAD(modulelist, module) modules; struct sx modules_sx; static int nextid =3D 1; static void module_shutdown(void *, int); @@ -101,7 +100,7 @@ return; mtx_lock(&Giant); MOD_SLOCK; - TAILQ_FOREACH_REVERSE(mod, &modules, modulelst, link) + TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link) MOD_EVENT(mod, MOD_SHUTDOWN); MOD_SUNLOCK; mtx_unlock(&Giant);