Re: SET, CLR, ISSET in types.h for _KERNEL builds
- From: Hans Petter Selasky <hselasky@xxxxxxx>
- Date: Wed, 28 Jun 2006 18:24:10 +0200
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
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"
- References:
- SET, CLR, ISSET in types.h for _KERNEL builds
- From: M. Warner Losh
- SET, CLR, ISSET in types.h for _KERNEL builds
- Prev by Date: Re: SET, CLR, ISSET in types.h for _KERNEL builds
- Next by Date: Re: SET, CLR, ISSET in types.h for _KERNEL builds
- Previous by thread: Re: SET, CLR, ISSET in types.h for _KERNEL builds
- Index(es):
Relevant Pages
|