~ubuntu-branches/ubuntu/edgy/xfsprogs/edgy

« back to all changes in this revision

Viewing changes to include/xfs_dir_sf.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2005-11-16 16:32:35 UTC
  • Revision ID: james.westby@ubuntu.com-20051116163235-synnef6xjj18ny42
Tags: 2.7.7-1
* New upstream release.
* Add support for (optional) ATTR2 format extension (closes: #336350)
* Allow gcc -pedantic option for C++ <xfs.h> users (closes: #249429)
* Fix segv in xfs_db frag command (closes: #338207)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 * 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.
7
8
 *
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.
11
 
 *
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.
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/
 
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.
 
13
 *
 
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
31
17
 */
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;
78
64
 
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)
84
 
#else
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)
87
 
#endif
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)
93
 
#else
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)
96
 
#endif
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)
100
 
#else
101
 
#define XFS_DIR_SF_ENTSIZE_BYNAME(len)          /* space a name uses */ \
102
 
        ((uint)sizeof(xfs_dir_sf_entry_t)-1 + (len))
103
 
#endif
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)
 
67
{
 
68
        *(to) = XFS_GET_DIR_INO8(*from);
 
69
}
 
70
 
 
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)
 
73
{
 
74
        XFS_PUT_DIR_INO8(*(from), *(to));
 
75
}
 
76
 
 
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)
 
79
{
 
80
        return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (len);
 
81
}
 
82
 
106
83
#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep)        xfs_dir_sf_entsize_byentry(sfep)
107
 
#else
108
 
#define XFS_DIR_SF_ENTSIZE_BYENTRY(sfep)        /* space an entry uses */ \
109
 
        ((uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen)
110
 
#endif
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)
 
85
{
 
86
        return (uint)sizeof(xfs_dir_sf_entry_t)-1 + (sfep)->namelen;
 
87
}
 
88
 
113
89
#define XFS_DIR_SF_NEXTENTRY(sfep)              xfs_dir_sf_nextentry(sfep)
114
 
#else
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)))
118
 
#endif
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)
 
91
{
 
92
        return (xfs_dir_sf_entry_t *) \
 
93
                ((char *)(sfep) + XFS_DIR_SF_ENTSIZE_BYENTRY(sfep));
 
94
}
 
95
 
121
96
#define XFS_DIR_SF_ALLFIT(count,totallen)       \
122
97
        xfs_dir_sf_allfit(count,totallen)
123
 
#else
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))
127
 
#endif
 
98
static inline int xfs_dir_sf_allfit(int count, int totallen)
 
99
{
 
100
        return ((uint)sizeof(xfs_dir_sf_hdr_t) + \
 
101
               ((uint)sizeof(xfs_dir_sf_entry_t)-1)*(count) + (totallen));
 
102
}
128
103
 
129
104
#if defined(XFS_DIR_TRACE)
130
105