2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
2
* Copyright (c) 2000,2005 Silicon Graphics, Inc.
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
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
6
7
* 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/
9
* This program is distributed in the hope that it would be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write the Free Software Foundation,
16
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
18
#ifndef __XFS_DIR_SF_H__
33
19
#define __XFS_DIR_SF_H__
76
62
char *name; /* name value, pointer into buffer */
77
63
} xfs_dir_sf_sort_t;
79
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_GET_DIRINO)
80
void xfs_dir_sf_get_dirino_arch(xfs_dir_ino_t *from, xfs_ino_t *to, xfs_arch_t arch);
81
void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to);
82
#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) xfs_dir_sf_get_dirino_arch(from, to, arch)
83
#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to)
85
#define XFS_DIR_SF_GET_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch)
86
#define XFS_DIR_SF_GET_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT)
88
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_PUT_DIRINO)
89
void xfs_dir_sf_put_dirino_arch(xfs_ino_t *from, xfs_dir_ino_t *to, xfs_arch_t arch);
90
void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to);
91
#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) xfs_dir_sf_put_dirino_arch(from, to, arch)
92
#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to)
94
#define XFS_DIR_SF_PUT_DIRINO_ARCH(from,to,arch) DIRINO_COPY_ARCH(from,to,arch)
95
#define XFS_DIR_SF_PUT_DIRINO(from,to) DIRINO_COPY_ARCH(from,to,ARCH_NOCONVERT)
97
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYNAME)
98
int xfs_dir_sf_entsize_byname(int len);
99
#define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len)
101
#define XFS_DIR_SF_ENTSIZE_BYNAME(len) /* space a name uses */ \
102
((uint)sizeof(xfs_dir_sf_entry_t)-1 + (len))
104
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ENTSIZE_BYENTRY)
105
int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep);
65
#define XFS_DIR_SF_GET_DIRINO(from,to) xfs_dir_sf_get_dirino(from, to)
66
static inline void xfs_dir_sf_get_dirino(xfs_dir_ino_t *from, xfs_ino_t *to)
68
*(to) = XFS_GET_DIR_INO8(*from);
71
#define XFS_DIR_SF_PUT_DIRINO(from,to) xfs_dir_sf_put_dirino(from, to)
72
static inline void xfs_dir_sf_put_dirino(xfs_ino_t *from, xfs_dir_ino_t *to)
74
XFS_PUT_DIR_INO8(*(from), *(to));
77
#define XFS_DIR_SF_ENTSIZE_BYNAME(len) xfs_dir_sf_entsize_byname(len)
78
static inline int xfs_dir_sf_entsize_byname(int len)
80
return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (len);
106
83
#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) xfs_dir_sf_entsize_byentry(sfep)
108
#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep) /* space an entry uses */ \
109
((uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen)
111
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_NEXTENTRY)
112
xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep);
84
static inline int xfs_dir_sf_entsize_byentry(xfs_dir_sf_entry_t *sfep)
86
return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen;
113
89
#define XFS_DIR_SF_NEXTENTRY(sfep) xfs_dir_sf_nextentry(sfep)
115
#define XFS_DIR_SF_NEXTENTRY(sfep) /* next entry in struct */ \
116
((xfs_dir_sf_entry_t *) \
117
((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep)))
119
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DIR_SF_ALLFIT)
120
int xfs_dir_sf_allfit(int count, int totallen);
90
static inline xfs_dir_sf_entry_t *xfs_dir_sf_nextentry(xfs_dir_sf_entry_t *sfep)
92
return (xfs_dir_sf_entry_t *) \
93
((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep));
121
96
#define XFS_DIR_SF_ALLFIT(count,totallen) \
122
97
xfs_dir_sf_allfit(count,totallen)
124
#define XFS_DIR_SF_ALLFIT(count,totallen) /* will all entries fit? */ \
125
((uint)sizeof(xfs_dir_sf_hdr_t) + \
126
((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen))
98
static inline int xfs_dir_sf_allfit(int count, int totallen)
100
return ((uint)sizeof(xfs_dir_sf_hdr_t) + \
101
((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen));
129
104
#if defined(XFS_DIR_TRACE)