summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/ufs/inode.h49
1 files changed, 24 insertions, 25 deletions
diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h
index 1ac77c46f65..99edf4dbbf2 100644
--- a/sys/ufs/ufs/inode.h
+++ b/sys/ufs/ufs/inode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: inode.h,v 1.37 2009/01/17 18:50:25 grange Exp $ */
+/* $OpenBSD: inode.h,v 1.38 2010/08/20 22:29:52 matthew Exp $ */
/* $NetBSD: inode.h,v 1.8 1995/06/15 23:22:50 cgd Exp $ */
/*
@@ -261,45 +261,44 @@ struct inode_vtbl {
/*
* The DIP macros are used to access fields in the dinode.
*/
+
+#ifdef FFS2
#define DIP(ip, field) \
(((ip)->i_ump->um_fstype == UM_UFS1) ? \
(ip)->i_ffs1_##field : (ip)->i_ffs2_##field)
+#else
+#define DIP(ip, field) \
+ ((ip)->i_ffs1_##field)
+#endif
-#define DIP_ASSIGN(ip, field, value) \
+#ifdef FFS2
+#define DIP_OP(ip, field, op, value) \
do { \
if ((ip)->i_ump->um_fstype == UM_UFS1) \
- (ip)->i_ffs1_##field = (value); \
+ (ip)->i_ffs1_##field op (value); \
else \
- (ip)->i_ffs2_##field = (value); \
+ (ip)->i_ffs2_##field op (value); \
} while (0)
-
-#define DIP_ADD(ip, field, value) \
+#else
+#define DIP_OP(ip, field, op, value) \
do { \
- if ((ip)->i_ump->um_fstype == UM_UFS1) \
- (ip)->i_ffs1_##field += (value); \
- else \
- (ip)->i_ffs2_##field += (value); \
- } while (0)
-
-#define DIP_AND(ip, field, value) \
- do { \
- if ((ip)->i_ump->um_fstype == UM_UFS1) \
- (ip)->i_ffs1_##field &= (value); \
- else \
- (ip)->i_ffs2_##field &= (value); \
+ (ip)->i_ffs1_##field op (value); \
} while (0)
+#endif
-#define DIP_OR(ip, field, value) \
- do { \
- if ((ip)->i_ump->um_fstype == UM_UFS1) \
- (ip)->i_ffs1_##field |= (value); \
- else \
- (ip)->i_ffs2_##field |= (value); \
- } while (0)
+#define DIP_ASSIGN(ip, field, value) DIP_OP(ip, field, =, value)
+#define DIP_ADD(ip, field, value) DIP_OP(ip, field, +=, value)
+#define DIP_AND(ip, field, value) DIP_OP(ip, field, &=, value)
+#define DIP_OR(ip, field, value) DIP_OP(ip, field, |=, value)
+#ifdef FFS2
#define SHORTLINK(ip) \
(((ip)->i_ump->um_fstype == UM_UFS1) ? \
(caddr_t)(ip)->i_ffs1_db : (caddr_t)(ip)->i_ffs2_db)
+#else
+#define SHORTLINK(ip) \
+ ((caddr_t)(ip)->i_ffs1_db)
+#endif
/*
* Structure used to pass around logical block paths generated by