Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 2010 23:45:18 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        pluknet <pluknet@gmail.com>
Cc:        svn-src-head@FreeBSD.org, Matthew D Fleming <mdf@FreeBSD.org>, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r212182 - head/sys/kern
Message-ID:  <20100906234057.O954@delplex.bde.org>
In-Reply-To: <AANLkTi=pEArHiS-V-sX=hn8v=t=9t5swOPs63BXrMgXR@mail.gmail.com>
References:  <201009031723.o83HNR7k056625@svn.freebsd.org> <AANLkTi=pEArHiS-V-sX=hn8v=t=9t5swOPs63BXrMgXR@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-78721968-1283780718=:954
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Fri, 3 Sep 2010, pluknet wrote:

> On 3 September 2010 21:23, Matthew D Fleming <mdf@freebsd.org> wrote:
>> Log:
>> =A0Fix user-space libsbuf build. =A0Why isn't CTASSERT available to
>> =A0user-space?

Well, user headers shouldn't be enlisted to check for kernel bugs that
can be checked well enough in the kernel.

>> Modified:
>> =A0head/sys/kern/subr_sbuf.c
>>
>> Modified: head/sys/kern/subr_sbuf.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/subr_sbuf.c =A0 Fri Sep =A03 16:12:39 2010 =A0 =A0 =A0=
 =A0(r212181)
>> +++ head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 17:23:26 2010 =A0 =A0 =A0=
 =A0(r212182)
>> @@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru
>>
>> =A0#endif /* _KERNEL && INVARIANTS */
>>
>> +#ifdef _KERNEL
>> =A0CTASSERT(powerof2(SBUF_MAXEXTENDSIZE));
>> =A0CTASSERT(powerof2(SBUF_MAXEXTENDINCR));
>> +#endif
>>
>> =A0static int
>> =A0sbuf_extendsize(int size)
>
> Hi,
>
> as I can see, the next (and maybe preferred) model is used in system head=
ers:
>
> #ifdef CTASSERT
> CTASSERT(...);
> #endif

Needed, even in the kernel, since CTASSERT() is only defined if the
kernel-only header <sys/systm.h> has been included.

If this macro were defined in a user header, then it would have to be
more global (probably defined in <sys/cdefs.h>) but not in the application
namespace (probably spelled __CTASSERT()), so it would be uglier.

Bruce
--0-78721968-1283780718=:954--



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