linux/fs/xfs/xfs_attr_leaf.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
   3 * Copyright (c) 2013 Red Hat, Inc.
   4 * All Rights Reserved.
   5 *
   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
   8 * published by the Free Software Foundation.
   9 *
  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.
  14 *
  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
  18 */
  19#ifndef __XFS_ATTR_LEAF_H__
  20#define __XFS_ATTR_LEAF_H__
  21
  22struct attrlist;
  23struct attrlist_cursor_kern;
  24struct xfs_attr_list_context;
  25struct xfs_da_args;
  26struct xfs_da_state;
  27struct xfs_da_state_blk;
  28struct xfs_inode;
  29struct xfs_trans;
  30
  31/*
  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/*
  45 * Internal routines when attribute fork size < XFS_LITINO(mp).
  46 */
  47void    xfs_attr_shortform_create(struct xfs_da_args *args);
  48void    xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
  49int     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);
  52int     xfs_attr_shortform_remove(struct xfs_da_args *args);
  53int     xfs_attr_shortform_list(struct xfs_attr_list_context *context);
  54int     xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
  55int     xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
  56
  57
  58/*
  59 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
  60 */
  61int     xfs_attr3_leaf_to_node(struct xfs_da_args *args);
  62int     xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
  63                                   struct xfs_da_args *args, int forkoff);
  64int     xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
  65int     xfs_attr3_leaf_setflag(struct xfs_da_args *args);
  66int     xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
  67
  68/*
  69 * Routines used for growing the Btree.
  70 */
  71int     xfs_attr3_leaf_split(struct xfs_da_state *state,
  72                                   struct xfs_da_state_blk *oldblk,
  73                                   struct xfs_da_state_blk *newblk);
  74int     xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
  75                                        struct xfs_da_args *args);
  76int     xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
  77int     xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
  78                                 struct xfs_da_args *args);
  79int     xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
  80                                    struct xfs_da_args *args);
  81int     xfs_attr3_leaf_list_int(struct xfs_buf *bp,
  82                                      struct xfs_attr_list_context *context);
  83
  84/*
  85 * Routines used for shrinking the Btree.
  86 */
  87int     xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
  88void    xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
  89                                       struct xfs_da_state_blk *drop_blk,
  90                                       struct xfs_da_state_blk *save_blk);
  91int     xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp);
  92
  93/*
  94 * Utility routines.
  95 */
  96xfs_dahash_t    xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
  97int     xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
  98                                   struct xfs_buf *leaf2_bp);
  99int     xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
 100int     xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
 101                        xfs_dablk_t bno, xfs_daddr_t mappedbno,
 102                        struct xfs_buf **bpp);
 103void    xfs_attr3_leaf_hdr_from_disk(struct xfs_attr3_icleaf_hdr *to,
 104                                     struct xfs_attr_leafblock *from);
 105void    xfs_attr3_leaf_hdr_to_disk(struct xfs_attr_leafblock *to,
 106                                   struct xfs_attr3_icleaf_hdr *from);
 107
 108#endif  /* __XFS_ATTR_LEAF_H__ */
 109