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

« back to all changes in this revision

Viewing changes to libxfs/xfs.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-2004 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
 
33
19
/*
64
50
 
65
51
#define xfs_xlatesb                     libxfs_xlate_sb
66
52
#define xfs_xlate_dinode_core           libxfs_xlate_dinode_core
67
 
#if ARCH_CONVERT != ARCH_NOCONVERT
68
53
#define xfs_bmbt_get_all                libxfs_bmbt_get_all
 
54
#if __BYTE_ORDER != __BIG_ENDIAN
69
55
#define xfs_bmbt_disk_get_all           libxfs_bmbt_disk_get_all
70
56
#else
71
 
#define xfs_bmbt_get_all                libxfs_bmbt_get_all
72
57
#define xfs_bmbt_disk_get_all           libxfs_bmbt_get_all
73
58
#endif
74
59
#define xfs_da_hashname                 libxfs_da_hashname
75
60
#define xfs_da_log2_roundup             libxfs_da_log2_roundup
76
61
#define xfs_highbit32                   libxfs_highbit32
77
62
#define xfs_highbit64                   libxfs_highbit64
78
 
#define xfs_attr_leaf_newentsize        libxfs_attr_leaf_newentsize
79
63
#define xfs_alloc_compute_maxlevels     libxfs_alloc_compute_maxlevels
80
64
#define xfs_bmap_compute_maxlevels      libxfs_bmap_compute_maxlevels
81
65
#define xfs_ialloc_compute_maxlevels    libxfs_ialloc_compute_maxlevels
94
78
#define xfs_dir2_removename             libxfs_dir2_removename
95
79
#define xfs_dir_bogus_removename        libxfs_dir_bogus_removename
96
80
#define xfs_dir2_bogus_removename       libxfs_dir2_bogus_removename
 
81
#define xfs_dir_shortform_to_leaf       libxfs_dir_shortform_to_leaf
 
82
#define xfs_dir2_sf_to_block            libxfs_dir2_sf_to_block
 
83
#define XFS_DIR_SHORTFORM_TO_SINGLE(mp, daargs) XFS_DIR_IS_V2(mp) ? \
 
84
                                        libxfs_dir2_sf_to_block(daargs) : \
 
85
                                        libxfs_dir_shortform_to_leaf(daargs);
97
86
 
98
87
#define xfs_mount_common                libxfs_mount_common
99
88
#define xfs_initialize_perag            libxfs_initialize_perag
100
89
#define xfs_rtmount_init                libxfs_rtmount_init
101
90
#define xfs_alloc_fix_freelist          libxfs_alloc_fix_freelist
102
91
#define xfs_iread                       libxfs_iread
103
 
#define xfs_ialloc                      libxfs_ialloc
104
92
#define xfs_idata_realloc               libxfs_idata_realloc
105
93
#define xfs_idestroy_fork               libxfs_idestroy_fork
106
94
#define xfs_itobp                       libxfs_itobp
123
111
#define xfs_trans_bhold                 libxfs_trans_bhold
124
112
#define xfs_trans_alloc                 libxfs_trans_alloc
125
113
#define xfs_trans_commit                libxfs_trans_commit
 
114
#define xfs_trans_cancel                libxfs_trans_cancel
126
115
#define xfs_trans_mod_sb                libxfs_trans_mod_sb
127
116
#define xfs_trans_reserve               libxfs_trans_reserve
128
117
#define xfs_trans_get_buf               libxfs_trans_get_buf
151
140
#define xfs_dir2_data_freescan          libxfs_dir2_data_freescan
152
141
#define xfs_dir2_free_log_bests         libxfs_dir2_free_log_bests
153
142
 
 
143
#define xfs_attr_leaf_newentsize        libxfs_attr_leaf_newentsize
 
144
#define xfs_attr_set_int                libxfs_attr_set_int
 
145
#define xfs_attr_remove_int             libxfs_attr_remove_int
 
146
 
154
147
 
155
148
/*
156
149
 * Infrastructure to support building kernel XFS code in user space
163
156
#define XFS_BUF_ISDONE(bp)              0
164
157
#define XFS_BUF_GETERROR(bp)            0
165
158
#define XFS_BUF_DONE(bp)                ((void) 0)
 
159
#define XFS_BUF_STALE(bp)               ((void) 0)
 
160
#define XFS_BUF_UNDELAYWRITE(bp)        ((void) 0)
166
161
#define XFS_BUF_SET_REF(a,b)            ((void) 0)
167
162
#define XFS_BUF_SET_VTYPE(a,b)          ((void) 0)
168
163
#define XFS_BUF_SET_VTYPE_REF(a,b,c)    ((void) 0)
169
164
#define XFS_BUF_SET_BDSTRAT_FUNC(a,b)   ((void) 0)
 
165
#define xfs_incore(bt,blkno,len,lockit) 0
170
166
#define xfs_baread(a,b,c)               ((void) 0)      /* no readahead */
171
167
#define xfs_buftrace(x,y)               ((void) 0)      /* debug only */
172
168
#define xfs_buf_item_log_debug(bip,a,b) ((void) 0)      /* debug only */
174
170
#define xfs_buf_relse(bp)               libxfs_putbuf(bp)
175
171
#define xfs_read_buf(mp,devp,blkno,len,f,bpp)   \
176
172
        ( *(bpp) = libxfs_readbuf( *(dev_t*)devp, (blkno), (len), 1), 0 )
 
