~ubuntu-branches/ubuntu/edgy/xfsprogs/edgy

« back to all changes in this revision

Viewing changes to include/xfs_ialloc.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2005-11-16 16:32:35 UTC
  • Revision ID: james.westby@ubuntu.com-20051116163235-synnef6xjj18ny42
Tags: 2.7.7-1
* New upstream release.
* Add support for (optional) ATTR2 format extension (closes: #336350)
* Allow gcc -pedantic option for C++ <xfs.h> users (closes: #249429)
* Fix segv in xfs_db frag command (closes: #338207)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
 
2
 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
 
3
 * All Rights Reserved.
3
4
 *
4
 
 * This program is free software; you can redistribute it and/or modify it
5
 
 * under the terms of version 2 of the GNU General Public License as
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License as
6
7
 * published by the Free Software Foundation.
7
8
 *
8
 
 * This program is distributed in the hope that it would be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 
 *
12
 
 * Further, this software is distributed without any warranty that it is
13
 
 * free of the rightful claim of any third person regarding infringement
14
 
 * or the like.  Any license provided herein, whether implied or
15
 
 * otherwise, applies only to this software file.  Patent licenses, if
16
 
 * any, provided herein do not apply to combinations of this program with
17
 
 * other software, or any other product whatsoever.
18
 
 *
19
 
 * You should have received a copy of the GNU General Public License along
20
 
 * with this program; if not, write the Free Software Foundation, Inc., 59
21
 
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22
 
 *
23
 
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
 
 * Mountain View, CA  94043, or:
25
 
 *
26
 
 * http://www.sgi.com
27
 
 *
28
 
 * For further information regarding this notice, see:
29
 
 *
30
 
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 
9
 * This program is distributed in the hope that it would be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write the Free Software Foundation,
 
16
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
31
17
 */
32
18
#ifndef __XFS_IALLOC_H__
33
19
#define __XFS_IALLOC_H__
40
26
/*
41
27
 * Allocation parameters for inode allocation.
42
28
 */
43
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_INODES)
44
 
int xfs_ialloc_inodes(struct xfs_mount *mp);
45
 
#define XFS_IALLOC_INODES(mp)   xfs_ialloc_inodes(mp)
46
 
#else
47
 
#define XFS_IALLOC_INODES(mp)   ((mp)->m_ialloc_inos)
48
 
#endif
49
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_BLOCKS)
50
 
xfs_extlen_t xfs_ialloc_blocks(struct xfs_mount *mp);
51
 
#define XFS_IALLOC_BLOCKS(mp)   xfs_ialloc_blocks(mp)
52
 
#else
53
 
#define XFS_IALLOC_BLOCKS(mp)   ((mp)->m_ialloc_blks)
54
 
#endif
 
29
#define XFS_IALLOC_INODES(mp)   (mp)->m_ialloc_inos
 
30
#define XFS_IALLOC_BLOCKS(mp)   (mp)->m_ialloc_blks
55
31
 
56
32
/*
57
33
 * For small block file systems, move inodes in clusters of this size.
67
43
/*
68
44
 * Make an inode pointer out of the buffer/offset.
69
45
 */
70
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_MAKE_IPTR)
71
 
struct xfs_dinode *xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o);
72
46
#define XFS_MAKE_IPTR(mp,b,o)           xfs_make_iptr(mp,b,o)
73
 
#else
74
 
#define XFS_MAKE_IPTR(mp,b,o) \
75
 
        ((xfs_dinode_t *)(xfs_buf_offset(b, (o) << (mp)->m_sb.sb_inodelog)))
76
 
#endif
 
47
static inline struct xfs_dinode *
 
48
xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
 
49
{
 
50
        return (xfs_dinode_t *)
 
51
                (xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog));
 
52
}
77
53
 
78
54
/*
79
55
 * Find a free (set) bit in the inode bitmask.
80
56
 */
81
 
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IALLOC_FIND_FREE)
82
 
int xfs_ialloc_find_free(xfs_inofree_t *fp);
83
57
#define XFS_IALLOC_FIND_FREE(fp)        xfs_ialloc_find_free(fp)
84
 
#else
85
 
#define XFS_IALLOC_FIND_FREE(fp)        xfs_lowbit64(*(fp))
86
 
#endif
 
58
static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
 
59
{
 
60
        return xfs_lowbit64(*fp);
 
61
}
87
62
 
88
63
 
89
64
#ifdef __KERNEL__
90
 
 
91
 
/*
92
 
 * Prototypes for visible xfs_ialloc.c routines.
93
 
 */
94
 
 
95
65
/*
96
66
 * Allocate an inode on disk.
97
67
 * Mode is used to tell whether the new inode will need space, and whether