blob: 8ef420a16f0819ea4e97a3ce9f58767cb5b75513 [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);
51int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
Nathan Scottd8cc8902005-11-02 10:34:53 +110052int xfs_attr_shortform_remove(struct xfs_da_args *args);
Dave Chinner1d9025e2012-06-22 18:50:14 +100053int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
Darrick J. Wongae90b992016-11-08 11:56:20 +110054int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
Dave Chinner6dfe5a02015-05-29 07:40:08 +100055void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57/*
Nathan Scottd8cc8902005-11-02 10:34:53 +110058 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 */
Dave Chinner517c2222013-04-24 18:58:55 +100060int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
61int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
Nathan Scottd8cc8902005-11-02 10:34:53 +110062 struct xfs_da_args *args, int forkoff);
Dave Chinner517c2222013-04-24 18:58:55 +100063int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
64int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
65int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67/*
68 * Routines used for growing the Btree.
69 */
Dave Chinner517c2222013-04-24 18:58:55 +100070int xfs_attr3_leaf_split(struct xfs_da_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 struct xfs_da_state_blk *oldblk,
72 struct xfs_da_state_blk *newblk);
Dave Chinner517c2222013-04-24 18:58:55 +100073int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 struct xfs_da_args *args);
Dave Chinner517c2222013-04-24 18:58:55 +100075int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
76int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 struct xfs_da_args *args);
Dave Chinner517c2222013-04-24 18:58:55 +100078int xfs_attr3_leaf_remove(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_list_int(struct xfs_buf *bp,
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 struct xfs_attr_list_context *context);
82
83/*
84 * Routines used for shrinking the Btree.
85 */
Dave Chinner517c2222013-04-24 18:58:55 +100086int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
87void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 struct xfs_da_state_blk *drop_blk,
89 struct xfs_da_state_blk *save_blk);
Linus Torvalds1da177e2005-04-16 15:20:36 -070090/*
91 * Utility routines.
92 */
Dave Chinner1d9025e2012-06-22 18:50:14 +100093xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
94int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
95 struct xfs_buf *leaf2_bp);
Dave Chinnerc59f0ad2014-06-06 15:21:27 +100096int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
Dave Chinner517c2222013-04-24 18:58:55 +100097int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
Dave Chinnerd9392a42012-11-12 22:54:17 +110098 xfs_dablk_t bno, xfs_daddr_t mappedbno,
99 struct xfs_buf **bpp);
Brian Foster2f661242015-04-13 11:26:02 +1000100void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
101 struct xfs_attr3_icleaf_hdr *to,
Dave Chinner517c2222013-04-24 18:58:55 +1000102 struct xfs_attr_leafblock *from);
Brian Foster2f661242015-04-13 11:26:02 +1000103void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
104 struct xfs_attr_leafblock *to,
Dave Chinnerd386b322013-08-12 20:49:31 +1000105 struct xfs_attr3_icleaf_hdr *from);
Dave Chinner1813dd62012-11-14 17:54:40 +1100106
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107#endif /* __XFS_ATTR_LEAF_H__ */