173
#define xfs_buf_get_flags(devp,blkno,len,f)     \
 
174
        ( libxfs_getbuf( devp, (blkno), (len) ) )
 
175
#define xfs_bwrite(mp,bp)               libxfs_writebuf((bp), 0)
 
176
 
 
177
#define XFS_B_READ                      LIBXFS_BREAD
 
178
#define XFS_B_WRITE                     LIBXFS_BWRITE
 
179
#define xfs_biomove(bp,off,len,data,f)  libxfs_iomove(bp,off,len,data,f)
 
180
#define xfs_biozero(bp,off,len)         libxfs_iomove(bp,off,len,0,LIBXFS_BZERO)
177
181
 
178
182
/* transaction management */
179
183
#define xfs_trans_set_sync(tp)                  ((void) 0)
232
236
/* space allocation */
233
237
#define xfs_alloc_search_busy(tp,ag,b,len)              ((void) 0)
234
238
#define xfs_alloc_mark_busy(tp,ag,b,len)                ((void) 0)
 
239
#define xfs_rotorstep                                   1
 
240
 
 
241
#define xfs_ilock(ip, mode)             ((void)0)
 
242
#define xfs_iunlock(ip, mode)           ((void)0)
235
243
 
236
244
/* anything else */
237
245
#if !defined(__sgi__)
242
250
#undef MASK
243
251
#define NBPP            getpagesize()
244
252
#define STATIC
245
 
#define ATTR_ROOT       0x0002  /* use attrs in root namespace */
246
 
#define ATTR_SECURE     0x0008  /* use attrs in security namespace */
 
253
#define VN_HOLD(vp)
 
254
#define ATTR_ROOT       LIBXFS_ATTR_ROOT
 
255
#define ATTR_SECURE     LIBXFS_ATTR_SECURE
 
256
#define ATTR_CREATE     LIBXFS_ATTR_CREATE
 
257
#define ATTR_REPLACE    LIBXFS_ATTR_REPLACE
 
258
#define ATTR_KERNOTIME  0
247
259
#define ktrace_t        void
248
260
#define m_ddev_targp    m_dev
249
261
#define unlikely(x)     (x)
254
266
#define XFS_ERROR_REPORT(e,l,mp)        ((void) 0)
255
267
#define XFS_CORRUPTION_ERROR(e,l,mp,m)  ((void) 0)
256
268
#define XFS_TEST_ERROR(expr,a,b,c)      ( expr )
 
269
#define XFS_WANT_CORRUPTED_GOTO(expr,l) \
 
270
                { if (!(expr)) { error = EFSCORRUPTED; goto l; } }
 
271
#define XFS_WANT_CORRUPTED_RETURN(expr) \
 
272
                { if (!(expr)) { return EFSCORRUPTED; } }
257
273
#define TRACE_FREE(s,a,b,x,f)           ((void) 0)
258
274
#define TRACE_ALLOC(s,a)                ((void) 0)
259
275
#define TRACE_MODAGF(a,b,c)             ((void) 0)
263
279
#define XFS_STATS_ADD(count, x)         do { } while (0)
264
280
#define XFS_MOUNT_WSYNC                 0       /* ignored in userspace */
265
281
#define XFS_MOUNT_NOALIGN               0       /* ignored in userspace */
266
 
