OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [xfs/] [xfs_inum.h] - Diff between revs 1275 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1275 Rev 1765
/*
/*
 * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
 * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify it
 * 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
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 * published by the Free Software Foundation.
 *
 *
 * This program is distributed in the hope that it would be useful, but
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * Further, this software is distributed without any warranty that it is
 * Further, this software is distributed without any warranty that it is
 * free of the rightful claim of any third person regarding infringement
 * free of the rightful claim of any third person regarding infringement
 * or the like.  Any license provided herein, whether implied or
 * or the like.  Any license provided herein, whether implied or
 * otherwise, applies only to this software file.  Patent licenses, if
 * otherwise, applies only to this software file.  Patent licenses, if
 * any, provided herein do not apply to combinations of this program with
 * any, provided herein do not apply to combinations of this program with
 * other software, or any other product whatsoever.
 * other software, or any other product whatsoever.
 *
 *
 * You should have received a copy of the GNU General Public License along
 * 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
 * with this program; if not, write the Free Software Foundation, Inc., 59
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
 *
 *
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Mountain View, CA  94043, or:
 * Mountain View, CA  94043, or:
 *
 *
 * http://www.sgi.com
 * http://www.sgi.com
 *
 *
 * For further information regarding this notice, see:
 * For further information regarding this notice, see:
 *
 *
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 */
 */
#ifndef __XFS_INUM_H__
#ifndef __XFS_INUM_H__
#define __XFS_INUM_H__
#define __XFS_INUM_H__
 
 
/*
/*
 * Inode number format:
 * Inode number format:
 * low inopblog bits - offset in block
 * low inopblog bits - offset in block
 * next agblklog bits - block number in ag
 * next agblklog bits - block number in ag
 * next agno_log bits - ag number
 * next agno_log bits - ag number
 * high agno_log-agblklog-inopblog bits - 0
 * high agno_log-agblklog-inopblog bits - 0
 */
 */
 
 
typedef __uint32_t      xfs_agino_t;    /* within allocation grp inode number */
typedef __uint32_t      xfs_agino_t;    /* within allocation grp inode number */
 
 
/*
/*
 * Useful inode bits for this kernel.
 * Useful inode bits for this kernel.
 * Used in some places where having 64-bits in the 32-bit kernels
 * Used in some places where having 64-bits in the 32-bit kernels
 * costs too much.
 * costs too much.
 */
 */
