From 4a5167232c741af29d5aca8ac4e545a6c46d6f01 Mon Sep 17 00:00:00 2001 From: pooka Date: Wed, 21 Nov 2007 16:30:01 +0000 Subject: [PATCH] Add BUF_ISREAD() and BUF_ISWRITE() macros to avoid silly code checking for the B_WRITE pseudo-flag: (bp->b_flags & B_READ) == B_WRITE --- sys/sys/buf.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/sys/buf.h b/sys/sys/buf.h index c37df3df9ba2..3b8d61babd3b 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -1,4 +1,4 @@ -/* $NetBSD: buf.h,v 1.98 2007/10/08 18:04:06 ad Exp $ */ +/* $NetBSD: buf.h,v 1.99 2007/11/21 16:30:01 pooka Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -226,6 +226,10 @@ do { \ #define BC_INVAL B_INVAL #define BC_NOCACHE B_NOCACHE +/* Avoid weird code due to B_WRITE being a "pseudo flag" */ +#define BUF_ISREAD(bp) (((bp)->b_flags & B_READ) == B_READ) +#define BUF_ISWRITE(bp) (((bp)->b_flags & B_READ) == B_WRITE) + /* * This structure describes a clustered I/O. It is stored in the b_saveaddr * field of the buffer on which I/O is done. At I/O completion, cluster