]>
Commit | Line | Data |
---|---|---|
0b61f8a4 | 1 | // SPDX-License-Identifier: GPL-2.0 |
1da177e4 | 2 | /* |
7b718769 | 3 | * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. |
517c2220 | 4 | * Copyright (c) 2013 Red Hat, Inc. |
aa82daa0 | 5 | * All Rights Reserved. |
1da177e4 LT |
6 | */ |
7 | #ifndef __XFS_ATTR_LEAF_H__ | |
8 | #define __XFS_ATTR_LEAF_H__ | |
9 | ||
1da177e4 | 10 | struct attrlist; |
ad9b463a | 11 | struct xfs_attr_list_context; |
1da177e4 LT |
12 | struct xfs_da_args; |
13 | struct xfs_da_state; | |
14 | struct xfs_da_state_blk; | |
15 | struct xfs_inode; | |
16 | struct xfs_trans; | |
17 | ||
a39f089a CH |
18 | /* |
19 | * Incore version of the attribute leaf header. | |
20 | */ | |
21 | struct xfs_attr3_icleaf_hdr { | |
22 | uint32_t forw; | |
23 | uint32_t back; | |
24 | uint16_t magic; | |
25 | uint16_t count; | |
26 | uint16_t usedbytes; | |
27 | /* | |
28 | * Firstused is 32-bit here instead of 16-bit like the on-disk variant | |
29 | * to support maximum fsb size of 64k without overflow issues throughout | |
30 | * the attr code. Instead, the overflow condition is handled on | |
31 | * conversion to/from disk. | |
32 | */ | |
33 | uint32_t firstused; | |
34 | __u8 holes; | |
35 | struct { | |
36 | uint16_t base; | |
37 | uint16_t size; | |
38 | } freemap[XFS_ATTR_LEAF_MAPSIZE]; | |
39 | }; | |
40 | ||
1da177e4 LT |
41 | /*======================================================================== |
42 | * Function prototypes for the kernel. | |
43 | *========================================================================*/ | |
44 | ||
45 | /* | |
d8cc890d | 46 | * Internal routines when attribute fork size < XFS_LITINO(mp). |
1da177e4 | 47 | */ |
d8cc890d NS |
48 | void xfs_attr_shortform_create(struct xfs_da_args *args); |
49 | void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); | |
1da177e4 LT |
50 | int xfs_attr_shortform_lookup(struct xfs_da_args *args); |
51 | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); | |
6e643cd0 DW |
52 | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args, |
53 | struct xfs_buf **leaf_bp); | |
d8cc890d | 54 | int xfs_attr_shortform_remove(struct xfs_da_args *args); |
1d9025e5 | 55 | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); |
ae90b994 | 56 | int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes); |
1e1bbd8e | 57 | xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip); |
6dfe5a04 | 58 | void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp); |
1da177e4 LT |
59 | |
60 | /* | |
d8cc890d | 61 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
1da177e4 | 62 | */ |
517c2220 DC |
63 | int xfs_attr3_leaf_to_node(struct xfs_da_args *args); |
64 | int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp, | |
d8cc890d | 65 | struct xfs_da_args *args, int forkoff); |
517c2220 DC |
66 | int xfs_attr3_leaf_clearflag(struct xfs_da_args *args); |
67 | int xfs_attr3_leaf_setflag(struct xfs_da_args *args); | |
68 | int xfs_attr3_leaf_flipflags(struct xfs_da_args *args); | |
1da177e4 LT |
69 | |
70 | /* | |
71 | * Routines used for growing the Btree. | |
72 | */ | |
517c2220 | 73 | int xfs_attr3_leaf_split(struct xfs_da_state *state, |
1da177e4 LT |
74 | struct xfs_da_state_blk *oldblk, |
75 | struct xfs_da_state_blk *newblk); | |
517c2220 | 76 | int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf, |
1da177e4 | 77 | struct xfs_da_args *args); |
517c2220 DC |
78 | int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args); |
79 | int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer, | |
1da177e4 | 80 | struct xfs_da_args *args); |
517c2220 | 81 | int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer, |
1da177e4 | 82 | struct xfs_da_args *args); |
16c6e92c DW |
83 | int xfs_attr3_leaf_list_int(struct xfs_buf *bp, |
84 | struct xfs_attr_list_context *context); | |
1da177e4 LT |
85 | |
86 | /* | |
87 | * Routines used for shrinking the Btree. | |
88 | */ | |
517c2220 DC |
89 | int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval); |
90 | void xfs_attr3_leaf_unbalance(struct xfs_da_state *state, | |
1da177e4 LT |
91 | struct xfs_da_state_blk *drop_blk, |
92 | struct xfs_da_state_blk *save_blk); | |
1da177e4 LT |
93 | /* |
94 | * Utility routines. | |
95 | */ | |
1d9025e5 DC |
96 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); |
97 | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, | |
98 | struct xfs_buf *leaf2_bp); | |
c59f0ad2 | 99 | int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local); |
517c2220 | 100 | int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, |
dfb87594 | 101 | xfs_dablk_t bno, struct xfs_buf **bpp); |
2f661241 BF |
102 | void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo, |
103 | struct xfs_attr3_icleaf_hdr *to, | |
517c2220 | 104 | struct xfs_attr_leafblock *from); |
2f661241 BF |
105 | void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo, |
106 | struct xfs_attr_leafblock *to, | |
d386b32b | 107 | struct xfs_attr3_icleaf_hdr *from); |
1813dd64 | 108 | |
1da177e4 | 109 | #endif /* __XFS_ATTR_LEAF_H__ */ |