xfs_dir2.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. * Direct call on directory open, before entering the readdir code.
  62. */
  63. extern int xfs_dir3_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp,
  64. xfs_dablk_t bno, xfs_daddr_t mapped_bno);
  65. /*
  66. * Interface routines used by userspace utilities
  67. */
  68. extern xfs_ino_t xfs_dir2_sf_get_parent_ino(struct xfs_dir2_sf_hdr *sfp);
  69. extern void xfs_dir2_sf_put_parent_ino(struct xfs_dir2_sf_hdr *sfp,
  70. xfs_ino_t ino);
  71. extern xfs_ino_t xfs_dir2_sfe_get_ino(struct xfs_dir2_sf_hdr *sfp,
  72. struct xfs_dir2_sf_entry *sfep);
  73. extern void xfs_dir2_sfe_put_ino( struct xfs_dir2_sf_hdr *,
  74. struct xfs_dir2_sf_entry *sfep, xfs_ino_t ino);
  75. extern int xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
  76. extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *r);
  77. extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
  78. struct xfs_buf *bp);
  79. extern void xfs_dir2_data_freescan(struct xfs_mount *mp,
  80. struct xfs_dir2_data_hdr *hdr, int *loghead);
  81. extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_buf *bp,
  82. struct xfs_dir2_data_entry *dep);
  83. extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
  84. struct xfs_buf *bp);
  85. extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp,
  86. struct xfs_dir2_data_unused *dup);
  87. extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *bp,
  88. xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
  89. int *needlogp, int *needscanp);
  90. extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp,
  91. struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset,
  92. xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
  93. extern struct xfs_dir2_data_free *xfs_dir2_data_freefind(
  94. struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_unused *dup);
  95. extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
  96. extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops;
  97. extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
  98. extern const struct xfs_buf_ops xfs_dir3_free_buf_ops;
  99. extern const struct xfs_buf_ops xfs_dir3_data_buf_ops;
  100. #endif /* __XFS_DIR2_H__ */