]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_attr_leaf.h
xfs: convert a few more directory asserts to corruption
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_attr_leaf.h
CommitLineData
2bd0ea18 1/*
f302e9e4 2 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
a24374f4 3 * Copyright (c) 2013 Red Hat, Inc.
f302e9e4 4 * All Rights Reserved.
5000d01d 5 *
f302e9e4
NS
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
2bd0ea18 8 * published by the Free Software Foundation.
5000d01d 9 *
f302e9e4
NS
10 * This program is distributed in the hope that it would be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
5000d01d 14 *
f302e9e4
NS
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2bd0ea18
NS
18 */
19#ifndef __XFS_ATTR_LEAF_H__
dfc130f3 20#define __XFS_ATTR_LEAF_H__
2bd0ea18 21
2bd0ea18
NS
22struct attrlist;
23struct attrlist_cursor_kern;
5e656dbb 24struct xfs_attr_list_context;
2bd0ea18
NS
25struct xfs_da_args;
26struct xfs_da_state;
27struct xfs_da_state_blk;
28struct xfs_inode;
29struct xfs_trans;
30
2bd0ea18
NS
31/*
32 * Used to keep a list of "remote value" extents when unlinking an inode.
33 */
34typedef struct xfs_attr_inactive_list {
35 xfs_dablk_t valueblk; /* block number of value bytes */
36 int valuelen; /* number of bytes in value */
37} xfs_attr_inactive_list_t;
38
39
40/*========================================================================
41 * Function prototypes for the kernel.
42 *========================================================================*/
43
44/*
ca86e759 45 * Internal routines when attribute fork size < XFS_LITINO(mp).
2bd0ea18 46 */
ca86e759
NS
47void xfs_attr_shortform_create(struct xfs_da_args *args);
48void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
2bd0ea18
NS
49int xfs_attr_shortform_lookup(struct xfs_da_args *args);
50int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
3fbc4d7d
DW
51int xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
52 struct xfs_buf **leaf_bp);
ca86e759 53int xfs_attr_shortform_remove(struct xfs_da_args *args);
a2ceac1f 54int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
b626fb59 55int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
c7a710b7 56xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
a37f46d5 57void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
2bd0ea18
NS
58
59/*
5a35bf2c 60 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
2bd0ea18 61 */
a24374f4
DC
62int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
63int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
ca86e759 64 struct xfs_da_args *args, int forkoff);
a24374f4
DC
65int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
66int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
67int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
2bd0ea18
NS
68
69/*
70 * Routines used for growing the Btree.
71 */
a24374f4 72int xfs_attr3_leaf_split(struct xfs_da_state *state,
2bd0ea18
NS
73 struct xfs_da_state_blk *oldblk,
74 struct xfs_da_state_blk *newblk);
a24374f4 75int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
2bd0ea18 76 struct xfs_da_args *args);
a24374f4
DC
77int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
78int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
2bd0ea18 79 struct xfs_da_args *args);
a24374f4 80int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
2bd0ea18 81 struct xfs_da_args *args);
601410bb 82void xfs_attr3_leaf_list_int(struct xfs_buf *bp,
2bd0ea18
NS
83 struct xfs_attr_list_context *context);
84
85/*
86 * Routines used for shrinking the Btree.
87 */
a24374f4
DC
88int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
89void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
2bd0ea18
NS
90 struct xfs_da_state_blk *drop_blk,
91 struct xfs_da_state_blk *save_blk);
2bd0ea18
NS
92/*
93 * Utility routines.
94 */
a2ceac1f
DC
95xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
96int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
97 struct xfs_buf *leaf2_bp);
ff105f75 98int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
a24374f4 99int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
a2ceac1f
DC
100 xfs_dablk_t bno, xfs_daddr_t mappedbno,
101 struct xfs_buf **bpp);
19ebedcf
DC
102void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
103 struct xfs_attr3_icleaf_hdr *to,
a24374f4 104 struct xfs_attr_leafblock *from);
19ebedcf
DC
105void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
106 struct xfs_attr_leafblock *to,
658ac3e3 107 struct xfs_attr3_icleaf_hdr *from);
a2ceac1f 108
2bd0ea18 109#endif /* __XFS_ATTR_LEAF_H__ */