#define XFS_MOUNT_32BITINODES           0x1     /* enforce in userspace */
267
 
#define XFS_MOUNT_32BITINOOPT           0x2     /* enforce in userspace */
 
282
#define XFS_MOUNT_32BITINODES           LIBXFS_MOUNT_32BITINODES
 
283
#define XFS_MOUNT_32BITINOOPT           LIBXFS_MOUNT_32BITINOOPT
 
284
#define XFS_MOUNT_COMPAT_ATTR           LIBXFS_MOUNT_COMPAT_ATTR
268
285
#define XFS_ILOCK_EXCL                  0
 
286
#define xfs_sort                        qsort
269
287
#define down_read(a)                    ((void) 0)
270
288
#define up_read(a)                      ((void) 0)
271
289
#define mrlock(a,b,c)                   ((void) 0)
279
297
#define __return_address                __builtin_return_address(0)
280
298
#define xfs_btree_reada_bufl(m,fsb,c)   ((void) 0)
281
299
#define xfs_btree_reada_bufs(m,fsb,c,x) ((void) 0)
 
300
#define XFS_SB_LOCK(mp)                 0
 
301
#define XFS_SB_UNLOCK(mp,s)             ((void) 0)
282
302
#undef  XFS_DIR_SHORTFORM_VALIDATE_ONDISK
283
303
#define XFS_DIR_SHORTFORM_VALIDATE_ONDISK(mp,dip) 0
284
 
#define XFS_TRANS_MOD_DQUOT_BYINO(mp,tp,ip,field,delta)
 
304
#define XFS_QM_DQATTACH(mp,ip,flags)    0
 
305
#define XFS_TRANS_MOD_DQUOT_BYINO(mp,tp,ip,field,delta) do { } while (0)
285
306
#define XFS_TRANS_RESERVE_BLKQUOTA(mp,tp,ip,nblks)      0
286
 
#define XFS_TRANS_UNRESERVE_BLKQUOTA(mp,tp,ip,nblks)
287
 
#define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl)
 
307
#define XFS_TRANS_UNRESERVE_BLKQUOTA(mp,tp,ip,nblks)    0
 
308
#define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl)  0
 
309
#define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp,tp,ip,nblks,ninos,fl)        0
288
310
 
289
311
/* These are lifted from the kernel */
290
312
#define get_unaligned(ptr) \
305
327
# define printk(...)                    ( fprintf(stderr, __VA_ARGS__) )
306
328
#endif
307
329
 
 
330
#define rol32(x,y)      (((x) << (y)) | ((x) >> (32 - (y))))
308
331
#define do_mod(a, b)    ((a) % (b))
309
332
#define do_div(n,base)  ({ \
310
333
        int __res; \
351
374
                        int *, int *, uint);
352
375
 
353
376
/* xfs_rtalloc.c */
 
377
int  xfs_rtpick_extent (xfs_mount_t *, xfs_trans_t *, xfs_extlen_t,
 
378
                        xfs_rtblock_t *);
354
379
int  xfs_rtfree_extent (xfs_trans_t *, xfs_rtblock_t, xfs_extlen_t);
355
380
int  xfs_rtmodify_range (xfs_mount_t *, xfs_trans_t *, xfs_rtblock_t,
356
381
                        xfs_extlen_t, int);
414
439
uint xfs_iroundup (uint);
415
440
 
416
441
/* xfs_bmap.c */
417
 
