xfs_attr_leaf.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. struct attrlist;
  22. struct attrlist_cursor_kern;
  23. struct xfs_attr_list_context;
  24. struct xfs_da_args;
  25. struct xfs_da_state;
  26. struct xfs_da_state_blk;
  27. struct xfs_inode;
  28. struct xfs_trans;
  29. /*
  30. * Used to keep a list of "remote value" extents when unlinking an inode.
  31. */
  32. typedef struct xfs_attr_inactive_list {
  33. xfs_dablk_t valueblk; /* block number of value bytes */
  34. int valuelen; /* number of bytes in value */
  35. } xfs_attr_inactive_list_t;
  36. /*========================================================================
  37. * Function prototypes for the kernel.
  38. *========================================================================*/
  39. /*
  40. * Internal routines when attribute fork size < XFS_LITINO(mp).
  41. */
  42. void xfs_attr_shortform_create(struct xfs_da_args *args);
  43. void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
  44. int xfs_attr_shortform_lookup(struct xfs_da_args *args);
  45. int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
  46. int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
  47. int xfs_attr_shortform_remove(struct xfs_da_args *args);
  48. int xfs_attr_shortform_list(struct xfs_attr_list_context *context);
  49. int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
  50. int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
  51. void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
  52. /*
  53. * Internal routines when attribute fork size == XFS_LBSIZE(mp).
  54. */
  55. int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
  56. int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
  57. struct xfs_da_args *args, int forkoff);
  58. int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
  59. int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
  60. int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
  61. /*
  62. * Routines used for growing the Btree.
  63. */
  64. int xfs_attr3_leaf_split(struct xfs_da_state *state,
  65. struct xfs_da_state_blk *oldblk,
  66. struct xfs_da_state_blk *newblk);
  67. int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
  68. struct xfs_da_args *args);
  69. int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
  70. int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
  71. struct xfs_da_args *args);
  72. int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
  73. struct xfs_da_args *args);
  74. int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
  75. struct xfs_attr_list_context *context);
  76. /*
  77. * Routines used for shrinking the Btree.
  78. */
  79. int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
  80. void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
  81. struct xfs_da_state_blk *drop_blk,
  82. struct xfs_da_state_blk *save_blk);
  83. int xfs_attr3_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp);
  84. /*
  85. * Utility routines.
  86. */
  87. xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
  88. int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
  89. struct xfs_buf *leaf2_bp);
  90. int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
  91. int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
  92. xfs_dablk_t bno, xfs_daddr_t mappedbno,
  93. struct xfs_buf **bpp);
  94. void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
  95. struct xfs_attr3_icleaf_hdr *to,
  96. struct xfs_attr_leafblock *from);
  97. void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
  98. struct xfs_attr_leafblock *to,
  99. struct xfs_attr3_icleaf_hdr *from);
  100. #endif /* __XFS_ATTR_LEAF_H__ */