summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2010-08-20 22:29:53 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2010-08-20 22:29:53 +0000
commita7b84462575de062e92b1f762aa3be2c727f4f45 (patch)
tree84961a0524cc7ab517ab5f1c96e623bc5e55c3e6 /sys
parentc4fdb193b9a4d4185ee1a97405cdca6799e033d8 (diff)
Change the UFS DIP macros to be aware of the FFS2 kernel option by not
bothering to check the mount type when FFS2 support is omitted. ok krw@, jasper@; "i like it" tedu@
Diffstat (limited to 'sys')
-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