ffs_extern.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /* $OpenBSD: ffs_extern.h,v 1.40 2014/01/25 23:31:12 guenther Exp $ */
  2. /* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */
  3. /*
  4. * Copyright (c) 1991, 1993, 1994
  5. * The Regents of the University of California. All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the University nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. * SUCH DAMAGE.
  30. *
  31. * @(#)ffs_extern.h 8.3 (Berkeley) 4/16/94
  32. */
  33. #define FFS_CLUSTERREAD 1 /* cluster reading enabled */
  34. #define FFS_CLUSTERWRITE 2 /* cluster writing enabled */
  35. #define FFS_REALLOCBLKS 3 /* block reallocation enabled */
  36. #define FFS_ASYNCFREE 4 /* asynchronous block freeing enabled */
  37. #define FFS_MAX_SOFTDEPS 5 /* maximum structs before slowdown */
  38. #define FFS_SD_TICKDELAY 6 /* ticks to pause during slowdown */
  39. #define FFS_SD_WORKLIST_PUSH 7 /* # of worklist cleanups */
  40. #define FFS_SD_BLK_LIMIT_PUSH 8 /* # of times block limit neared */
  41. #define FFS_SD_INO_LIMIT_PUSH 9 /* # of times inode limit neared */
  42. #define FFS_SD_BLK_LIMIT_HIT 10 /* # of times block slowdown imposed */
  43. #define FFS_SD_INO_LIMIT_HIT 11 /* # of times inode slowdown imposed */
  44. #define FFS_SD_SYNC_LIMIT_HIT 12 /* # of synchronous slowdowns imposed */
  45. #define FFS_SD_INDIR_BLK_PTRS 13 /* bufs redirtied as indir ptrs not written */
  46. #define FFS_SD_INODE_BITMAP 14 /* bufs redirtied as inode bitmap not written */
  47. #define FFS_SD_DIRECT_BLK_PTRS 15 /* bufs redirtied as direct ptrs not written */
  48. #define FFS_SD_DIR_ENTRY 16 /* bufs redirtied as dir entry cannot write */
  49. #define FFS_DIRHASH_DIRSIZE 17 /* min directory size, in bytes */
  50. #define FFS_DIRHASH_MAXMEM 18 /* max kvm to use, in bytes */
  51. #define FFS_DIRHASH_MEM 19 /* current mem usage, in bytes */
  52. #define FFS_MAXID 20 /* number of valid ffs ids */
  53. #define FFS_NAMES { \
  54. { 0, 0 }, \
  55. { "doclusterread", CTLTYPE_INT }, \
  56. { "doclusterwrite", CTLTYPE_INT }, \
  57. { "doreallocblks", CTLTYPE_INT }, \
  58. { "doasyncfree", CTLTYPE_INT }, \
  59. { "max_softdeps", CTLTYPE_INT }, \
  60. { "sd_tickdelay", CTLTYPE_INT }, \
  61. { "sd_worklist_push", CTLTYPE_INT }, \
  62. { "sd_blk_limit_push", CTLTYPE_INT }, \
  63. { "sd_ino_limit_push", CTLTYPE_INT }, \
  64. { "sd_blk_limit_hit", CTLTYPE_INT }, \
  65. { "sd_ino_limit_hit", CTLTYPE_INT }, \
  66. { "sd_sync_limit_hit", CTLTYPE_INT }, \
  67. { "sd_indir_blk_ptrs", CTLTYPE_INT }, \
  68. { "sd_inode_bitmap", CTLTYPE_INT }, \
  69. { "sd_direct_blk_ptrs", CTLTYPE_INT }, \
  70. { "sd_dir_entry", CTLTYPE_INT }, \
  71. { "dirhash_dirsize", CTLTYPE_INT }, \
  72. { "dirhash_maxmem", CTLTYPE_INT }, \
  73. { "dirhash_mem", CTLTYPE_INT }, \
  74. }
  75. struct buf;
  76. struct fid;
  77. struct fs;
  78. struct inode;
  79. struct mount;
  80. struct nameidata;
  81. struct proc;
  82. struct statfs;
  83. struct timeval;
  84. struct ucred;
  85. struct ufsmount;
  86. struct vfsconf;
  87. struct uio;
  88. struct vnode;
  89. struct mbuf;
  90. struct cg;
  91. struct vop_vfree_args;
  92. extern struct vops ffs_vops;
  93. extern struct vops ffs_specvops;
  94. extern struct vops ffs_fifovops;
  95. /* ffs_alloc.c */
  96. int ffs_alloc(struct inode *, daddr_t, daddr_t , int, struct ucred *,
  97. daddr_t *);
  98. int ffs_realloccg(struct inode *, daddr_t, daddr_t, int, int ,
  99. struct ucred *, struct buf **, daddr_t *);
  100. int ffs_reallocblks(void *);
  101. int ffs_inode_alloc(struct inode *, mode_t, struct ucred *, struct vnode **);
  102. int ffs_inode_free(struct inode *, ufsino_t, mode_t);
  103. int ffs_freefile(struct inode *, ufsino_t, mode_t);
  104. int32_t ffs1_blkpref(struct inode *, daddr_t, int, int32_t *);
  105. #ifdef FFS2
  106. int64_t ffs2_blkpref(struct inode *, daddr_t, int, int64_t *);
  107. #endif
  108. void ffs_blkfree(struct inode *, daddr_t, long);
  109. void ffs_clusteracct(struct fs *, struct cg *, daddr_t, int);
  110. /* ffs_balloc.c */
  111. int ffs_balloc(struct inode *, off_t, int, struct ucred *, int, struct buf **);
  112. /* ffs_inode.c */
  113. int ffs_init(struct vfsconf *);
  114. int ffs_update(struct inode *, int);
  115. int ffs_truncate(struct inode *, off_t, int, struct ucred *);
  116. /* ffs_subr.c */
  117. int ffs_bufatoff(struct inode *, off_t, char **, struct buf **);
  118. void ffs_fragacct(struct fs *, int, int32_t[], int);
  119. #ifdef DIAGNOSTIC
  120. void ffs_checkoverlap(struct buf *, struct inode *);
  121. #endif
  122. int ffs_isfreeblock(struct fs *, u_char *, daddr_t);
  123. int ffs_isblock(struct fs *, u_char *, daddr_t);
  124. void ffs_clrblock(struct fs *, u_char *, daddr_t);
  125. void ffs_setblock(struct fs *, u_char *, daddr_t);
  126. /* ffs_vfsops.c */
  127. int ffs_mountroot(void);
  128. int ffs_mount(struct mount *, const char *, void *, struct nameidata *,
  129. struct proc *);
  130. int ffs_reload(struct mount *, struct ucred *, struct proc *);
  131. int ffs_mountfs(struct vnode *, struct mount *, struct proc *);
  132. int ffs_oldfscompat(struct fs *);
  133. int ffs_unmount(struct mount *, int, struct proc *);
  134. int ffs_flushfiles(struct mount *, int, struct proc *);
  135. int ffs_statfs(struct mount *, struct statfs *, struct proc *);
  136. int ffs_sync(struct mount *, int, struct ucred *, struct proc *);
  137. int ffs_vget(struct mount *, ino_t, struct vnode **);
  138. int ffs_fhtovp(struct mount *, struct fid *, struct vnode **);
  139. int ffs_vptofh(struct vnode *, struct fid *);
  140. int ffs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
  141. struct proc *);
  142. int ffs_sbupdate(struct ufsmount *, int);
  143. int ffs_cgupdate(struct ufsmount *, int);
  144. /* ffs_vnops.c */
  145. int ffs_read(void *);
  146. int ffs_write(void *);
  147. int ffs_fsync(void *);
  148. int ffs_reclaim(void *);
  149. int ffsfifo_reclaim(void *);
  150. /*
  151. * Soft dependency function prototypes.
  152. */
  153. struct vop_vfree_args;
  154. struct vop_fsync_args;
  155. void softdep_initialize(void);
  156. int softdep_process_worklist(struct mount *);
  157. int softdep_mount(struct vnode *, struct mount *, struct fs *,
  158. struct ucred *);
  159. int softdep_flushworklist(struct mount *, int *, struct proc *);
  160. int softdep_flushfiles(struct mount *, int, struct proc *);
  161. void softdep_update_inodeblock(struct inode *, struct buf *, int);
  162. void softdep_load_inodeblock(struct inode *);
  163. void softdep_freefile(struct vnode *, ufsino_t, mode_t);
  164. void softdep_setup_freeblocks(struct inode *, off_t);
  165. void softdep_setup_inomapdep(struct buf *, struct inode *, ufsino_t);
  166. void softdep_setup_blkmapdep(struct buf *, struct fs *, daddr_t);
  167. void softdep_setup_allocdirect(struct inode *, daddr_t, daddr_t,
  168. daddr_t, long, long, struct buf *);
  169. void softdep_setup_allocindir_meta(struct buf *, struct inode *,
  170. struct buf *, int, daddr_t);
  171. void softdep_setup_allocindir_page(struct inode *, daddr_t,
  172. struct buf *, int, daddr_t, daddr_t, struct buf *);
  173. void softdep_fsync_mountdev(struct vnode *, int);
  174. int softdep_sync_metadata(struct vop_fsync_args *);
  175. int softdep_fsync(struct vnode *);
  176. #ifdef FIFO
  177. #define FFS_FIFOOPS &ffs_fifovops
  178. #else
  179. #define FFS_FIFOOPS NULL
  180. #endif
  181. extern struct pool ffs_ino_pool; /* memory pool for inodes */
  182. extern struct pool ffs_dinode1_pool; /* memory pool for UFS1 dinodes */
  183. #ifdef FFS2
  184. extern struct pool ffs_dinode2_pool; /* memory pool for UFS2 dinodes */
  185. #endif