From owner-freebsd-arch@FreeBSD.ORG Tue Jun 27 20:57:10 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 0EAA716A535 for ; Tue, 27 Jun 2006 20:57:10 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id A726845587 for ; Tue, 27 Jun 2006 19:59:27 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [IPv6:::1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k5RJwEh3025202 for ; Tue, 27 Jun 2006 13:58:14 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 27 Jun 2006 13:58:17 -0600 (MDT) Message-Id: <20060627.135817.-490997979.imp@bsdimp.com> To: arch@freebsd.org From: "M. Warner Losh" X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Subject: 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: Tue, 27 Jun 2006 20:57:10 -0000 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 */ /* NOTE: That /* !_KERNEL */ should have the '!' removed, but I didn't want to confuse things by doing that too. Comments? Warner