xfs_dir2.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_DIR2_H__
  19. #define __XFS_DIR2_H__
  20. struct xfs_bmap_free;
  21. struct xfs_da_args;
  22. struct xfs_inode;
  23. struct xfs_mount;
  24. struct xfs_trans;
  25. struct xfs_dir2_sf_hdr;
  26. struct xfs_dir2_sf_entry;
  27. struct xfs_dir2_data_hdr;
  28. struct xfs_dir2_data_entry;
  29. struct xfs_dir2_data_unused;
  30. extern struct xfs_name xfs_name_dotdot;
  31. /*
  32. * Generic directory interface routines
  33. */
  34. extern void xfs_dir_startup(void);
  35. extern void xfs_dir_mount(struct xfs_mount *mp);
  36. extern int xfs_dir_isempty(struct xfs_inode *dp);
  37. extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
  38. struct xfs_inode *pdp);
  39. extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
  40. struct xfs_name *name, xfs_ino_t inum,
  41. xfs_fsblock_t *first,
  42. struct xfs_bmap_free *flist, xfs_extlen_t tot);
  43. extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
  44. struct xfs_name *name, xfs_ino_t *inum,
  45. struct xfs_name *ci_name);
  46. extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
  47. struct xfs_name *name, xfs_ino_t ino,
  48. xfs_fsblock_t *first,
  49. struct xfs_bmap_free *flist, xfs_extlen_t tot);
  50. extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
  51. struct xfs_name *name, xfs_ino_t inum,
  52. xfs_fsblock_t *first,
  53. struct xfs_bmap_free *flist, xfs_extlen_t tot);
  54. extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
  55. struct xfs_name *name, uint resblks);
  56. /*
  57. * Direct call from the bmap code, bypassing the generic directory layer.
  58. */
  59. extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);
  60. /*
  61. * Interface routines used by userspace utilities
  62. */
  63. extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
  64. extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
  65. xfs_ino_t ino);
  66. extern xfs_ino_t xfs_dir3_sfe_get_ino(struct xfs_mount *mp,
  67. struct xfs_dir2_sf_hdr *sfp, struct xfs_dir2_sf_entry *sfep);
  68. extern void xfs_dir3_sfe_put_ino(struct xfs_mount *mp,
  69. struct xfs_dir2_sf_hdr *hdr, struct xfs_dir2_sf_entry *sfep,
  70. xfs_ino_t ino);
  71. extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
  72. extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
  73. extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
  74. struct xfs_buf *bp);
  75. extern void xfs_dir2_data_freescan(struct xfs_mount *mp,
  76. struct xfs_dir2_data_hdr *hdr, int *loghead);
  77. extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_buf *bp,
  78. struct xfs_dir2_data_entry *dep);
  79. extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
  80. struct xfs_buf *bp);
  81. extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp,
  82. struct xfs_dir2_data_unused *dup);
  83. extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *bp,
  84. xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
  85. int *needlogp, int *needscanp);
  86. extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp,
  87. struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset,
  88. xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
  89. extern struct xfs_dir2_data_free *xfs_dir2_data_freefind(
  90. struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_unused *dup);
  91. extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
  92. extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops;
  93. extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
  94. extern const struct xfs_buf_ops xfs_dir3_free_buf_ops;
  95. extern const struct xfs_buf_ops xfs_dir3_data_buf_ops;
  96. #endif /* __XFS_DIR2_H__ */