From a7b84462575de062e92b1f762aa3be2c727f4f45 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Fri, 20 Aug 2010 22:29:53 +0000 Subject: 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@ --- sys/ufs/ufs/inode.h | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'sys') 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 -- cgit v1.2.3