Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 3 | * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 4 | * Copyright (c) 2013 Red Hat, Inc. |
Nathan Scott | aa82daa | 2005-11-02 10:33:33 +1100 | [diff] [blame] | 5 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
| 7 | #ifndef __XFS_ATTR_LEAF_H__ |
| 8 | #define __XFS_ATTR_LEAF_H__ |
| 9 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | struct attrlist; |
| 11 | struct attrlist_cursor_kern; |
Christoph Hellwig | ad9b463 | 2008-06-23 13:23:48 +1000 | [diff] [blame] | 12 | struct xfs_attr_list_context; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | struct xfs_da_args; |
| 14 | struct xfs_da_state; |
| 15 | struct xfs_da_state_blk; |
| 16 | struct xfs_inode; |
| 17 | struct xfs_trans; |
| 18 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | /* |
| 20 | * Used to keep a list of "remote value" extents when unlinking an inode. |
| 21 | */ |
| 22 | typedef 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 Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 33 | * Internal routines when attribute fork size < XFS_LITINO(mp). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | */ |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 35 | void xfs_attr_shortform_create(struct xfs_da_args *args); |
| 36 | void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | int xfs_attr_shortform_lookup(struct xfs_da_args *args); |
| 38 | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); |
Darrick J. Wong | 6e643cd | 2017-12-07 19:07:02 -0800 | [diff] [blame] | 39 | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args, |
| 40 | struct xfs_buf **leaf_bp); |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 41 | int xfs_attr_shortform_remove(struct xfs_da_args *args); |
Dave Chinner | 1d9025e | 2012-06-22 18:50:14 +1000 | [diff] [blame] | 42 | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); |
Darrick J. Wong | ae90b99 | 2016-11-08 11:56:20 +1100 | [diff] [blame] | 43 | int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes); |
Darrick J. Wong | 1e1bbd8 | 2018-01-08 10:51:05 -0800 | [diff] [blame] | 44 | xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip); |
Dave Chinner | 6dfe5a0 | 2015-05-29 07:40:08 +1000 | [diff] [blame] | 45 | void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
| 47 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 48 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 50 | int xfs_attr3_leaf_to_node(struct xfs_da_args *args); |
| 51 | int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp, |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 52 | struct xfs_da_args *args, int forkoff); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 53 | int xfs_attr3_leaf_clearflag(struct xfs_da_args *args); |
| 54 | int xfs_attr3_leaf_setflag(struct xfs_da_args *args); |
| 55 | int xfs_attr3_leaf_flipflags(struct xfs_da_args *args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
| 57 | /* |
| 58 | * Routines used for growing the Btree. |
| 59 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 60 | int xfs_attr3_leaf_split(struct xfs_da_state *state, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | struct xfs_da_state_blk *oldblk, |
| 62 | struct xfs_da_state_blk *newblk); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 63 | int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 65 | int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args); |
| 66 | int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 68 | int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | struct xfs_da_args *args); |
Eric Sandeen | f7a136a | 2016-12-05 12:32:14 +1100 | [diff] [blame] | 70 | void xfs_attr3_leaf_list_int(struct xfs_buf *bp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | struct xfs_attr_list_context *context); |
| 72 | |
| 73 | /* |
| 74 | * Routines used for shrinking the Btree. |
| 75 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 76 | int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval); |
| 77 | void xfs_attr3_leaf_unbalance(struct xfs_da_state *state, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | struct xfs_da_state_blk *drop_blk, |
| 79 | struct xfs_da_state_blk *save_blk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | /* |
| 81 | * Utility routines. |
| 82 | */ |
Dave Chinner | 1d9025e | 2012-06-22 18:50:14 +1000 | [diff] [blame] | 83 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); |
| 84 | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, |
| 85 | struct xfs_buf *leaf2_bp); |
Dave Chinner | c59f0ad | 2014-06-06 15:21:27 +1000 | [diff] [blame] | 86 | int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 87 | int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, |
Dave Chinner | d9392a4 | 2012-11-12 22:54:17 +1100 | [diff] [blame] | 88 | xfs_dablk_t bno, xfs_daddr_t mappedbno, |
| 89 | struct xfs_buf **bpp); |
Brian Foster | 2f66124 | 2015-04-13 11:26:02 +1000 | [diff] [blame] | 90 | void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo, |
| 91 | struct xfs_attr3_icleaf_hdr *to, |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 92 | struct xfs_attr_leafblock *from); |
Brian Foster | 2f66124 | 2015-04-13 11:26:02 +1000 | [diff] [blame] | 93 | void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo, |
| 94 | struct xfs_attr_leafblock *to, |
Dave Chinner | d386b32 | 2013-08-12 20:49:31 +1000 | [diff] [blame] | 95 | struct xfs_attr3_icleaf_hdr *from); |
Dave Chinner | 1813dd6 | 2012-11-14 17:54:40 +1100 | [diff] [blame] | 96 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | #endif /* __XFS_ATTR_LEAF_H__ */ |