diff options
Diffstat (limited to 'fs/xfs/xfs_dir_sf.h')
-rw-r--r-- | fs/xfs/xfs_dir_sf.h | 109 |
1 files changed, 45 insertions, 64 deletions
diff --git a/fs/xfs/xfs_dir_sf.h b/fs/xfs/xfs_dir_sf.h index a61bcfc2a87d..fe44c6f4d560 100644 --- a/fs/xfs/xfs_dir_sf.h +++ b/fs/xfs/xfs_dir_sf.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_DIR_SF_H__ | 18 | #ifndef __XFS_DIR_SF_H__ |
33 | #define __XFS_DIR_SF_H__ | 19 | #define __XFS_DIR_SF_H__ |
@@ -76,49 +62,44 @@ typedef struct xfs_dir_sf_sort { | |||
76 | char *name; /* name value, pointer into buffer */ | 62 | char *name; /* name value, pointer into buffer */ |
77 | } xfs_dir_sf_sort_t; | 63 | } xfs_dir_sf_sort_t; |
78 | 64 | ||
79 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO) | 65 | #define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) |
80 | void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to); | 66 | static inline void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to) |
81 | #define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to) | 67 | { |
82 | #else | 68 | *(to) = XFS_GET_DIR_INO8(*from); |
83 | #define XFS_DIR_SF_GET_DIRINO(from,to) (*(to) = XFS_GET_DIR_INO8(*from)) | 69 | } |
84 | #endif | 70 | |
85 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO) | 71 | #define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) |
86 | void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to); | 72 | static inline void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to) |
87 | #define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to) | 73 | { |
88 | #else | 74 | XFS_PUT_DIR_INO8(*(from), *(to)); |
89 | #define XFS_DIR_SF_PUT_DIRINO(from,to) XFS_PUT_DIR_INO8(*(from), *(to)) | 75 | } |
90 | #endif | 76 | |
91 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME) | 77 | #define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len) |
92 | int xfs_dir_sf_entsize_byname(int len); | 78 | static inline int xfs_dir_sf_entsize_byname(int len) |
93 | #define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len) | 79 | { |
94 | #else | 80 | return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (len); |
95 | #define XFS_DIR_SF_ENTSIZE_BYNAME(len) /* space a name uses */ \ | 81 | } |
96 | ((uint)sizeof(xfs_dir_sf_entry_t)-1 + (len)) | 82 | |
97 | #endif | ||
98 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYENTRY) | ||
99 | int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep); | ||
100 | #define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep) | 83 | #define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep) |
101 | #else | 84 | static inline int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep) |
102 | #define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) /* space an entry uses */ \ | 85 | { |
103 | ((uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen) | 86 | return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen; |
104 | #endif | 87 | } |
105 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_NEXTENTRY) | 88 | |
106 | xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep); | ||
107 | #define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep) | 89 | #define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep) |
108 | #else | 90 | static inline xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep) |
109 | #define XFS_DIR_SF_NEXTENTRY(sfep) /* next entry in struct */ \ | 91 | { |
110 | ((xfs_dir_sf_entry_t *) \ | 92 | return (xfs_dir_sf_entry_t *) \ |
111 | ((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep))) | 93 | ((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep)); |
112 | #endif | 94 | } |
113 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ALLFIT) | 95 | |
114 | int xfs_dir_sf_allfit(int count, int totallen); | ||
115 | #define XFS_DIR_SF_ALLFIT(count,totallen) \ | 96 | #define XFS_DIR_SF_ALLFIT(count,totallen) \ |
116 | xfs_dir_sf_allfit(count,totallen) | 97 | xfs_dir_sf_allfit(count,totallen) |
117 | #else | 98 | static inline int xfs_dir_sf_allfit(int count, int totallen) |
118 | #define XFS_DIR_SF_ALLFIT(count,totallen) /* will all entries fit? */ \ | 99 | { |
119 | ((uint)sizeof(xfs_dir_sf_hdr_t) + \ | 100 | return ((uint)sizeof(xfs_dir_sf_hdr_t) + \ |
120 | ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen)) | 101 | ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen)); |
121 | #endif | 102 | } |
122 | 103 | ||
123 | #if defined(XFS_DIR_TRACE) | 104 | #if defined(XFS_DIR_TRACE) |
124 | 105 | ||