Make UFS DIP macros FFS2-option aware

Previous thread: Arquitectura CURSO INTENSIVO Herramientas para Emprendedores DISEÃ'O y PRESUPUESTO by AGOSTO Eseade -NAyC on Thursday, August 19, 2010 - 3:51 pm. (1 message)

Next thread: Make hzto(9) and tvtohz(9) timeval parameter const by Matthew Dempsky on Friday, August 20, 2010 - 4:46 am. (1 message)
From: Matthew Dempsky
Date: Friday, August 20, 2010 - 4:13 am

The diff below changes the UFS DIP macros to only check for UFS1 vs
UFS2 when the FFS2 compile option is actually enabled.  There's no
binary change when FFS2 is enabled, and it shrinks a non-FFS2 amd64
kernel by about 8KB and still works with my FFS1 filesystem.

ok?

Index: inode.h
===================================================================
RCS file: /cvs/src/sys/ufs/ufs/inode.h,v
retrieving revision 1.37
diff -u -p -r1.37 inode.h
--- inode.h	17 Jan 2009 18:50:25 -0000	1.37
+++ inode.h	20 Aug 2010 11:06:01 -0000
@@ -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);		\
+		(ip)->i_ffs1_##field op (value);			\
 	} while (0)
+#endif
 
-#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);		\
-	} while (0)
-
-#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, ...
Previous thread: Arquitectura CURSO INTENSIVO Herramientas para Emprendedores DISEÃ'O y PRESUPUESTO by AGOSTO Eseade -NAyC on Thursday, August 19, 2010 - 3:51 pm. (1 message)

Next thread: Make hzto(9) and tvtohz(9) timeval parameter const by Matthew Dempsky on Friday, August 20, 2010 - 4:46 am. (1 message)