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/
41
static int dir2_inou_i4_count(void *obj, int startoff);
42
static int dir2_inou_i8_count(void *obj, int startoff);
43
static int dir2_sf_entry_inumber_offset(void *obj, int startoff, int idx);
44
static int dir2_sf_entry_name_count(void *obj, int startoff);
45
static int dir2_sf_list_count(void *obj, int startoff);
46
static int dir2_sf_list_offset(void *obj, int startoff, int idx);
48
#define OFF(f) bitize(offsetof(xfs_dir2_sf_t, f))
49
const field_t dir2sf_flds[] = {
50
{ "hdr", FLDT_DIR2_SF_HDR, OI(OFF(hdr)), C1, 0, TYP_NONE },
51
{ "list", FLDT_DIR2_SF_ENTRY, dir2_sf_list_offset, dir2_sf_list_count,
52
FLD_ARRAY|FLD_COUNT|FLD_OFFSET, TYP_NONE },
56
#define UOFF(f) bitize(offsetof(xfs_dir2_inou_t, f))
57
const field_t dir2_inou_flds[] = {
58
{ "i8", FLDT_DIR2_INO8, OI(UOFF(i8)), dir2_inou_i8_count, FLD_COUNT,
60
{ "i4", FLDT_DIR2_INO4, OI(UOFF(i4)), dir2_inou_i4_count, FLD_COUNT,
65
#define HOFF(f) bitize(offsetof(xfs_dir2_sf_hdr_t, f))
66
const field_t dir2_sf_hdr_flds[] = {
67
{ "count", FLDT_UINT8D, OI(HOFF(count)), C1, 0, TYP_NONE },
68
{ "i8count", FLDT_UINT8D, OI(HOFF(i8count)), C1, 0, TYP_NONE },
69
{ "parent", FLDT_DIR2_INOU, OI(HOFF(parent)), C1, 0, TYP_NONE },
73
#define EOFF(f) bitize(offsetof(xfs_dir2_sf_entry_t, f))
74
const field_t dir2_sf_entry_flds[] = {
75
{ "namelen", FLDT_UINT8D, OI(EOFF(namelen)), C1, 0, TYP_NONE },
76
{ "offset", FLDT_DIR2_SF_OFF, OI(EOFF(offset)), C1, 0, TYP_NONE },
77
{ "name", FLDT_CHARNS, OI(EOFF(name)), dir2_sf_entry_name_count,
78
FLD_COUNT, TYP_NONE },
79
{ "inumber", FLDT_DIR2_INOU, dir2_sf_entry_inumber_offset, C1,
80
FLD_OFFSET, TYP_NONE },
92
ASSERT(bitoffs(startoff) == 0);
93
sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf;
94
return sf->hdr.i8count == 0;
105
ASSERT(bitoffs(startoff) == 0);
106
sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf;
107
return sf->hdr.i8count != 0;
119
ASSERT(bitoffs(startoff) == 0);
121
sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf;
122
return bitize(sf->hdr.i8count ?
123
(uint)sizeof(xfs_dir2_ino8_t) :
124
(uint)sizeof(xfs_dir2_ino4_t));
128
dir2_sf_entry_name_count(
132
xfs_dir2_sf_entry_t *e;
134
ASSERT(bitoffs(startoff) == 0);
135
e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
141
dir2_sf_entry_inumber_offset(
146
xfs_dir2_sf_entry_t *e;
148
ASSERT(bitoffs(startoff) == 0);
150
e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff));
151
return bitize((int)((char *)XFS_DIR2_SF_INUMBERP(e) - (char *)e));
160
xfs_dir2_sf_entry_t *e;
164
ASSERT(bitoffs(startoff) == 0);
165
sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff));
166
e = XFS_DIR2_SF_FIRSTENTRY(sf);
167
for (i = 0; i < idx; i++)
168
e = XFS_DIR2_SF_NEXTENTRY(sf, e);
169
return bitize((int)XFS_DIR2_SF_ENTSIZE_BYENTRY(sf, e));
181
ASSERT(bitoffs(startoff) == 0);
183
sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff));
184
return bitize(XFS_DIR2_SF_HDR_SIZE(sf->hdr.i8count));
194
ASSERT(bitoffs(startoff) == 0);
195
sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff));
196
return sf->hdr.count;
205
xfs_dir2_sf_entry_t *e;
209
ASSERT(bitoffs(startoff) == 0);
210
sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff));
211
e = XFS_DIR2_SF_FIRSTENTRY(sf);
212
for (i = 0; i < idx; i++)
213
e = XFS_DIR2_SF_NEXTENTRY(sf, e);
214
return bitize((int)((char *)e - (char *)sf));
224
xfs_dir2_sf_entry_t *e;
228
ASSERT(bitoffs(startoff) == 0);
230
sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff));
231
e = XFS_DIR2_SF_FIRSTENTRY(sf);
232
for (i = 0; i < sf->hdr.count; i++)
233
e = XFS_DIR2_SF_NEXTENTRY(sf, e);
234
return bitize((int)((char *)e - (char *)sf));