diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_data.h')
-rw-r--r-- | fs/xfs/xfs_dir2_data.h | 129 |
1 files changed, 46 insertions, 83 deletions
diff --git a/fs/xfs/xfs_dir2_data.h b/fs/xfs/xfs_dir2_data.h index 476cac920bf5..5e3a7f9ec735 100644 --- a/fs/xfs/xfs_dir2_data.h +++ b/fs/xfs/xfs_dir2_data.h | |||
@@ -1,33 +1,19 @@ | |||
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 | * 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_DATA_H__ | 18 | #ifndef __XFS_DIR2_DATA_H__ |
33 | #define __XFS_DIR2_DATA_H__ | 19 | #define __XFS_DIR2_DATA_H__ |
@@ -137,88 +123,65 @@ typedef struct xfs_dir2_data { | |||
137 | /* | 123 | /* |
138 | * Size of a data entry. | 124 | * Size of a data entry. |
139 | */ | 125 | */ |
140 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTSIZE) | ||
141 | int xfs_dir2_data_entsize(int n); | ||
142 | #define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n) | 126 | #define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n) |
143 | #else | 127 | static inline int xfs_dir2_data_entsize(int n) |
144 | #define XFS_DIR2_DATA_ENTSIZE(n) \ | 128 | { |
145 | ((int)(roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \ | 129 | return (int)roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \ |
146 | (uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN))) | 130 | (uint)sizeof(xfs_dir2_data_off_t), XFS_DIR2_DATA_ALIGN); |
147 | #endif | 131 | } |
148 | 132 | ||
149 | /* | 133 | /* |
150 | * Pointer to an entry's tag word. | 134 | * Pointer to an entry's tag word. |
151 | */ | 135 | */ |
152 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_ENTRY_TAG_P) | ||
153 | xfs_dir2_data_off_t *xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep); | ||
154 | #define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) | 136 | #define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep) |
155 | #else | 137 | static inline xfs_dir2_data_off_t * |
156 | #define XFS_DIR2_DATA_ENTRY_TAG_P(dep) \ | 138 | xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep) |
157 | ((xfs_dir2_data_off_t *)\ | 139 | { |
158 | ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ | 140 | return (xfs_dir2_data_off_t *) \ |
159 | (uint)sizeof(xfs_dir2_data_off_t))) | 141 | ((char *)(dep) + XFS_DIR2_DATA_ENTSIZE((dep)->namelen) - \ |
160 | #endif | 142 | (uint)sizeof(xfs_dir2_data_off_t)); |
143 | } | ||
161 | 144 | ||
162 | /* | 145 | /* |
163 | * Pointer to a freespace's tag word. | 146 | * Pointer to a freespace's tag word. |
164 | */ | 147 | */ |
165 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR2_DATA_UNUSED_TAG_P) | ||
166 | xfs_dir2_data_off_t *xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup); | ||
167 | #define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ | 148 | #define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ |
168 | xfs_dir2_data_unused_tag_p(dup) | 149 | xfs_dir2_data_unused_tag_p(dup) |
169 | #else | 150 | static inline xfs_dir2_data_off_t * |
170 | #define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \ | 151 | xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup) |
171 | ((xfs_dir2_data_off_t *)\ | 152 | { |
172 | ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ | 153 | return (xfs_dir2_data_off_t *) \ |
173 | - (uint)sizeof(xfs_dir2_data_off_t))) | 154 | ((char *)(dup) + INT_GET((dup)->length, ARCH_CONVERT) \ |
174 | #endif | 155 | - (uint)sizeof(xfs_dir2_data_off_t)); |
156 | } | ||
175 | 157 | ||
176 | /* | 158 | /* |
177 | * Function declarations. | 159 | * Function declarations. |
178 | */ | 160 | */ |
179 | |||
180 | #ifdef DEBUG | 161 | #ifdef DEBUG |
181 | extern void | 162 | extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp); |
182 | xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp); | ||
183 | #else | 163 | #else |
184 | #define xfs_dir2_data_check(dp,bp) | 164 | #define xfs_dir2_data_check(dp,bp) |
185 | #endif | 165 | #endif |
186 | 166 | extern xfs_dir2_data_free_t *xfs_dir2_data_freefind(xfs_dir2_data_t *d, | |
187 | extern xfs_dir2_data_free_t * | 167 | xfs_dir2_data_unused_t *dup); |
188 | xfs_dir2_data_freefind(xfs_dir2_data_t *d, | 168 | extern xfs_dir2_data_free_t *xfs_dir2_data_freeinsert(xfs_dir2_data_t *d, |
189 | xfs_dir2_data_unused_t *dup); | 169 | xfs_dir2_data_unused_t *dup, int *loghead); |
190 | 170 | extern void xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d, | |
191 | extern xfs_dir2_data_free_t * | 171 | int *loghead, char *aendp); |
192 | xfs_dir2_data_freeinsert(xfs_dir2_data_t *d, | 172 | extern int xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno, |
193 | xfs_dir2_data_unused_t *dup, int *loghead); | 173 | struct xfs_dabuf **bpp); |
194 | 174 | extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp, | |
195 | extern void | ||
196 | xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d, | ||
197 | int *loghead, char *aendp); | ||
198 | |||
199 | extern int | ||
200 | xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno, | ||
201 | struct xfs_dabuf **bpp); | ||
202 | |||
203 | extern void | ||
204 | xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp, | ||
205 | xfs_dir2_data_entry_t *dep); | 175 | xfs_dir2_data_entry_t *dep); |
206 | 176 | extern void xfs_dir2_data_log_header(struct xfs_trans *tp, | |
207 | extern void | 177 | struct xfs_dabuf *bp); |
208 | xfs_dir2_data_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp); | 178 | extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp, |
209 | 179 | xfs_dir2_data_unused_t *dup); | |
210 | extern void | 180 | extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp, |
211 | xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp, | ||
212 | xfs_dir2_data_unused_t *dup); | ||
213 | |||
214 | extern void | ||
215 | xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp, | ||
216 | xfs_dir2_data_aoff_t offset, | 181 | xfs_dir2_data_aoff_t offset, |
217 | xfs_dir2_data_aoff_t len, int *needlogp, | 182 | xfs_dir2_data_aoff_t len, int *needlogp, |
218 | int *needscanp); | 183 | int *needscanp); |
219 | 184 | extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp, | |
220 | extern void | ||
221 | xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp, | ||
222 | xfs_dir2_data_unused_t *dup, | 185 | xfs_dir2_data_unused_t *dup, |
223 | xfs_dir2_data_aoff_t offset, | 186 | xfs_dir2_data_aoff_t offset, |
224 | xfs_dir2_data_aoff_t len, int *needlogp, | 187 | xfs_dir2_data_aoff_t len, int *needlogp, |