]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_attr_leaf.h
xfs: fix transaction leak on remote attr set/remove failure
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_attr_leaf.h
CommitLineData
37b3b4d6 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
NS
10struct attrlist;
11struct attrlist_cursor_kern;
5e656dbb 12struct xfs_attr_list_context;
2bd0ea18
NS
13struct xfs_da_args;
14struct xfs_da_state;
15struct xfs_da_state_blk;
16struct xfs_inode;
17struct xfs_trans;
18
2bd0ea18
NS
19/*
20 * Used to keep a list of "remote value" extents when unlinking an inode.
21 */
22typedef struct xfs_attr_inactive_list {
23 xfs_dablk_t valueblk; /* block number of value bytes */
24 int valuelen; /* number of bytes in value */
25} xfs_attr_inactive_list_t;
26
27
28/*========================================================================
29 * Function prototypes for the kernel.
30 *========================================================================*/
31
32/*
ca86e759 33 * Internal routines when attribute fork size < XFS_LITINO(mp).
2bd0ea18 34 */
ca86e759
NS
35void xfs_attr_shortform_create(struct xfs_da_args *args);
36void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
2bd0ea18
NS
37int xfs_attr_shortform_lookup(struct xfs_da_args *args);
38int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
3fbc4d7d
DW
39int xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
40 struct xfs_buf **leaf_bp);
ca86e759 41int xfs_attr_shortform_remove(struct xfs_da_args *args);
a2ceac1f 42int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
b626fb59 43int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
c7a710b7 44xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
a37f46d5 45void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
2bd0ea18
NS
46
47/*
5a35bf2c 48 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
2bd0ea18 49 */
a24374f4
DC
50int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
51int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
ca86e759 52 struct xfs_da_args *args, int forkoff);
a24374f4
DC
53int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
54int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
55int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
2bd0ea18
NS
56
57/*
58 * Routines used for growing the Btree.
59 */
a24374f4 60int xfs_attr3_leaf_split(struct xfs_da_state *state,
2bd0ea18
NS
61 struct xfs_da_state_blk *oldblk,
62 struct xfs_da_state_blk *newblk);
a24374f4 63int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
2bd0ea18 64 struct xfs_da_args *args);
a24374f4
DC
65int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
66int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
2bd0ea18 67 struct xfs_da_args *args);
a24374f4 68int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
2bd0ea18 69 struct xfs_da_args *args);
601410bb 70void xfs_attr3_leaf_list_int(struct xfs_buf *bp,
2bd0ea18
NS
71 struct xfs_attr_list_context *context);
72
73/*
74 * Routines used for shrinking the Btree.
75 */
a24374f4
DC
76int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
77void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
2bd0ea18
NS
78 struct xfs_da_state_blk *drop_blk,
79 struct xfs_da_state_blk *save_blk);
2bd0ea18
NS
80/*
81 * Utility routines.
82 */
a2ceac1f
DC
83xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
84int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
85 struct xfs_buf *leaf2_bp);
ff105f75 86int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
a24374f4 87int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
a2ceac1f
DC
88 xfs_dablk_t bno, xfs_daddr_t mappedbno,
89 struct xfs_buf **bpp);
19ebedcf
DC
90void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
91 struct xfs_attr3_icleaf_hdr *to,
a24374f4 92 struct xfs_attr_leafblock *from);
19ebedcf
DC
93void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
94 struct xfs_attr_leafblock *to,
658ac3e3 95 struct xfs_attr3_icleaf_hdr *from);
a2ceac1f 96
2bd0ea18 97#endif /* __XFS_ATTR_LEAF_H__ */