blob: 7b74e18becff79950778a62faf0a9a31b2becdc6 [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Nathan Scott7b718762005-11-02 14:58:39 +11003 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
Dave Chinner517c2222013-04-24 18:58:55 +10004 * Copyright (c) 2013 Red Hat, Inc.
Nathan Scottaa82daa2005-11-02 10:33:33 +11005 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7#ifndef __XFS_ATTR_LEAF_H__
8#define __XFS_ATTR_LEAF_H__
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010struct attrlist;
11struct attrlist_cursor_kern;
Christoph Hellwigad9b4632008-06-23 13:23:48 +100012struct xfs_attr_list_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -070013struct xfs_da_args;
14struct xfs_da_state;
15struct xfs_da_state_blk;
16struct xfs_inode;
17struct xfs_trans;
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019/*
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/*
Nathan Scottd8cc8902005-11-02 10:34:53 +110033 * Internal routines when attribute fork size < XFS_LITINO(mp).
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 */
Nathan Scottd8cc8902005-11-02 10:34:53 +110035void xfs_attr_shortform_create(struct xfs_da_args *args);
36void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037int xfs_attr_shortform_lookup(struct xfs_da_args *args);
38int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
Darrick J. Wong6e643cd2017-12-07 19:07:02 -080039int xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
40 struct xfs_buf **leaf_bp);
Nathan Scottd8cc8902005-11-02 10:34:53 +110041int xfs_attr_shortform_remove(struct xfs_da_args *args);
Dave Chinner1d9025e2012-06-22 18:50:14 +100042int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
Darrick J. Wongae90b992016-11-08 11:56:20 +110043int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
Darrick J. Wong1e1bbd82018-01-08 10:51:05 -080044xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
Dave Chinner6dfe5a02015-05-29 07:40:08 +100045void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47/*
Nathan Scottd8cc8902005-11-02 10:34:53 +110048 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 */
Dave Chinner517c2222013-04-24 18:58:55 +100050int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
51int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
Nathan Scottd8cc8902005-11-02 10:34:53 +110052 struct xfs_da_args *args, int forkoff);
Dave Chinner517c2222013-04-24 18:58:55 +100053int 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);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57/*
58 * Routines used for growing the Btree.
59 */
Dave Chinner517c2222013-04-24 18:58:55 +100060int xfs_attr3_leaf_split(struct xfs_da_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 struct xfs_da_state_blk *oldblk,
62 struct xfs_da_state_blk *newblk);
Dave Chinner517c2222013-04-24 18:58:55 +100063int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 struct xfs_da_args *args);
Dave Chinner517c2222013-04-24 18:58:55 +100065int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
66int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 struct xfs_da_args *args);
Dave Chinner517c2222013-04-24 18:58:55 +100068int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 struct xfs_da_args *args);
Eric Sandeenf7a136a2016-12-05 12:32:14 +110070void xfs_attr3_leaf_list_int(struct xfs_buf *bp,
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 struct xfs_attr_list_context *context);
72
73/*
74 * Routines used for shrinking the Btree.
75 */
Dave Chinner517c2222013-04-24 18:58:55 +100076int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
77void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 struct xfs_da_state_blk *drop_blk,
79 struct xfs_da_state_blk *save_blk);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080/*
81 * Utility routines.
82 */
Dave Chinner1d9025e2012-06-22 18:50:14 +100083xfs_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);
Dave Chinnerc59f0ad2014-06-06 15:21:27 +100086int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
Dave Chinner517c2222013-04-24 18:58:55 +100087int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
Dave Chinnerd9392a42012-11-12 22:54:17 +110088 xfs_dablk_t bno, xfs_daddr_t mappedbno,
89 struct xfs_buf **bpp);
Brian Foster2f661242015-04-13 11:26:02 +100090void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
91 struct xfs_attr3_icleaf_hdr *to,
Dave Chinner517c2222013-04-24 18:58:55 +100092 struct xfs_attr_leafblock *from);
Brian Foster2f661242015-04-13 11:26:02 +100093void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
94 struct xfs_attr_leafblock *to,
Dave Chinnerd386b322013-08-12 20:49:31 +100095 struct xfs_attr3_icleaf_hdr *from);
Dave Chinner1813dd62012-11-14 17:54:40 +110096
Linus Torvalds1da177e2005-04-16 15:20:36 -070097#endif /* __XFS_ATTR_LEAF_H__ */