Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Apr 2003 22:25:57 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        arch@freebsd.org
Subject:   Re: #include <sys/lock.h> and <sys/mutex.h>
Message-ID:  <20030401222002.S22396@gamplex.bde.org>
In-Reply-To: <31464.1049185350@critter.freebsd.dk>
References:  <31464.1049185350@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 1 Apr 2003, Poul-Henning Kamp wrote:

> As we progress down the path of SMPng we will need to include
> <sys/lock.h> and <sys/mutex.h> in more and more files.
>
> The current score, not counting nested include cases, they currently
> are included approx 16% and 19% of all .c files under /sys.
>
> My present predicament is that I will probably put a mutex in the
> bio queue which is defined in <sys/bio.h>, and so far, I've found
> 20 .c files where I need to add <sys/lock.h> and <sys/mutex.h> and
> I am not yet at a point where LINT compiles.
>
> Do we have a plan for these in the future ?  I can see three obvious
> options:

We've mostly followed this plan for the last 23 months:

% RCS file: /home/ncvs/src/sys/sys/_mutex.h,v
% Working file: _mutex.h
% head: 1.9
% ...
% ----------------------------
% revision 1.1
% date: 2001/05/01 08:13:17;  author: markm;  state: Exp;
% Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
% other "system" header files.
%
% Also help the deprecation of lockmgr.h by making it a sub-include of
% sys/lock.h and removing sys/lockmgr.h form kernel .c files.
%
% Sort sys/*.h includes where possible in affected files.
%
% OK'ed by:	bde (with reservations)
% ----------------------------

*.h should include <sys/_mutex.h> and its prerequisite <sys/_mutex.h> if
any mutexes are declared, and *.c should include <sys/mutex.h> and its
prerequisite <sys/mutex.h> if any mutext is used (other than to assign it).
*.h may hide some of the details using macros like PROC_LOCK(), but should
not include primary headers like <sys/mutex.h> to do so.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030401222002.S22396>