From owner-freebsd-arch@FreeBSD.ORG Wed Jun 28 16:56:08 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D946616A4A0; Wed, 28 Jun 2006 16:56:08 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id B576D43E4B; Wed, 28 Jun 2006 16:24:17 +0000 (GMT) (envelope-from hselasky@c2i.net) X-T2-Posting-ID: gvlK0tOCzrqh9CPROFOFPw== X-Cloudmark-Score: 0.000000 [] Received: from mp-217-36-79.daxnet.no ([193.217.36.79] verified) by mailfe01.swip.net (CommuniGate Pro SMTP 5.0.8) with ESMTP id 203770555; Wed, 28 Jun 2006 18:24:13 +0200 From: Hans Petter Selasky To: freebsd-arch@freebsd.org Date: Wed, 28 Jun 2006 18:24:10 +0200 User-Agent: KMail/1.7 References: <20060627.135817.-490997979.imp@bsdimp.com> In-Reply-To: <20060627.135817.-490997979.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200606281824.13729.hselasky@c2i.net> Cc: arch@freebsd.org Subject: Re: SET, CLR, ISSET in types.h for _KERNEL builds X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2006 16:56:09 -0000 On Tuesday 27 June 2006 21:58, M. Warner Losh wrote: > NetBSD recently added SET, CLR, ISSET to sys/types.h (only if _KERNEL > is defined). I'd like to do something similar in FreeBSD. I see no > reason to needless deviate from NetBSD here. One could make an > argument for lots of different files, but at the end of the day does > it really matter enough to justify having it be different than NetBSD? > > Here's my proposed diff, inline, for your consideration: > > Index: types.h > =================================================================== > RCS file: /home/ncvs/src/sys/sys/types.h,v > retrieving revision 1.95 > diff -u -r1.95 types.h > --- types.h 26 Nov 2005 12:42:35 -0000 1.95 > +++ types.h 27 Jun 2006 19:57:23 -0000 > @@ -294,6 +294,11 @@ > > #define offsetof(type, field) __offsetof(type, field) > > +/* Macros to clear/set/test flags. */ > +#define SET(t, f) (t) |= (f) > +#define CLR(t, f) (t) &= ~(f) > +#define ISSET(t, f) ((t) & (f)) > + > #endif /* !_KERNEL */ > I am currently expanding those macros in all the USB drivers I am rewriting. --HPS