#if XFS_BIG_INUMS
#if XFS_BIG_INUMS
typedef xfs_ino_t       xfs_intino_t;
typedef xfs_ino_t       xfs_intino_t;
#else
#else
typedef __uint32_t      xfs_intino_t;
typedef __uint32_t      xfs_intino_t;
#endif
#endif
 
 
#define NULLFSINO       ((xfs_ino_t)-1)
#define NULLFSINO       ((xfs_ino_t)-1)
#define NULLAGINO       ((xfs_agino_t)-1)
#define NULLAGINO       ((xfs_agino_t)-1)
 
 
struct xfs_mount;
struct xfs_mount;
 
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_MASK)
__uint32_t xfs_ino_mask(int k);
__uint32_t xfs_ino_mask(int k);
#define XFS_INO_MASK(k)                 xfs_ino_mask(k)
#define XFS_INO_MASK(k)                 xfs_ino_mask(k)
#else
#else
#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1))
#define XFS_INO_MASK(k) ((__uint32_t)((1ULL << (k)) - 1))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_OFFSET_BITS)
int xfs_ino_offset_bits(struct xfs_mount *mp);
int xfs_ino_offset_bits(struct xfs_mount *mp);
#define XFS_INO_OFFSET_BITS(mp)         xfs_ino_offset_bits(mp)
#define XFS_INO_OFFSET_BITS(mp)         xfs_ino_offset_bits(mp)
#else
#else
#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog)
#define XFS_INO_OFFSET_BITS(mp) ((mp)->m_sb.sb_inopblog)
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGBNO_BITS)
int xfs_ino_agbno_bits(struct xfs_mount *mp);
int xfs_ino_agbno_bits(struct xfs_mount *mp);
#define XFS_INO_AGBNO_BITS(mp)          xfs_ino_agbno_bits(mp)
#define XFS_INO_AGBNO_BITS(mp)          xfs_ino_agbno_bits(mp)
#else
#else
#define XFS_INO_AGBNO_BITS(mp)  ((mp)->m_sb.sb_agblklog)
#define XFS_INO_AGBNO_BITS(mp)  ((mp)->m_sb.sb_agblklog)
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGINO_BITS)
int xfs_ino_agino_bits(struct xfs_mount *mp);
int xfs_ino_agino_bits(struct xfs_mount *mp);
#define XFS_INO_AGINO_BITS(mp)          xfs_ino_agino_bits(mp)
#define XFS_INO_AGINO_BITS(mp)          xfs_ino_agino_bits(mp)
#else
#else
#define XFS_INO_AGINO_BITS(mp)          ((mp)->m_agino_log)
#define XFS_INO_AGINO_BITS(mp)          ((mp)->m_agino_log)
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_AGNO_BITS)
int xfs_ino_agno_bits(struct xfs_mount *mp);
int xfs_ino_agno_bits(struct xfs_mount *mp);
#define XFS_INO_AGNO_BITS(mp)           xfs_ino_agno_bits(mp)
#define XFS_INO_AGNO_BITS(mp)           xfs_ino_agno_bits(mp)
#else
#else
#define XFS_INO_AGNO_BITS(mp)   ((mp)->m_agno_log)
#define XFS_INO_AGNO_BITS(mp)   ((mp)->m_agno_log)
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_BITS)
int xfs_ino_bits(struct xfs_mount *mp);
int xfs_ino_bits(struct xfs_mount *mp);
#define XFS_INO_BITS(mp)                xfs_ino_bits(mp)
#define XFS_INO_BITS(mp)                xfs_ino_bits(mp)
#else
#else
#define XFS_INO_BITS(mp)        (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp))
#define XFS_INO_BITS(mp)        (XFS_INO_AGNO_BITS(mp) + XFS_INO_AGINO_BITS(mp))
#endif
#endif
 
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGNO)
xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i);
xfs_agnumber_t xfs_ino_to_agno(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_AGNO(mp,i)           xfs_ino_to_agno(mp,i)
#define XFS_INO_TO_AGNO(mp,i)           xfs_ino_to_agno(mp,i)
#else
#else
#define XFS_INO_TO_AGNO(mp,i)   \
#define XFS_INO_TO_AGNO(mp,i)   \
        ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
        ((xfs_agnumber_t)((i) >> XFS_INO_AGINO_BITS(mp)))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGINO)
xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i);
xfs_agino_t xfs_ino_to_agino(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_AGINO(mp,i)          xfs_ino_to_agino(mp,i)
#define XFS_INO_TO_AGINO(mp,i)          xfs_ino_to_agino(mp,i)
#else
#else
#define XFS_INO_TO_AGINO(mp,i)  \
#define XFS_INO_TO_AGINO(mp,i)  \
        ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
        ((xfs_agino_t)(i) & XFS_INO_MASK(XFS_INO_AGINO_BITS(mp)))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_AGBNO)
xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i);
xfs_agblock_t xfs_ino_to_agbno(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_AGBNO(mp,i)          xfs_ino_to_agbno(mp,i)
#define XFS_INO_TO_AGBNO(mp,i)          xfs_ino_to_agbno(mp,i)
#else
#else
#define XFS_INO_TO_AGBNO(mp,i)  \
#define XFS_INO_TO_AGBNO(mp,i)  \
        (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
        (((xfs_agblock_t)(i) >> XFS_INO_OFFSET_BITS(mp)) & \
         XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
         XFS_INO_MASK(XFS_INO_AGBNO_BITS(mp)))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_OFFSET)
int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i);
int xfs_ino_to_offset(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_OFFSET(mp,i)         xfs_ino_to_offset(mp,i)
#define XFS_INO_TO_OFFSET(mp,i)         xfs_ino_to_offset(mp,i)
#else
#else
#define XFS_INO_TO_OFFSET(mp,i) \
#define XFS_INO_TO_OFFSET(mp,i) \
        ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
        ((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INO_TO_FSB)
xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i);
xfs_fsblock_t xfs_ino_to_fsb(struct xfs_mount *mp, xfs_ino_t i);
#define XFS_INO_TO_FSB(mp,i)            xfs_ino_to_fsb(mp,i)
#define XFS_INO_TO_FSB(mp,i)            xfs_ino_to_fsb(mp,i)
#else
#else
#define XFS_INO_TO_FSB(mp,i)    \
#define XFS_INO_TO_FSB(mp,i)    \
        XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
        XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
#endif
#endif
 
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_INO)
xfs_ino_t
xfs_ino_t
xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i);
xfs_agino_to_ino(struct xfs_mount *mp, xfs_agnumber_t a, xfs_agino_t i);
#define XFS_AGINO_TO_INO(mp,a,i)        xfs_agino_to_ino(mp,a,i)
#define XFS_AGINO_TO_INO(mp,a,i)        xfs_agino_to_ino(mp,a,i)
#else
#else
#define XFS_AGINO_TO_INO(mp,a,i)        \
#define XFS_AGINO_TO_INO(mp,a,i)        \
        (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
        (((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_AGBNO)
xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i);
xfs_agblock_t xfs_agino_to_agbno(struct xfs_mount *mp, xfs_agino_t i);
#define XFS_AGINO_TO_AGBNO(mp,i)        xfs_agino_to_agbno(mp,i)
#define XFS_AGINO_TO_AGBNO(mp,i)        xfs_agino_to_agbno(mp,i)
#else
#else
#define XFS_AGINO_TO_AGBNO(mp,i)        ((i) >> XFS_INO_OFFSET_BITS(mp))
#define XFS_AGINO_TO_AGBNO(mp,i)        ((i) >> XFS_INO_OFFSET_BITS(mp))
#endif
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_AGINO_TO_OFFSET)
int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i);
int xfs_agino_to_offset(struct xfs_mount *mp, xfs_agino_t i);
#define XFS_AGINO_TO_OFFSET(mp,i)       xfs_agino_to_offset(mp,i)
#define XFS_AGINO_TO_OFFSET(mp,i)       xfs_agino_to_offset(mp,i)
#else
#else
#define XFS_AGINO_TO_OFFSET(mp,i)       \
#define XFS_AGINO_TO_OFFSET(mp,i)       \
        ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
        ((i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#endif
#endif
 
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_OFFBNO_TO_AGINO)
xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o);
xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o);
#define XFS_OFFBNO_TO_AGINO(mp,b,o)     xfs_offbno_to_agino(mp,b,o)
#define XFS_OFFBNO_TO_AGINO(mp,b,o)     xfs_offbno_to_agino(mp,b,o)
#else
#else
#define XFS_OFFBNO_TO_AGINO(mp,b,o)     \
#define XFS_OFFBNO_TO_AGINO(mp,b,o)     \
        ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
        ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
#endif
#endif
 
 
#if XFS_BIG_INUMS
#if XFS_BIG_INUMS
#define XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 56) - 1ULL))
#define XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 56) - 1ULL))
#define XFS_INO64_OFFSET        ((xfs_ino_t)(1ULL << 32))
#define XFS_INO64_OFFSET        ((xfs_ino_t)(1ULL << 32))
#else
#else
#define XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 32) - 1ULL))
#define XFS_MAXINUMBER          ((xfs_ino_t)((1ULL << 32) - 1ULL))
#endif
#endif
#define XFS_MAXINUMBER_32       ((xfs_ino_t)((1ULL << 32) - 1ULL))
#define XFS_MAXINUMBER_32       ((xfs_ino_t)((1ULL << 32) - 1ULL))
 
 
#endif  /* __XFS_INUM_H__ */
#endif  /* __XFS_INUM_H__ */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.