2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
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
6
* published by the Free Software Foundation.
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.
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.
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.
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
44
static int bmapbta_key_count(void *obj, int startoff);
45
static int bmapbta_key_offset(void *obj, int startoff, int idx);
46
static int bmapbta_ptr_count(void *obj, int startoff);
47
static int bmapbta_ptr_offset(void *obj, int startoff, int idx);
48
static int bmapbta_rec_count(void *obj, int startoff);
49
static int bmapbta_rec_offset(void *obj, int startoff, int idx);
50
static int bmapbtd_key_count(void *obj, int startoff);
51
static int bmapbtd_key_offset(void *obj, int startoff, int idx);
52
static int bmapbtd_ptr_count(void *obj, int startoff);
53
static int bmapbtd_ptr_offset(void *obj, int startoff, int idx);
54
static int bmapbtd_rec_count(void *obj, int startoff);
55
static int bmapbtd_rec_offset(void *obj, int startoff, int idx);
57
const field_t bmapbta_hfld[] = {
58
{ "", FLDT_BMAPBTA, OI(0), C1, 0, TYP_NONE },
61
const field_t bmapbtd_hfld[] = {
62
{ "", FLDT_BMAPBTD, OI(0), C1, 0, TYP_NONE },
66
#define OFF(f) bitize(offsetof(xfs_bmbt_block_t, bb_ ## f))
67
const field_t bmapbta_flds[] = {
68
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
69
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
70
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
71
{ "leftsib", FLDT_DFSBNO, OI(OFF(leftsib)), C1, 0, TYP_BMAPBTA },
72
{ "rightsib", FLDT_DFSBNO, OI(OFF(rightsib)), C1, 0, TYP_BMAPBTA },
73
{ "recs", FLDT_BMAPBTAREC, bmapbta_rec_offset, bmapbta_rec_count,
74
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
75
{ "keys", FLDT_BMAPBTAKEY, bmapbta_key_offset, bmapbta_key_count,
76
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
77
{ "ptrs", FLDT_BMAPBTAPTR, bmapbta_ptr_offset, bmapbta_ptr_count,
78
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTA },
81
const field_t bmapbtd_flds[] = {
82
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
83
{ "level", FLDT_UINT16D, OI(OFF(level)), C1, 0, TYP_NONE },
84
{ "numrecs", FLDT_UINT16D, OI(OFF(numrecs)), C1, 0, TYP_NONE },
85
{ "leftsib", FLDT_DFSBNO, OI(OFF(leftsib)), C1, 0, TYP_BMAPBTD },
86
{ "rightsib", FLDT_DFSBNO, OI(OFF(rightsib)), C1, 0, TYP_BMAPBTD },
87
{ "recs", FLDT_BMAPBTDREC, bmapbtd_rec_offset, bmapbtd_rec_count,
88
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
89
{ "keys", FLDT_BMAPBTDKEY, bmapbtd_key_offset, bmapbtd_key_count,
90
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
91
{ "ptrs", FLDT_BMAPBTDPTR, bmapbtd_ptr_offset, bmapbtd_ptr_count,
92
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_BMAPBTD },
96
#define KOFF(f) bitize(offsetof(xfs_bmbt_key_t, br_ ## f))
97
const field_t bmapbta_key_flds[] = {
98
{ "startoff", FLDT_DFILOFFA, OI(KOFF(startoff)), C1, 0, TYP_ATTR },
101
const field_t bmapbtd_key_flds[] = {
102
{ "startoff", FLDT_DFILOFFD, OI(KOFF(startoff)), C1, 0, TYP_INODATA },
106
const field_t bmapbta_rec_flds[] = {
107
{ "startoff", FLDT_CFILEOFFA, OI(BMBT_STARTOFF_BITOFF), C1, 0,
109
{ "startblock", FLDT_CFSBLOCK, OI(BMBT_STARTBLOCK_BITOFF), C1, 0,
111
{ "blockcount", FLDT_CEXTLEN, OI(BMBT_BLOCKCOUNT_BITOFF), C1, 0,
113
{ "extentflag", FLDT_CEXTFLG, OI(BMBT_EXNTFLAG_BITOFF), C1, 0,
117
const field_t bmapbtd_rec_flds[] = {
118
{ "startoff", FLDT_CFILEOFFD, OI(BMBT_STARTOFF_BITOFF), C1, 0,
120
{ "startblock", FLDT_CFSBLOCK, OI(BMBT_STARTBLOCK_BITOFF), C1, 0,
122
{ "blockcount", FLDT_CEXTLEN, OI(BMBT_BLOCKCOUNT_BITOFF), C1, 0,
124
{ "extentflag", FLDT_CEXTFLG, OI(BMBT_EXNTFLAG_BITOFF), C1, 0,
134
xfs_bmbt_block_t *block;
136
ASSERT(startoff == 0);
138
if (INT_GET(block->bb_level, ARCH_CONVERT) == 0)
140
return INT_GET(block->bb_numrecs, ARCH_CONVERT);
149
xfs_bmbt_block_t *block;
152
ASSERT(startoff == 0);
154
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
155
kp = XFS_BTREE_KEY_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, idx,
156
XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_bmbt, 0));
157
return bitize((int)((char *)kp - (char *)block));
165
xfs_bmbt_block_t *block;
167
ASSERT(startoff == 0);
169
if (INT_GET(block->bb_level, ARCH_CONVERT) == 0)
171
return INT_GET(block->bb_numrecs, ARCH_CONVERT);
180
xfs_bmbt_block_t *block;
183
ASSERT(startoff == 0);
185
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
186
pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, idx,
187
XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_bmbt, 0));
188
return bitize((int)((char *)pp - (char *)block));
196
xfs_bmbt_block_t *block;
198
ASSERT(startoff == 0);
200
if (INT_GET(block->bb_level, ARCH_CONVERT) > 0)
202
return INT_GET(block->bb_numrecs, ARCH_CONVERT);
211
xfs_bmbt_block_t *block;
214
ASSERT(startoff == 0);
216
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) == 0);
217
rp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, idx,
218
XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_bmbt, 1));
219
return bitize((int)((char *)rp - (char *)block));
228
return bitize(mp->m_sb.sb_blocksize);
236
xfs_bmbt_block_t *block;
238
ASSERT(startoff == 0);
240
if (INT_GET(block->bb_level, ARCH_CONVERT) == 0)
242
return INT_GET(block->bb_numrecs, ARCH_CONVERT);
251
xfs_bmbt_block_t *block;
254
ASSERT(startoff == 0);
256
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
257
kp = XFS_BTREE_KEY_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, idx,
258
XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_bmbt, 0));
259
return bitize((int)((char *)kp - (char *)block));
267
xfs_bmbt_block_t *block;
269
ASSERT(startoff == 0);
271
if (INT_GET(block->bb_level, ARCH_CONVERT) == 0)
273
return INT_GET(block->bb_numrecs, ARCH_CONVERT);
282
xfs_bmbt_block_t *block;
285
ASSERT(startoff == 0);
287
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) > 0);
288
pp = XFS_BTREE_PTR_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, idx,
289
XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_bmbt, 0));
290
return bitize((int)((char *)pp - (char *)block));
298
xfs_bmbt_block_t *block;
300
ASSERT(startoff == 0);
302
if (INT_GET(block->bb_level, ARCH_CONVERT) > 0)
304
return INT_GET(block->bb_numrecs, ARCH_CONVERT);
313
xfs_bmbt_block_t *block;
316
ASSERT(startoff == 0);
318
ASSERT(INT_GET(block->bb_level, ARCH_CONVERT) == 0);
319
rp = XFS_BTREE_REC_ADDR(mp->m_sb.sb_blocksize, xfs_bmbt, block, idx,
320
XFS_BTREE_BLOCK_MAXRECS(mp->m_sb.sb_blocksize, xfs_bmbt, 1));
321
return bitize((int)((char *)rp - (char *)block));
330
return bitize(mp->m_sb.sb_blocksize);