Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 3 | * Copyright (c) 2013 Red Hat, Inc. |
Nathan Scott | aa82daa | 2005-11-02 10:33:33 +1100 | [diff] [blame] | 4 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * published by the Free Software Foundation. |
| 9 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 10 | * This program is distributed in the hope that it would be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write the Free Software Foundation, |
| 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | */ |
| 19 | #ifndef __XFS_ATTR_LEAF_H__ |
| 20 | #define __XFS_ATTR_LEAF_H__ |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | struct attrlist; |
| 23 | struct attrlist_cursor_kern; |
Christoph Hellwig | ad9b463 | 2008-06-23 13:23:48 +1000 | [diff] [blame] | 24 | struct xfs_attr_list_context; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | struct xfs_da_args; |
| 26 | struct xfs_da_state; |
| 27 | struct xfs_da_state_blk; |
| 28 | struct xfs_inode; |
| 29 | struct xfs_trans; |
| 30 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | /* |
| 32 | * Used to keep a list of "remote value" extents when unlinking an inode. |
| 33 | */ |
| 34 | typedef struct xfs_attr_inactive_list { |
| 35 | xfs_dablk_t valueblk; /* block number of value bytes */ |
| 36 | int valuelen; /* number of bytes in value */ |
| 37 | } xfs_attr_inactive_list_t; |
| 38 | |
| 39 | |
| 40 | /*======================================================================== |
| 41 | * Function prototypes for the kernel. |
| 42 | *========================================================================*/ |
| 43 | |
| 44 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 45 | * Internal routines when attribute fork size < XFS_LITINO(mp). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | */ |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 47 | void xfs_attr_shortform_create(struct xfs_da_args *args); |
| 48 | void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | int xfs_attr_shortform_lookup(struct xfs_da_args *args); |
| 50 | int xfs_attr_shortform_getvalue(struct xfs_da_args *args); |
| 51 | int xfs_attr_shortform_to_leaf(struct xfs_da_args *args); |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 52 | int xfs_attr_shortform_remove(struct xfs_da_args *args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); |
Dave Chinner | 1d9025e | 2012-06-22 18:50:14 +1000 | [diff] [blame] | 54 | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 55 | int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
| 58 | /* |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 59 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 61 | int xfs_attr3_leaf_to_node(struct xfs_da_args *args); |
| 62 | int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp, |
Nathan Scott | d8cc890 | 2005-11-02 10:34:53 +1100 | [diff] [blame] | 63 | struct xfs_da_args *args, int forkoff); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 64 | int xfs_attr3_leaf_clearflag(struct xfs_da_args *args); |
| 65 | int xfs_attr3_leaf_setflag(struct xfs_da_args *args); |
| 66 | int xfs_attr3_leaf_flipflags(struct xfs_da_args *args); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | /* |
| 69 | * Routines used for growing the Btree. |
| 70 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 71 | int xfs_attr3_leaf_split(struct xfs_da_state *state, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | struct xfs_da_state_blk *oldblk, |
| 73 | struct xfs_da_state_blk *newblk); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 74 | int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 76 | int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args); |
| 77 | int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 79 | int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | struct xfs_da_args *args); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 81 | int xfs_attr3_leaf_list_int(struct xfs_buf *bp, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | struct xfs_attr_list_context *context); |
| 83 | |
| 84 | /* |
| 85 | * Routines used for shrinking the Btree. |
| 86 | */ |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 87 | int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval); |
| 88 | void xfs_attr3_leaf_unbalance(struct xfs_da_state *state, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | struct xfs_da_state_blk *drop_blk, |
| 90 | struct xfs_da_state_blk *save_blk); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 91 | int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
| 93 | /* |
| 94 | * Utility routines. |
| 95 | */ |
Dave Chinner | 1d9025e | 2012-06-22 18:50:14 +1000 | [diff] [blame] | 96 | xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count); |
| 97 | int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp, |
| 98 | struct xfs_buf *leaf2_bp); |
Dave Chinner | c59f0ad | 2014-06-06 15:21:27 +1000 | [diff] [blame] | 99 | int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 100 | 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] | 101 | xfs_dablk_t bno, xfs_daddr_t mappedbno, |
| 102 | struct xfs_buf **bpp); |
Dave Chinner | 517c222 | 2013-04-24 18:58:55 +1000 | [diff] [blame] | 103 | void xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to, |
| 104 | struct xfs_attr_leafblock *from); |
Dave Chinner | d386b32 | 2013-08-12 20:49:31 +1000 | [diff] [blame] | 105 | void xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to, |
| 106 | struct xfs_attr3_icleaf_hdr *from); |
Dave Chinner | 1813dd6 | 2012-11-14 17:54:40 +1100 | [diff] [blame] | 107 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | #endif /* __XFS_ATTR_LEAF_H__ */ |