xfs_dir2.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_DIR2_H__
  33. #define __XFS_DIR2_H__
  34. struct uio;
  35. struct xfs_dabuf;
  36. struct xfs_da_args;
  37. struct xfs_dir2_put_args;
  38. struct xfs_inode;
  39. struct xfs_trans;
  40. /*
  41. * Directory version 2.
  42. * There are 4 possible formats:
  43. * shortform
  44. * single block - data with embedded leaf at the end
  45. * multiple data blocks, single leaf+freeindex block
  46. * data blocks, node&leaf blocks (btree), freeindex blocks
  47. *
  48. * The shortform format is in xfs_dir2_sf.h.
  49. * The single block format is in xfs_dir2_block.h.
  50. * The data block format is in xfs_dir2_data.h.
  51. * The leaf and freeindex block formats are in xfs_dir2_leaf.h.
  52. * Node blocks are the same as the other version, in xfs_da_btree.h.
  53. */
  54. /*
  55. * Byte offset in data block and shortform entry.
  56. */
  57. typedef __uint16_t xfs_dir2_data_off_t;
  58. #define NULLDATAOFF 0xffffU
  59. typedef uint xfs_dir2_data_aoff_t; /* argument form */
  60. /*
  61. * Directory block number (logical dirblk in file)
  62. */
  63. typedef __uint32_t xfs_dir2_db_t;
  64. /*
  65. * Byte offset in a directory.
  66. */
  67. typedef xfs_off_t xfs_dir2_off_t;
  68. /*
  69. * For getdents, argument struct for put routines.
  70. */
  71. typedef int (*xfs_dir2_put_t)(struct xfs_dir2_put_args *pa);
  72. typedef struct xfs_dir2_put_args {
  73. xfs_off_t cook; /* cookie of (next) entry */
  74. xfs_intino_t ino; /* inode number */
  75. struct xfs_dirent *dbp; /* buffer pointer */
  76. char *name; /* directory entry name */
  77. int namelen; /* length of name */
  78. int done; /* output: set if value was stored */
  79. xfs_dir2_put_t put; /* put function ptr (i/o) */
  80. struct uio *uio; /* uio control structure */
  81. } xfs_dir2_put_args_t;
  82. #define XFS_DIR_IS_V2(mp) ((mp)->m_dirversion == 2)
  83. extern xfs_dirops_t xfsv2_dirops;
  84. /*
  85. * Other interfaces used by the rest of the dir v2 code.
  86. */
  87. extern int
  88. xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
  89. xfs_dir2_db_t *dbp);
  90. extern int
  91. xfs_dir2_isblock(struct xfs_trans *tp, struct xfs_inode *dp, int *vp);
  92. extern int
  93. xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp, int *vp);
  94. extern int
  95. xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
  96. struct xfs_dabuf *bp);
  97. #endif /* __XFS_DIR2_H__ */