diff options
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.h')
-rw-r--r-- | fs/xfs/xfs_attr_leaf.h | 129 |
1 files changed, 55 insertions, 74 deletions
diff --git a/fs/xfs/xfs_attr_leaf.h b/fs/xfs/xfs_attr_leaf.h index 0a4cfad6df91..f6143ff251a0 100644 --- a/fs/xfs/xfs_attr_leaf.h +++ b/fs/xfs/xfs_attr_leaf.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000, 2002-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000,2002-2003,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_ATTR_LEAF_H__ | 18 | #ifndef __XFS_ATTR_LEAF_H__ |
33 | #define __XFS_ATTR_LEAF_H__ | 19 | #define __XFS_ATTR_LEAF_H__ |
@@ -146,65 +132,58 @@ typedef struct xfs_attr_leaf_name_remote xfs_attr_leaf_name_remote_t; | |||
146 | /* | 132 | /* |
147 | * Cast typed pointers for "local" and "remote" name/value structs. | 133 | * Cast typed pointers for "local" and "remote" name/value structs. |
148 | */ | 134 | */ |
149 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_REMOTE) | ||
150 | xfs_attr_leaf_name_remote_t * | ||
151 | xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx); | ||
152 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ | 135 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) \ |
153 | xfs_attr_leaf_name_remote(leafp,idx) | 136 | xfs_attr_leaf_name_remote(leafp,idx) |
154 | #else | 137 | static inline xfs_attr_leaf_name_remote_t * |
155 | #define XFS_ATTR_LEAF_NAME_REMOTE(leafp,idx) /* remote name struct ptr */ \ | 138 | xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) |
156 | ((xfs_attr_leaf_name_remote_t *) \ | 139 | { |
157 | &((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) | 140 | return (xfs_attr_leaf_name_remote_t *) &((char *) |
158 | #endif | 141 | (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]; |
159 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME_LOCAL) | 142 | } |
160 | xfs_attr_leaf_name_local_t * | 143 | |
161 | xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx); | ||
162 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ | 144 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) \ |
163 | xfs_attr_leaf_name_local(leafp,idx) | 145 | xfs_attr_leaf_name_local(leafp,idx) |
164 | #else | 146 | static inline xfs_attr_leaf_name_local_t * |
165 | #define XFS_ATTR_LEAF_NAME_LOCAL(leafp,idx) /* local name struct ptr */ \ | 147 | xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) |
166 | ((xfs_attr_leaf_name_local_t *) \ | 148 | { |
167 | &((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) | 149 | return (xfs_attr_leaf_name_local_t *) &((char *) |
168 | #endif | 150 | (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]; |
169 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_NAME) | 151 | } |
170 | char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx); | 152 | |
171 | #define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx) | 153 | #define XFS_ATTR_LEAF_NAME(leafp,idx) xfs_attr_leaf_name(leafp,idx) |
172 | #else | 154 | static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx) |
173 | #define XFS_ATTR_LEAF_NAME(leafp,idx) /* generic name struct ptr */ \ | 155 | { |
174 | (&((char *)(leafp))[ INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT) ]) | 156 | return (&((char *) |
175 | #endif | 157 | (leafp))[INT_GET((leafp)->entries[idx].nameidx, ARCH_CONVERT)]); |
158 | } | ||
176 | 159 | ||
177 | /* | 160 | /* |
178 | * Calculate total bytes used (including trailing pad for alignment) for | 161 | * Calculate total bytes used (including trailing pad for alignment) for |
179 | * a "local" name/value structure, a "remote" name/value structure, and | 162 | * a "local" name/value structure, a "remote" name/value structure, and |
180 | * a pointer which might be either. | 163 | * a pointer which might be either. |
181 | */ | 164 | */ |
182 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_REMOTE) | ||
183 | int xfs_attr_leaf_entsize_remote(int nlen); | ||
184 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ | 165 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) \ |
185 | xfs_attr_leaf_entsize_remote(nlen) | 166 | xfs_attr_leaf_entsize_remote(nlen) |
186 | #else | 167 | static inline int xfs_attr_leaf_entsize_remote(int nlen) |
187 | #define XFS_ATTR_LEAF_ENTSIZE_REMOTE(nlen) /* space for remote struct */ \ | 168 | { |
188 | (((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ | 169 | return ((uint)sizeof(xfs_attr_leaf_name_remote_t) - 1 + (nlen) + \ |
189 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) | 170 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
190 | #endif | 171 | } |
191 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL) | 172 | |
192 | int xfs_attr_leaf_entsize_local(int nlen, int vlen); | ||
193 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ | 173 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) \ |
194 | xfs_attr_leaf_entsize_local(nlen,vlen) | 174 | xfs_attr_leaf_entsize_local(nlen,vlen) |
195 | #else | 175 | static inline int xfs_attr_leaf_entsize_local(int nlen, int vlen) |
196 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL(nlen,vlen) /* space for local struct */ \ | 176 | { |
197 | (((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + \ | 177 | return ((uint)sizeof(xfs_attr_leaf_name_local_t) - 1 + (nlen) + (vlen) + |
198 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1)) | 178 | XFS_ATTR_LEAF_NAME_ALIGN - 1) & ~(XFS_ATTR_LEAF_NAME_ALIGN - 1); |
199 | #endif | 179 | } |
200 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX) | 180 | |
201 | int xfs_attr_leaf_entsize_local_max(int bsize); | ||
202 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ | 181 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) \ |
203 | xfs_attr_leaf_entsize_local_max(bsize) | 182 | xfs_attr_leaf_entsize_local_max(bsize) |
204 | #else | 183 | static inline int xfs_attr_leaf_entsize_local_max(int bsize) |
205 | #define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX(bsize) /* max local struct size */ \ | 184 | { |
206 | (((bsize) >> 1) + ((bsize) >> 2)) | 185 | return (((bsize) >> 1) + ((bsize) >> 2)); |
207 | #endif | 186 | } |
208 | 187 | ||
209 | 188 | ||
210 | /*======================================================================== | 189 | /*======================================================================== |
@@ -237,23 +216,25 @@ typedef struct xfs_attr_inactive_list { | |||
237 | *========================================================================*/ | 216 | *========================================================================*/ |
238 | 217 | ||
239 | /* | 218 | /* |
240 | * Internal routines when dirsize < XFS_LITINO(mp). | 219 | * Internal routines when attribute fork size < XFS_LITINO(mp). |
241 | */ | 220 | */ |
242 | int xfs_attr_shortform_create(struct xfs_da_args *args); | 221 | void xfs_attr_shortform_create(struct xfs_da_args *args); |
243 | int xfs_attr_shortform_add(struct xfs_da_args *add); | 222 | void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); |
244 | int xfs_attr_shortform_lookup(struct xfs_da_args *args); | 223 | int xfs_attr_shortform_lookup(struct xfs_da_args *args); |
245 | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); | 224 | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); |
246 | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); | 225 | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); |
247 | int xfs_attr_shortform_remove(struct xfs_da_args *remove); | 226 | int xfs_attr_shortform_remove(struct xfs_da_args *args); |
248 | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); | 227 | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); |
249 | int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp); | 228 | int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp); |
229 | int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); | ||
230 | |||
250 | 231 | ||
251 | /* | 232 | /* |
252 | * Internal routines when dirsize == XFS_LBSIZE(mp). | 233 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
253 | */ | 234 | */ |
254 | int xfs_attr_leaf_to_node(struct xfs_da_args *args); | 235 | int xfs_attr_leaf_to_node(struct xfs_da_args *args); |
255 | int xfs_attr_leaf_to_shortform(struct xfs_dabuf *bp, | 236 | int xfs_attr_leaf_to_shortform(struct xfs_dabuf *bp, |
256 | struct xfs_da_args *args); | 237 | struct xfs_da_args *args, int forkoff); |
257 | int xfs_attr_leaf_clearflag(struct xfs_da_args *args); | 238 | int xfs_attr_leaf_clearflag(struct xfs_da_args *args); |
258 | int xfs_attr_leaf_setflag(struct xfs_da_args *args); | 239 | int xfs_attr_leaf_setflag(struct xfs_da_args *args); |
259 | int xfs_attr_leaf_flipflags(xfs_da_args_t *args); | 240 | int xfs_attr_leaf_flipflags(xfs_da_args_t *args); |
@@ -289,7 +270,7 @@ int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); | |||
289 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); | 270 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count); |
290 | int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, | 271 | int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp, |
291 | struct xfs_dabuf *leaf2_bp); | 272 | struct xfs_dabuf *leaf2_bp); |
292 | int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int blocksize, | 273 | int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize, |
293 | int *local); | 274 | int *local); |
294 | int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp); | 275 | int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp); |
295 | 276 | ||