xfs_attr_leaf.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc.
  4. * Copyright (c) 2013 Red Hat, Inc.
  5. * All Rights Reserved.
  6. */
  7. #ifndef __XFS_ATTR_LEAF_H__
  8. #define __XFS_ATTR_LEAF_H__
  9. struct attrlist;
  10. struct attrlist_cursor_kern;
  11. struct xfs_attr_list_context;
  12. struct xfs_da_args;
  13. struct xfs_da_state;
  14. struct xfs_da_state_blk;
  15. struct xfs_inode;
  16. struct xfs_trans;
  17. /*
  18. * Used to keep a list of "remote value" extents when unlinking an inode.
  19. */
  20. typedef struct xfs_attr_inactive_list {
  21. xfs_dablk_t valueblk; /* block number of value bytes */
  22. int valuelen; /* number of bytes in value */
  23. } xfs_attr_inactive_list_t;
  24. /*========================================================================
  25. * Function prototypes for the kernel.
  26. *========================================================================*/
  27. /*
  28. * Internal routines when attribute fork size < XFS_LITINO(mp).
  29. */
  30. void xfs_attr_shortform_create(struct xfs_da_args *args);
  31. void xfs_attr_shortform_add(struct xfs_da_args *args, int forkoff);
  32. int xfs_attr_shortform_lookup(struct xfs_da_args *args);
  33. int xfs_attr_shortform_getvalue(struct xfs_da_args *args);
  34. int xfs_attr_shortform_to_leaf(struct xfs_da_args *args,
  35. struct xfs_buf **leaf_bp);
  36. int xfs_attr_shortform_remove(struct xfs_da_args *args);
  37. int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
  38. int xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
  39. xfs_failaddr_t xfs_attr_shortform_verify(struct xfs_inode *ip);
  40. void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
  41. /*
  42. * Internal routines when attribute fork size == XFS_LBSIZE(mp).
  43. */
  44. int xfs_attr3_leaf_to_node(struct xfs_da_args *args);
  45. int xfs_attr3_leaf_to_shortform(struct xfs_buf *bp,
  46. struct xfs_da_args *args, int forkoff);
  47. int xfs_attr3_leaf_clearflag(struct xfs_da_args *args);
  48. int xfs_attr3_leaf_setflag(struct xfs_da_args *args);
  49. int xfs_attr3_leaf_flipflags(struct xfs_da_args *args);
  50. /*
  51. * Routines used for growing the Btree.
  52. */
  53. int xfs_attr3_leaf_split(struct xfs_da_state *state,
  54. struct xfs_da_state_blk *oldblk,
  55. struct xfs_da_state_blk *newblk);
  56. int xfs_attr3_leaf_lookup_int(struct xfs_buf *leaf,
  57. struct xfs_da_args *args);
  58. int xfs_attr3_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
  59. int xfs_attr3_leaf_add(struct xfs_buf *leaf_buffer,
  60. struct xfs_da_args *args);
  61. int xfs_attr3_leaf_remove(struct xfs_buf *leaf_buffer,
  62. struct xfs_da_args *args);
  63. void xfs_attr3_leaf_list_int(struct xfs_buf *bp,
  64. struct xfs_attr_list_context *context);
  65. /*
  66. * Routines used for shrinking the Btree.
  67. */
  68. int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
  69. void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
  70. struct xfs_da_state_blk *drop_blk,
  71. struct xfs_da_state_blk *save_blk);
  72. /*
  73. * Utility routines.
  74. */
  75. xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
  76. int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
  77. struct xfs_buf *leaf2_bp);
  78. int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int *local);
  79. int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp,
  80. xfs_dablk_t bno, xfs_daddr_t mappedbno,
  81. struct xfs_buf **bpp);
  82. void xfs_attr3_leaf_hdr_from_disk(struct xfs_da_geometry *geo,
  83. struct xfs_attr3_icleaf_hdr *to,
  84. struct xfs_attr_leafblock *from);
  85. void xfs_attr3_leaf_hdr_to_disk(struct xfs_da_geometry *geo,
  86. struct xfs_attr_leafblock *to,
  87. struct xfs_attr3_icleaf_hdr *from);
  88. #endif /* __XFS_ATTR_LEAF_H__ */