diff options
Diffstat (limited to 'fs/xfs/xfs_dinode.h')
-rw-r--r-- | fs/xfs/xfs_dinode.h | 205 |
1 files changed, 28 insertions, 177 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index f5c932b064e6..c5a0e537ff1a 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h @@ -1,33 +1,19 @@ /* - * Copyright (c) 2000, 2002 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. + * All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * This program is distributed in the hope that it would be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * Further, this software is distributed without any warranty that it is - * free of the rightful claim of any third person regarding infringement - * or the like. Any license provided herein, whether implied or - * otherwise, applies only to this software file. Patent licenses, if - * any, provided herein do not apply to combinations of this program with - * other software, or any other product whatsoever. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, - * Mountain View, CA 94043, or: - * - * http://www.sgi.com - * - * For further information regarding this notice, see: - * - * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + * You should have received a copy of the GNU General Public License + * along with this program; if not, write the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_DINODE_H__ #define __XFS_DINODE_H__ @@ -37,13 +23,8 @@ struct xfs_mount; #define XFS_DINODE_VERSION_1 1 #define XFS_DINODE_VERSION_2 2 -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DINODE_GOOD_VERSION) -int xfs_dinode_good_version(int v); -#define XFS_DINODE_GOOD_VERSION(v) xfs_dinode_good_version(v) -#else -#define XFS_DINODE_GOOD_VERSION(v) (((v) == XFS_DINODE_VERSION_1) || \ - ((v) == XFS_DINODE_VERSION_2)) -#endif +#define XFS_DINODE_GOOD_VERSION(v) \ + (((v) == XFS_DINODE_VERSION_1 || (v) == XFS_DINODE_VERSION_2)) #define XFS_DINODE_MAGIC 0x494e /* 'IN' */ /* @@ -184,75 +165,30 @@ typedef enum xfs_dinode_fmt /* * Inode size for given fs. */ -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_LITINO) -int xfs_litino(struct xfs_mount *mp); -#define XFS_LITINO(mp) xfs_litino(mp) -#else #define XFS_LITINO(mp) ((mp)->m_litino) -#endif #define XFS_BROOT_SIZE_ADJ \ (sizeof(xfs_bmbt_block_t) - sizeof(xfs_bmdr_block_t)) /* - * Fork identifiers. Here so utilities can use them without including - * xfs_inode.h. - */ -#define XFS_DATA_FORK 0 -#define XFS_ATTR_FORK 1 - -/* * Inode data & attribute fork sizes, per inode. */ -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_Q) -int xfs_cfork_q_disk(xfs_dinode_core_t *dcp); -int xfs_cfork_q(xfs_dinode_core_t *dcp); -#define XFS_CFORK_Q_DISK(dcp) xfs_cfork_q_disk(dcp) -#define XFS_CFORK_Q(dcp) xfs_cfork_q(dcp) -#else -#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) #define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) +#define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_BOFF) -int xfs_cfork_boff_disk(xfs_dinode_core_t *dcp); -int xfs_cfork_boff(xfs_dinode_core_t *dcp); -#define XFS_CFORK_BOFF_DISK(dcp) xfs_cfork_boff_disk(dcp) -#define XFS_CFORK_BOFF(dcp) xfs_cfork_boff(dcp) -#else -#define XFS_CFORK_BOFF_DISK(dcp) ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3)) #define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) +#define XFS_CFORK_BOFF_DISK(dcp) \ + ((int)(INT_GET((dcp)->di_forkoff, ARCH_CONVERT) << 3)) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_DSIZE) -int xfs_cfork_dsize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -int xfs_cfork_dsize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -#define XFS_CFORK_DSIZE_DISK(dcp,mp) xfs_cfork_dsize_disk(dcp,mp) -#define XFS_CFORK_DSIZE(dcp,mp) xfs_cfork_dsize(dcp,mp) -#else #define XFS_CFORK_DSIZE_DISK(dcp,mp) \ (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) #define XFS_CFORK_DSIZE(dcp,mp) \ (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_ASIZE) -int xfs_cfork_asize_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -int xfs_cfork_asize(xfs_dinode_core_t *dcp, struct xfs_mount *mp); -#define XFS_CFORK_ASIZE_DISK(dcp,mp) xfs_cfork_asize_disk(dcp,mp) -#define XFS_CFORK_ASIZE(dcp,mp) xfs_cfork_asize(dcp,mp) -#else #define XFS_CFORK_ASIZE_DISK(dcp,mp) \ (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) #define XFS_CFORK_ASIZE(dcp,mp) \ (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_SIZE) -int xfs_cfork_size_disk(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); -int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); -#define XFS_CFORK_SIZE_DISK(dcp,mp,w) xfs_cfork_size_disk(dcp,mp,w) -#define XFS_CFORK_SIZE(dcp,mp,w) xfs_cfork_size(dcp,mp,w) -#else #define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ ((w) == XFS_DATA_FORK ? \ XFS_CFORK_DSIZE_DISK(dcp, mp) : \ @@ -261,93 +197,26 @@ int xfs_cfork_size(xfs_dinode_core_t *dcp, struct xfs_mount *mp, int w); ((w) == XFS_DATA_FORK ? \ XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) -#endif - -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DSIZE) -int xfs_dfork_dsize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_DSIZE(dip,mp) xfs_dfork_dsize(dip,mp) -#else -#define XFS_DFORK_DSIZE(dip,mp) XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_ASIZE) -int xfs_dfork_asize(xfs_dinode_t *dip, struct xfs_mount *mp); -#define XFS_DFORK_ASIZE(dip,mp) xfs_dfork_asize(dip,mp) -#else -#define XFS_DFORK_ASIZE(dip,mp) XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp) +#define XFS_DFORK_DSIZE(dip,mp) \ + XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp) +#define XFS_DFORK_ASIZE(dip,mp) \ + XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp) +#define XFS_DFORK_SIZE(dip,mp,w) \ + XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_SIZE) -int xfs_dfork_size(xfs_dinode_t *dip, struct xfs_mount *mp, int w); -#define XFS_DFORK_SIZE(dip,mp,w) xfs_dfork_size(dip,mp,w) -#else -#define XFS_DFORK_SIZE(dip,mp,w) XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w) - -#endif - -/* - * Macros for accessing per-fork disk inode information. - */ -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_Q) -int xfs_dfork_q(xfs_dinode_t *dip); -#define XFS_DFORK_Q(dip) xfs_dfork_q(dip) -#else #define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_BOFF) -int xfs_dfork_boff(xfs_dinode_t *dip); -#define XFS_DFORK_BOFF(dip) xfs_dfork_boff(dip) -#else #define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_DPTR) -char *xfs_dfork_dptr(xfs_dinode_t *dip); -#define XFS_DFORK_DPTR(dip) xfs_dfork_dptr(dip) -#else #define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_APTR) -char *xfs_dfork_aptr(xfs_dinode_t *dip); -#define XFS_DFORK_APTR(dip) xfs_dfork_aptr(dip) -#else -#define XFS_DFORK_APTR(dip) ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_PTR) -char *xfs_dfork_ptr(xfs_dinode_t *dip, int w); -#define XFS_DFORK_PTR(dip,w) xfs_dfork_ptr(dip,w) -#else +#define XFS_DFORK_APTR(dip) \ + ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) #define XFS_DFORK_PTR(dip,w) \ ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FORMAT) -int xfs_cfork_format(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_FORMAT(dcp,w) xfs_cfork_format(dcp,w) -#else -#define XFS_CFORK_FORMAT(dcp,w) \ +#define XFS_CFORK_FORMAT(dcp,w) \ ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat) - -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_FMT_SET) -void xfs_cfork_fmt_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_FMT_SET(dcp,w,n) xfs_cfork_fmt_set(dcp,w,n) -#else #define XFS_CFORK_FMT_SET(dcp,w,n) \ ((w) == XFS_DATA_FORK ? \ - ((dcp)->di_format = (n)) : \ - ((dcp)->di_aformat = (n))) + ((dcp)->di_format = (n)) : ((dcp)->di_aformat = (n))) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXTENTS) -int xfs_cfork_nextents_disk(xfs_dinode_core_t *dcp, int w); -int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w); -#define XFS_CFORK_NEXTENTS_DISK(dcp,w) xfs_cfork_nextents_disk(dcp,w) -#define XFS_CFORK_NEXTENTS(dcp,w) xfs_cfork_nextents(dcp,w) -#else #define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ ((w) == XFS_DATA_FORK ? \ INT_GET((dcp)->di_nextents, ARCH_CONVERT) : \ @@ -355,31 +224,13 @@ int xfs_cfork_nextents(xfs_dinode_core_t *dcp, int w); #define XFS_CFORK_NEXTENTS(dcp,w) \ ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_CFORK_NEXT_SET) -void xfs_cfork_next_set(xfs_dinode_core_t *dcp, int w, int n); -#define XFS_CFORK_NEXT_SET(dcp,w,n) xfs_cfork_next_set(dcp,w,n) -#else #define XFS_CFORK_NEXT_SET(dcp,w,n) \ ((w) == XFS_DATA_FORK ? \ - ((dcp)->di_nextents = (n)) : \ - ((dcp)->di_anextents = (n))) - -#endif + ((dcp)->di_nextents = (n)) : ((dcp)->di_anextents = (n))) -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DFORK_NEXTENTS) -int xfs_dfork_nextents(xfs_dinode_t *dip, int w); -#define XFS_DFORK_NEXTENTS(dip,w) xfs_dfork_nextents(dip,w) -#else #define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) -#endif -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE) -xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp); -#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp) -#else -#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)(XFS_BUF_PTR(bp))) -#endif +#define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) /* * Values for di_flags |