blob: 4da08af5b13401a08e454f60620f4e1cde44c7a5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
Dave Chinner517c2222013-04-24 18:58:55 +10003 * Copyright (c) 2013 Red Hat, Inc.
Nathan Scottaa82daa2005-11-02 10:33:33 +11004 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Nathan Scott7b718762005-11-02 14:58:39 +11006 * 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 Torvalds1da177e2005-04-16 15:20:36 -07008 * published by the Free Software Foundation.
9 *
Nathan Scott7b718762005-11-02 14:58:39 +110010 * 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 Torvalds1da177e2005-04-16 15:20:36 -070014 *
Nathan Scott7b718762005-11-02 14:58:39 +110015 * 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 Torvalds1da177e2005-04-16 15:20:36 -070018 */
19#ifndef __XFS_ATTR_LEAF_H__
20#define __XFS_ATTR_LEAF_H__
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022struct attrlist;
23struct attrlist_cursor_kern;
Christoph Hellwigad9b4632008-06-23 13:23:48 +100024struct xfs_attr_list_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025struct xfs_da_args;
26struct xfs_da_state;
27struct xfs_da_state_blk;
28struct xfs_inode;
29struct xfs_trans;
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031/*
32 * Used to keep a list of "remote value" extents when unlinking an inode.
33 */
34typedef 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 Scottd8cc8902005-11-02 10:34:53 +110045 * Internal routines when attribute fork size < XFS_LITINO(mp).
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 */
Nathan Scottd8cc8902005-11-02 10:34:53 +110047void xfs_attr_shortform_create(struct xfs_da_args *args);
48void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049int xfs_attr_shortform_lookup(struct xfs_da_args *args);
50int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
Darrick J. Wong6e643cd2017-12-07 19:07:02 -080051int xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
52 struct xfs_buf **leaf_bp);
Nathan Scottd8cc8902005-11-02 10:34:53 +110053int xfs_attr_shortform_remove(struct xfs_da_args *args);
Dave Chinner1d9025e2012-06-22 18:50:14 +100054int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
Darrick J. Wongae90b992016-11-08 11:56:20 +110055int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
Darrick J. Wong1e1bbd82018-01-08 10:51:05 -080056xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
Dave Chinner6dfe5a02015-05-29 07:40:08 +100057void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
59/*
Nathan Scottd8cc8902005-11-02 10:34:53 +110060 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 */
Dave Chinner517c2222013-04-24 18:58:55 +100062int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
63int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
Nathan Scottd8cc8902005-11-02 10:34:53 +110064 struct xfs_da_args *args, int forkoff);
Dave Chinner517c2222013-04-24 18:58:55 +100065int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
66int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
67int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69/*
70 * Routines used for growing the Btree.
71 */
Dave Chinner517c2222013-04-24 18:58:55 +100072int xfs_attr3_leaf_split(struct xfs_da_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 struct xfs_da_state_blk *oldblk,
74 struct xfs_da_state_blk *newblk);
Dave Chinner517c2222013-04-24 18:58:55 +100075int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 struct xfs_da_args *args);
Dave Chinner517c2222013-04-24 18:58:55 +100077int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
78int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 struct xfs_da_args *args);
Dave Chinner517c2222013-04-24 18:58:55 +100080int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 struct xfs_da_args *args);
Eric Sandeenf7a136a2016-12-05 12:32:14 +110082void xfs_attr3_leaf_list_int(struct xfs_buf *bp,
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 struct xfs_attr_list_context *context);
84
85/*
86 * Routines used for shrinking the Btree.
87 */
Dave Chinner517c2222013-04-24 18:58:55 +100088int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
89void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 struct xfs_da_state_blk *drop_blk,
91 struct xfs_da_state_blk *save_blk);
Linus Torvalds1da177e2005-04-16 15:20:36 -070092/*
93 * Utility routines.
94 */
Dave Chinner1d9025e2012-06-22 18:50:14 +100095xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
96int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
97 struct xfs_buf *leaf2_bp);
Dave Chinnerc59f0ad2014-06-06 15:21:27 +100098int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
Dave Chinner517c2222013-04-24 18:58:55 +100099int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
Dave Chinnerd9392a42012-11-12 22:54:17 +1100100 xfs_dablk_t bno, xfs_daddr_t mappedbno,
101 struct xfs_buf **bpp);
Brian Foster2f661242015-04-13 11:26:02 +1000102void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
103 struct xfs_attr3_icleaf_hdr *to,
Dave Chinner517c2222013-04-24 18:58:55 +1000104 struct xfs_attr_leafblock *from);
Brian Foster2f661242015-04-13 11:26:02 +1000105void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
106 struct xfs_attr_leafblock *to,
Dave Chinnerd386b322013-08-12 20:49:31 +1000107 struct xfs_attr3_icleaf_hdr *from);
Dave Chinner1813dd62012-11-14 17:54:40 +1100108
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109#endif /* __XFS_ATTR_LEAF_H__ */