xfs_bmbt_rec_t *xfs_bmap_search_extents (xfs_inode_t *ip,
 
442
int  xfs_bmap_local_to_extents (xfs_trans_t *, xfs_inode_t *,
 
443
                        xfs_fsblock_t *, xfs_extlen_t, int *, int);
 
444
xfs_bmbt_rec_t *xfs_bmap_search_extents (xfs_inode_t *,
418
445
                        xfs_fileoff_t, int, int *, xfs_extnum_t *,
419
446
                        xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
420
447
int  xfs_bmap_read_extents (xfs_trans_t *, xfs_inode_t *, int);
 
448
int  xfs_bmap_add_attrfork (xfs_inode_t *, int, int);
421
449
void xfs_bmap_add_free (xfs_fsblock_t, xfs_filblks_t, xfs_bmap_free_t *,
422
450
                        xfs_mount_t *);
423
451
int  xfs_bmap_first_unused (xfs_trans_t *, xfs_inode_t *, xfs_extlen_t,
446
474
                        xfs_bmap_free_t *, xfs_btree_cur_t **, int, int *, int);
447
475
void xfs_bmap_delete_exlist (xfs_inode_t *, xfs_extnum_t, xfs_extnum_t, int);
448
476
xfs_filblks_t xfs_bmap_worst_indlen (xfs_inode_t *, xfs_filblks_t);
 
477
void xfs_bmap_cancel (xfs_bmap_free_t *);
449
478
int  xfs_bmap_isaeof (xfs_inode_t *, xfs_fileoff_t, int, char *);
450
479
void xfs_bmap_insert_exlist (xfs_inode_t *, xfs_extnum_t, xfs_extnum_t,
451
480
                        xfs_bmbt_irec_t *, int);
472
501
void xfs_bmbt_log_recs (struct xfs_btree_cur *, struct xfs_buf *, int, int);
473
502
int  xfs_bmbt_lookup_eq (struct xfs_btree_cur *, xfs_fileoff_t, xfs_fsblock_t,
474
503
                        xfs_filblks_t, int *);
 
504
int  xfs_bmbt_lookup_ge (struct xfs_btree_cur *, xfs_fileoff_t, xfs_fsblock_t,
 
505
                        xfs_filblks_t, int *);
475
506
xfs_fsblock_t xfs_bmbt_get_startblock (xfs_bmbt_rec_t *);
476
507
xfs_filblks_t xfs_bmbt_get_blockcount (xfs_bmbt_rec_t *);
477
508
xfs_fileoff_t xfs_bmbt_get_startoff (xfs_bmbt_rec_t *);
486
517
                        xfs_filblks_t, xfs_exntst_t);
487
518
void xfs_bmbt_to_bmdr (xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
488
519
void xfs_bmdr_to_bmbt (xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
489
 
#if ARCH_CONVERT != ARCH_NOCONVERT
 
520
#if __BYTE_ORDER != __BIG_ENDIAN
490
521
xfs_fileoff_t xfs_bmbt_disk_get_startoff (xfs_bmbt_rec_t *);
491
522
void xfs_bmbt_disk_set_all (xfs_bmbt_rec_t *, xfs_bmbt_irec_t *);
492
523
void xfs_bmbt_disk_set_allf (xfs_bmbt_rec_t *, xfs_fileoff_t, xfs_fsblock_t,
557
588
xfs_da_state_t *xfs_da_state_alloc (void);
558
589
void xfs_da_state_free (xfs_da_state_t *);
559
590
void xfs_da_state_kill_altpath (xfs_da_state_t *);
 
591
xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *);
560
592
 
561
593
/* xfs_dir.c */
562
594
int  xfs_dir_node_addname (xfs_da_args_t *);
 
595
int  xfs_dir_leaf_create (xfs_da_args_t *, xfs_dablk_t, xfs_dabuf_t **);
563
596
int  xfs_dir_leaf_lookup (xfs_da_args_t *);
564
597
int  xfs_dir_node_lookup (xfs_da_args_t *);
565
598
int  xfs_dir_leaf_replace (xfs_da_args_t *);
576
609
                        xfs_da_state_blk_t *, int *, int *);
577
610
void xfs_dir_leaf_moveents (xfs_dir_leafblock_t *, int,
578
611
                        xfs_dir_leafblock_t *, int, int, xfs_mount_t *);
 
612
int  xfs_dir_shortform_to_leaf (xfs_da_args_t *);
579
613
 
580
614
/* xfs_dir2_leaf.c */
581
615
void xfs_dir2_leaf_check (xfs_inode_t *, xfs_dabuf_t *);
592
626
int  xfs_dir2_leafn_remove (xfs_da_args_t *, xfs_dabuf_t *, int,
593
627
                        xfs_da_state_blk_t *, int *);
594
628
int  xfs_dir2_node_addname_int (xfs_da_args_t *, xfs_da_state_blk_t *);
 
629
int  xfs_dir2_sf_to_block (xfs_da_args_t *);
595
630
 
596
631
/* xfs_dir2_sf.c */
597
632
void xfs_dir2_sf_check (xfs_da_args_t *);