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

« back to all changes in this revision

Viewing changes to include/xfs_log.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-2003 Silicon Graphics, Inc.  All Rights Reserved.
 
2
 * Copyright (c) 2000-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
 
 * 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_LOG_H__
33
19
#define __XFS_LOG_H__
34
20
 
35
 
#if __BYTE_ORDER == __LITTLE_ENDIAN
36
 
#define LSN_FIELD_CYCLE(arch) (((arch)==ARCH_NOCONVERT)?1:0)
37
 
#define LSN_FIELD_BLOCK(arch) (((arch)==ARCH_NOCONVERT)?0:1)
38
 
#else
39
 
#define LSN_FIELD_CYCLE(arch) (0)
40
 
#define LSN_FIELD_BLOCK(arch) (1)
41
 
#endif
42
 
 
43
21
/* get lsn fields */
44
22
 
45
 
#define CYCLE_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)], arch))
46
 
#define BLOCK_LSN(lsn,arch) (INT_GET(((uint *)&(lsn))[LSN_FIELD_BLOCK(arch)], arch))
 
23
#define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
 
24
#define BLOCK_LSN(lsn) ((uint)(lsn))
47
25
/* this is used in a spot where we might otherwise double-endian-flip */
48
 
#define CYCLE_LSN_NOCONV(lsn,arch) (((uint *)&(lsn))[LSN_FIELD_CYCLE(arch)])
 
26
#define CYCLE_LSN_DISK(lsn) (((uint *)&(lsn))[0])
49
27
 
50
28
#ifdef __KERNEL__
51
29
/*
58
36
#else
59
37
__inline__
60
38
#endif
61
 
xfs_lsn_t       _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2, xfs_arch_t arch)
 
39
xfs_lsn_t       _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
62
40
{
63
 
        if (CYCLE_LSN(lsn1, arch) != CYCLE_LSN(lsn2, arch))
64
 
                return (CYCLE_LSN(lsn1, arch)<CYCLE_LSN(lsn2, arch))? -999 : 999;
 
41
        if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
 
42
                return (CYCLE_LSN(lsn1)<CYCLE_LSN(lsn2))? -999 : 999;
65
43
 
66
 
        if (BLOCK_LSN(lsn1, arch) != BLOCK_LSN(lsn2, arch))
67
 
                return (BLOCK_LSN(lsn1, arch)<BLOCK_LSN(lsn2, arch))? -999 : 999;
 
44
        if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
 
45
                return (BLOCK_LSN(lsn1)<BLOCK_LSN(lsn2))? -999 : 999;
68
46
 
69
47
        return 0;
70
48
}
71
49
 
72
 
#define XFS_LSN_CMP_ARCH(x,y,arch)      _lsn_cmp(x, y, arch)
73
 
#define XFS_LSN_CMP(x,y) XFS_LSN_CMP_ARCH(x,y,ARCH_NOCONVERT)
74
 
#define XFS_LSN_DIFF_ARCH(x,y,arch)     _lsn_cmp(x, y, arch)
75
 
#define XFS_LSN_DIFF(x,y) XFS_LSN_DIFF_ARCH(x,y,ARCH_NOCONVERT)
 
50
#define XFS_LSN_CMP(x,y) _lsn_cmp(x,y)
76
51
 
77
52
/*
78
53
 * Macros, structures, prototypes for interface to the log manager.
125
100
#define XFS_VOLUME              0x2
126
101
#define XFS_LOG                 0xaa
127
102
 
 
103
 
 
104
/* Region types for iovec's i_type */
 
105
#if defined(XFS_LOG_RES_DEBUG)
 
106
#define XLOG_REG_TYPE_BFORMAT           1
 
107
#define XLOG_REG_TYPE_BCHUNK            2
 
108
#define XLOG_REG_TYPE_EFI_FORMAT        3
 
109
#define XLOG_REG_TYPE_EFD_FORMAT        4
 
110
#define XLOG_REG_TYPE_IFORMAT           5
 
111
#define XLOG_REG_TYPE_ICORE             6
 
112
#define XLOG_REG_TYPE_IEXT              7
 
113
#define XLOG_REG_TYPE_IBROOT            8
 
114
#define XLOG_REG_TYPE_ILOCAL            9
 
115
#define XLOG_REG_TYPE_IATTR_EXT         10
 
116
#define XLOG_REG_TYPE_IATTR_BROOT       11
 
117
#define XLOG_REG_TYPE_IATTR_LOCAL       12
 
118
#define XLOG_REG_TYPE_QFORMAT           13
 
119
#define XLOG_REG_TYPE_DQUOT             14
 
120
#define XLOG_REG_TYPE_QUOTAOFF          15
 
121
#define XLOG_REG_TYPE_LRHEADER          16
 
122
#define XLOG_REG_TYPE_UNMOUNT           17
 
123
#define XLOG_REG_TYPE_COMMIT            18
 
124
#define XLOG_REG_TYPE_TRANSHDR          19
 
125
#define XLOG_REG_TYPE_MAX               19
 
126
#endif
 
127
 
 
128
#if defined(XFS_LOG_RES_DEBUG)
 
129
#define XLOG_VEC_SET_TYPE(vecp, t) ((vecp)->i_type = (t))
 
130
#else
 
131
#define XLOG_VEC_SET_TYPE(vecp, t)
 
132
#endif
 
133
 
 
134
 
128
135
typedef struct xfs_log_iovec {
129
136
        xfs_caddr_t             i_addr;         /* beginning address of region */
130
137
        int             i_len;          /* length in bytes of region */
 
138
#if defined(XFS_LOG_RES_DEBUG)
 
139
        uint            i_type;         /* type of region */
 
140
#endif
131
141
} xfs_log_iovec_t;
132
142
 
133
143
typedef void* xfs_log_ticket_t;
150
160
                       xfs_log_ticket_t ticket,
151
161
                       void             **iclog,
152
162
                       uint             flags);
153
 
int       xfs_log_force(struct xfs_mount *mp,
154
 
                        xfs_lsn_t        lsn,
155
 
                        uint             flags);
 
163
int       _xfs_log_force(struct xfs_mount *mp,
 
164
                         xfs_lsn_t      lsn,
 
165
                         uint           flags,
 
166
                         int            *log_forced);
 
167
#define xfs_log_force(mp, lsn, flags) \
 
168
        _xfs_log_force(mp, lsn, flags, NULL);
156
169
int       xfs_log_mount(struct xfs_mount        *mp,
157
170
                        struct xfs_buftarg      *log_target,
158
171
                        xfs_daddr_t             start_block,
170
183
                          int              count,
171
184
                          xfs_log_ticket_t *ticket,
172
185
                          __uint8_t        clientid,
173
 
                          uint             flags);
 
186
                          uint             flags,
 
187
                          uint             t_type);
174
188
int       xfs_log_write(struct xfs_mount *mp,
175
189
                        xfs_log_iovec_t  region[],
176
190
                        int              nentries,