1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
4 * Copyright (c) 2013 Red Hat, Inc.
7 #ifndef __XFS_ATTR_LEAF_H__
8 #define __XFS_ATTR_LEAF_H__
11 struct xfs_attr_list_context;
14 struct xfs_da_state_blk;
19 * Incore version of the attribute leaf header.
21 struct xfs_attr3_icleaf_hdr {
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.
38 } freemap[XFS_ATTR_LEAF_MAPSIZE];
41 /*========================================================================
42 * Function prototypes for the kernel.
43 *========================================================================*/
46 * Internal routines when attribute fork size < XFS_LITINO(mp).
48 void xfs_attr_shortform_create(struct xfs_da_args *args);
49 void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
50 int xfs_attr_shortform_lookup(struct xfs_da_args *args);
51 int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
52 int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
53 int xfs_attr_sf_removename(struct xfs_da_args *args);
54 int xfs_attr_sf_findname(struct xfs_da_args *args,
55 struct xfs_attr_sf_entry **sfep,
57 int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
58 int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
59 xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
60 void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
63 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
65 int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
66 int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
67 struct xfs_da_args *args, int forkoff);
68 int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
69 int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
70 int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
73 * Routines used for growing the Btree.
75 int xfs_attr3_leaf_split(struct xfs_da_state *state,
76 struct xfs_da_state_blk *oldblk,
77 struct xfs_da_state_blk *newblk);
78 int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
79 struct xfs_da_args *args);
80 int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
81 int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
82 struct xfs_da_args *args);
83 int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
84 struct xfs_da_args *args);
85 int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
86 struct xfs_attr_list_context *context);
89 * Routines used for shrinking the Btree.
91 int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
92 void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
93 struct xfs_da_state_blk *drop_blk,
94 struct xfs_da_state_blk *save_blk);
98 xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
99 int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
100 struct xfs_buf *leaf2_bp);
101 int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
102 int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
103 xfs_dablk_t bno, struct xfs_buf **bpp);
104 void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
105 struct xfs_attr3_icleaf_hdr *to,
106 struct xfs_attr_leafblock *from);
107 void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
108 struct xfs_attr_leafblock *to,
109 struct xfs_attr3_icleaf_hdr *from);
111 #endif /* __XFS_ATTR_LEAF_H__ */