]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_attr_leaf.h
xfsprogs: Release v6.7.0
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_attr_leaf.h
CommitLineData
7acf15bf 1/* SPDX-License-Identifier: GPL-2.0 */
2bd0ea18 2/*
f302e9e4 3 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
a24374f4 4 * Copyright (c) 2013 Red Hat, Inc.
f302e9e4 5 * All Rights Reserved.
2bd0ea18
NS
6 */
7#ifndef __XFS_ATTR_LEAF_H__
dfc130f3 8#define __XFS_ATTR_LEAF_H__
2bd0ea18 9
2bd0ea18 10struct attrlist;
5e656dbb 11struct xfs_attr_list_context;
2bd0ea18
NS
12struct xfs_da_args;
13struct xfs_da_state;
14struct xfs_da_state_blk;
15struct xfs_inode;
16struct xfs_trans;
17
bd045c51
CH
18/*
19 * Incore version of the attribute leaf header.
20 */
21struct 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
2bd0ea18
NS
41/*========================================================================
42 * Function prototypes for the kernel.
43 *========================================================================*/
44
45/*
ca86e759 46 * Internal routines when attribute fork size < XFS_LITINO(mp).
2bd0ea18 47 */
ca86e759
NS
48void xfs_attr_shortform_create(struct xfs_da_args *args);
49void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
2bd0ea18
NS
50int xfs_attr_shortform_lookup(struct xfs_da_args *args);
51int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
c21a5691 52int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
f0c4e745 53int xfs_attr_sf_removename(struct xfs_da_args *args);
11b4b23d
AC
54int xfs_attr_sf_findname(struct xfs_da_args *args,
55 struct xfs_attr_sf_entry **sfep,
56 unsigned int *basep);
a2ceac1f 57int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
b626fb59 58int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
c7a710b7 59xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
a37f46d5 60void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
2bd0ea18
NS
61
62/*
5a35bf2c 63 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
2bd0ea18 64 */
a24374f4
DC
65int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
66int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
ca86e759 67 struct xfs_da_args *args, int forkoff);
a24374f4
DC
68int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
69int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
70int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
2bd0ea18
NS
71
72/*
73 * Routines used for growing the Btree.
74 */
a24374f4 75int xfs_attr3_leaf_split(struct xfs_da_state *state,
2bd0ea18
NS
76 struct xfs_da_state_blk *oldblk,
77 struct xfs_da_state_blk *newblk);
a24374f4 78int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
2bd0ea18 79 struct xfs_da_args *args);
a24374f4
DC
80int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
81int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
2bd0ea18 82 struct xfs_da_args *args);
a24374f4 83int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
2bd0ea18 84 struct xfs_da_args *args);
43074fba
DW
85int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
86 struct xfs_attr_list_context *context);
2bd0ea18
NS
87
88/*
89 * Routines used for shrinking the Btree.
90 */
a24374f4
DC
91int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
92void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
2bd0ea18
NS
93 struct xfs_da_state_blk *drop_blk,
94 struct xfs_da_state_blk *save_blk);
2bd0ea18
NS
95/*
96 * Utility routines.
97 */
a2ceac1f
DC
98xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
99int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
100 struct xfs_buf *leaf2_bp);
ff105f75 101int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
a24374f4 102int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
edf3b3a8 103 xfs_dablk_t bno, struct xfs_buf **bpp);
19ebedcf
DC
104void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
105 struct xfs_attr3_icleaf_hdr *to,
a24374f4 106 struct xfs_attr_leafblock *from);
19ebedcf
DC
107void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
108 struct xfs_attr_leafblock *to,
658ac3e3 109 struct xfs_attr3_icleaf_hdr *from);
a2ceac1f 110
2bd0ea18 111#endif /* __XFS_ATTR_LEAF_H__ */