diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_sf.h')
-rw-r--r-- | fs/xfs/xfs_dir2_sf.h | 230 |
1 files changed, 91 insertions, 139 deletions
diff --git a/fs/xfs/xfs_dir2_sf.h b/fs/xfs/xfs_dir2_sf.h index bac6f5a2a312..42f015b70018 100644 --- a/fs/xfs/xfs_dir2_sf.h +++ b/fs/xfs/xfs_dir2_sf.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2001,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 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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/ | ||
31 | */ | 17 | */ |
32 | #ifndef __XFS_DIR2_SF_H__ | 18 | #ifndef __XFS_DIR2_SF_H__ |
33 | #define __XFS_DIR2_SF_H__ | 19 | #define __XFS_DIR2_SF_H__ |
@@ -104,140 +90,106 @@ typedef struct xfs_dir2_sf { | |||
104 | xfs_dir2_sf_entry_t list[1]; /* shortform entries */ | 90 | xfs_dir2_sf_entry_t list[1]; /* shortform entries */ |
105 | } xfs_dir2_sf_t; | 91 | } xfs_dir2_sf_t; |
106 | 92 | ||
107 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_HDR_SIZE) | ||
108 | int xfs_dir2_sf_hdr_size(int i8count); | ||
109 | #define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count) | 93 | #define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count) |
110 | #else | 94 | static inline int xfs_dir2_sf_hdr_size(int i8count) |
111 | #define XFS_DIR2_SF_HDR_SIZE(i8count) \ | 95 | { |
112 | ((uint)sizeof(xfs_dir2_sf_hdr_t) - \ | 96 | return ((uint)sizeof(xfs_dir2_sf_hdr_t) - \ |
113 | ((i8count) == 0) * \ | 97 | ((i8count) == 0) * \ |
114 | ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) | 98 | ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); |
115 | #endif | 99 | } |
116 | 100 | ||
117 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_INUMBERP) | ||
118 | xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep); | ||
119 | #define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep) | 101 | #define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep) |
120 | #else | 102 | static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep) |
121 | #define XFS_DIR2_SF_INUMBERP(sfep) \ | 103 | { |
122 | ((xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]) | 104 | return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen]; |
123 | #endif | 105 | } |
124 | |||
125 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_INUMBER) | ||
126 | xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from); | ||
127 | #define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ | ||
128 | xfs_dir2_sf_get_inumber(sfp, from) | ||
129 | 106 | ||
130 | #else | 107 | #define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ |
131 | #define XFS_DIR2_SF_GET_INUMBER(sfp, from) \ | 108 | xfs_dir2_sf_get_inumber(sfp, from) |
132 | ((sfp)->hdr.i8count == 0 ? \ | 109 | static inline xfs_intino_t |
110 | xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from) | ||
111 | { | ||
112 | return ((sfp)->hdr.i8count == 0 ? \ | ||
133 | (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \ | 113 | (xfs_intino_t)XFS_GET_DIR_INO4((from)->i4) : \ |
134 | (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)) | 114 | (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8)); |
135 | #endif | 115 | } |
136 | 116 | ||
137 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_INUMBER) | 117 | #define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ |
138 | void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from, | ||
139 | xfs_dir2_inou_t *to); | ||
140 | #define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ | ||
141 | xfs_dir2_sf_put_inumber(sfp,from,to) | 118 | xfs_dir2_sf_put_inumber(sfp,from,to) |
142 | #else | 119 | static inline void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from, |
143 | #define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \ | 120 | xfs_dir2_inou_t *to) |
144 | if ((sfp)->hdr.i8count == 0) { \ | 121 | { |
145 | XFS_PUT_DIR_INO4(*(from), (to)->i4); \ | 122 | if ((sfp)->hdr.i8count == 0) |
146 | } else { \ | 123 | XFS_PUT_DIR_INO4(*(from), (to)->i4); |
147 | XFS_PUT_DIR_INO8(*(from), (to)->i8); \ | 124 | else |
148 | } | 125 | XFS_PUT_DIR_INO8(*(from), (to)->i8); |
149 | #endif | 126 | } |
150 | 127 | ||
151 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_GET_OFFSET) | ||
152 | xfs_dir2_data_aoff_t xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep); | ||
153 | #define XFS_DIR2_SF_GET_OFFSET(sfep) \ | 128 | #define XFS_DIR2_SF_GET_OFFSET(sfep) \ |
154 | xfs_dir2_sf_get_offset(sfep) | 129 | xfs_dir2_sf_get_offset(sfep) |
155 | #else | 130 | static inline xfs_dir2_data_aoff_t |
156 | #define XFS_DIR2_SF_GET_OFFSET(sfep) \ | 131 | xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep) |
157 | INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i) | 132 | { |
158 | #endif | 133 | return INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i); |
134 | } | ||
159 | 135 | ||
160 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_PUT_OFFSET) | ||
161 | void xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, | ||
162 | xfs_dir2_data_aoff_t off); | ||
163 | #define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ | 136 | #define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ |
164 | xfs_dir2_sf_put_offset(sfep,off) | 137 | xfs_dir2_sf_put_offset(sfep,off) |
165 | #else | 138 | static inline void |
166 | #define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \ | 139 | xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off) |
167 | INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i,off) | 140 | { |
168 | #endif | 141 | INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i, off); |
142 | } | ||
169 | 143 | ||
170 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYNAME) | ||
171 | int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len); | ||
172 | #define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \ | 144 | #define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \ |
173 | xfs_dir2_sf_entsize_byname(sfp,len) | 145 | xfs_dir2_sf_entsize_byname(sfp,len) |
174 | #else | 146 | static inline int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len) |
175 | #define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) /* space a name uses */ \ | 147 | { |
176 | ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \ | 148 | return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \ |
177 | ((sfp)->hdr.i8count == 0) * \ | 149 | ((sfp)->hdr.i8count == 0) * \ |
178 | ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) | 150 | ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); |
179 | #endif | 151 | } |
180 | 152 | ||
181 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_ENTSIZE_BYENTRY) | ||
182 | int xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep); | ||
183 | #define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \ | 153 | #define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \ |
184 | xfs_dir2_sf_entsize_byentry(sfp,sfep) | 154 | xfs_dir2_sf_entsize_byentry(sfp,sfep) |
185 | #else | 155 | static inline int |
186 | #define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) /* space an entry uses */ \ | 156 | xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep) |
187 | ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (sfep)->namelen - \ | 157 | { |
188 | ((sfp)->hdr.i8count == 0) * \ | 158 | return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (sfep)->namelen - \ |
189 | ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))) | 159 | ((sfp)->hdr.i8count == 0) * \ |
190 | #endif | 160 | ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t))); |
191 | 161 | } | |
192 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_FIRSTENTRY) | 162 | |
193 | xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp); | ||
194 | #define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp) | 163 | #define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp) |
195 | #else | 164 | static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp) |
196 | #define XFS_DIR2_SF_FIRSTENTRY(sfp) /* first entry in struct */ \ | 165 | { |
197 | ((xfs_dir2_sf_entry_t *) \ | 166 | return ((xfs_dir2_sf_entry_t *) \ |
198 | ((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count))) | 167 | ((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count))); |
199 | #endif | 168 | } |
200 | 169 | ||
201 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_SF_NEXTENTRY) | 170 | #define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep) |
202 | xfs_dir2_sf_entry_t *xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, | 171 | static inline xfs_dir2_sf_entry_t * |
203 | xfs_dir2_sf_entry_t *sfep); | 172 | xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep) |
204 | #define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep) | 173 | { |
205 | #else | 174 | return ((xfs_dir2_sf_entry_t *) \ |
206 | #define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) /* next entry in struct */ \ | 175 | ((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep))); |
207 | ((xfs_dir2_sf_entry_t *) \ | 176 | } |
208 | ((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep))) | ||
209 | #endif | ||
210 | 177 | ||
211 | /* | 178 | /* |
212 | * Functions. | 179 | * Functions. |
213 | */ | 180 | */ |
214 | 181 | extern int xfs_dir2_block_sfsize(struct xfs_inode *dp, | |
215 | extern int | 182 | struct xfs_dir2_block *block, |
216 | xfs_dir2_block_sfsize(struct xfs_inode *dp, | 183 | xfs_dir2_sf_hdr_t *sfhp); |
217 | struct xfs_dir2_block *block, | 184 | extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp, |
218 | xfs_dir2_sf_hdr_t *sfhp); | 185 | int size, xfs_dir2_sf_hdr_t *sfhp); |
219 | 186 | extern int xfs_dir2_sf_addname(struct xfs_da_args *args); | |
220 | extern int | 187 | extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino); |
221 | xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp, | 188 | extern int xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio, |
222 | int size, xfs_dir2_sf_hdr_t *sfhp); | 189 | int *eofp, struct xfs_dirent *dbp, |
223 | 190 | xfs_dir2_put_t put); | |
224 | extern int | 191 | extern int xfs_dir2_sf_lookup(struct xfs_da_args *args); |
225 | xfs_dir2_sf_addname(struct xfs_da_args *args); | 192 | extern int xfs_dir2_sf_removename(struct xfs_da_args *args); |
226 | 193 | extern int xfs_dir2_sf_replace(struct xfs_da_args *args); | |
227 | extern int | ||
228 | xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino); | ||
229 | |||
230 | extern int | ||
231 | xfs_dir2_sf_getdents(struct xfs_inode *dp, struct uio *uio, int *eofp, | ||
232 | struct xfs_dirent *dbp, xfs_dir2_put_t put); | ||
233 | |||
234 | extern int | ||
235 | xfs_dir2_sf_lookup(struct xfs_da_args *args); | ||
236 | |||
237 | extern int | ||
238 | xfs_dir2_sf_removename(struct xfs_da_args *args); | ||
239 | |||
240 | extern int | ||
241 | xfs_dir2_sf_replace(struct xfs_da_args *args); | ||
242 | 194 | ||
243 | #endif /* __XFS_DIR2_SF_H__ */ | 195 | #endif /* __XFS_DIR2_SF_H__ */ |