vnode.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. /* $OpenBSD: vnode.h,v 1.132 2015/05/07 08:53:33 mpi Exp $ */
  2. /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
  3. /*
  4. * Copyright (c) 1989, 1993
  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. * @(#)vnode.h 8.11 (Berkeley) 11/21/94
  32. */
  33. #ifndef _SYS_VNODE_H_
  34. #define _SYS_VNODE_H_
  35. #include <sys/buf.h>
  36. #include <sys/types.h>
  37. #include <sys/queue.h>
  38. #include <sys/selinfo.h>
  39. #include <sys/tree.h>
  40. /*
  41. * The vnode is the focus of all file activity in UNIX. There is a
  42. * unique vnode allocated for each active file, each current directory,
  43. * each mounted-on file, text file, and the root.
  44. */
  45. /*
  46. * Vnode types. VNON means no type.
  47. */
  48. enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD };
  49. #define VTYPE_NAMES \
  50. "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD"
  51. /*
  52. * Vnode tag types.
  53. * These are for the benefit of external programs only (e.g., pstat)
  54. * and should NEVER be inspected by the kernel.
  55. *
  56. * Note that v_tag is actually used to tell MFS from FFS, and EXT2FS from
  57. * the rest, so don't believe the above comment!
  58. */
  59. enum vtagtype {
  60. VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS,
  61. VT_PORTAL, VT_PROCFS, VT_AFS, VT_ISOFS, VT_ADOSFS,
  62. VT_EXT2FS, VT_VFS, VT_NTFS, VT_UDF, VT_FUSEFS, VT_TMPFS,
  63. };
  64. #define VTAG_NAMES \
  65. "NON", "UFS", "NFS", "MFS", "MSDOSFS", \
  66. "unused", "unused", "unused", "ISOFS", "unused", \
  67. "EXT2FS", "VFS", "NTFS", "UDF", "FUSEFS", "TMPFS"
  68. /*
  69. * Each underlying filesystem allocates its own private area and hangs
  70. * it from v_data. If non-null, this area is freed in getnewvnode().
  71. */
  72. LIST_HEAD(buflists, buf);
  73. RB_HEAD(buf_rb_bufs, buf);
  74. RB_HEAD(namecache_rb_cache, namecache);
  75. struct uvm_vnode;
  76. struct vnode {
  77. struct uvm_vnode *v_uvm; /* uvm data */
  78. struct vops *v_op; /* vnode operations vector */
  79. enum vtype v_type; /* vnode type */
  80. enum vtagtype v_tag; /* type of underlying data */
  81. u_int v_flag; /* vnode flags (see below) */
  82. u_int v_usecount; /* reference count of users */
  83. /* reference count of writers */
  84. u_int v_writecount;
  85. /* Flags that can be read/written in interrupts */
  86. u_int v_bioflag;
  87. u_int v_holdcnt; /* buffer references */
  88. u_int v_id; /* capability identifier */
  89. struct mount *v_mount; /* ptr to vfs we are in */
  90. TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */
  91. LIST_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */
  92. struct buf_rb_bufs v_bufs_tree; /* lookup of all bufs */
  93. struct buflists v_cleanblkhd; /* clean blocklist head */
  94. struct buflists v_dirtyblkhd; /* dirty blocklist head */
  95. u_int v_numoutput; /* num of writes in progress */
  96. LIST_ENTRY(vnode) v_synclist; /* vnode with dirty buffers */
  97. union {
  98. struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */
  99. struct socket *vu_socket; /* unix ipc (VSOCK) */
  100. struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */
  101. struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */
  102. } v_un;
  103. /* VFS namecache */
  104. struct namecache_rb_cache v_nc_tree;
  105. TAILQ_HEAD(, namecache) v_cache_dst; /* cache entries to us */
  106. void *v_data; /* private data for fs */
  107. struct selinfo v_selectinfo; /* identity of poller(s) */
  108. };
  109. #define v_mountedhere v_un.vu_mountedhere
  110. #define v_socket v_un.vu_socket
  111. #define v_specinfo v_un.vu_specinfo
  112. #define v_fifoinfo v_un.vu_fifoinfo
  113. /*
  114. * Vnode flags.
  115. */
  116. #define VROOT 0x0001 /* root of its file system */
  117. #define VTEXT 0x0002 /* vnode is a pure text prototype */
  118. #define VSYSTEM 0x0004 /* vnode being used by kernel */
  119. #define VISTTY 0x0008 /* vnode represents a tty */
  120. #define VXLOCK 0x0100 /* vnode is locked to change underlying type */
  121. #define VXWANT 0x0200 /* process is waiting for vnode */
  122. #define VCLONED 0x0400 /* vnode was cloned */
  123. #define VALIASED 0x0800 /* vnode has an alias */
  124. #define VLARVAL 0x1000 /* vnode data not yet set up by higher level */
  125. #define VLOCKSWORK 0x4000 /* FS supports locking discipline */
  126. #define VCLONE 0x8000 /* vnode is a clone */
  127. #define VBITS "\010\001ROOT\002TEXT\003SYSTEM\004ISTTY\010XLOCK" \
  128. "\011XWANT\013ALIASED\014LARVAL\016LOCKSWORK\017CLONE"
  129. /*
  130. * (v_bioflag) Flags that may be manipulated by interrupt handlers
  131. */
  132. #define VBIOWAIT 0x0001 /* waiting for output to complete */
  133. #define VBIOONSYNCLIST 0x0002 /* Vnode is on syncer worklist */
  134. #define VBIOONFREELIST 0x0004 /* Vnode is on a free list */
  135. /*
  136. * Vnode attributes. A field value of VNOVAL represents a field whose value
  137. * is unavailable (getattr) or which is not to be changed (setattr). For
  138. * the timespec fields, only the tv_nsec member needs to be set to VNOVAL:
  139. * if tv_nsec != VNOVAL then both tv_sec and tv_nsec are valid.
  140. */
  141. struct vattr {
  142. enum vtype va_type; /* vnode type (for create) */
  143. mode_t va_mode; /* files access mode and type */
  144. nlink_t va_nlink; /* number of references to file */
  145. uid_t va_uid; /* owner user id */
  146. gid_t va_gid; /* owner group id */
  147. long va_fsid; /* file system id (dev for now) */
  148. u_quad_t va_fileid; /* file id */
  149. u_quad_t va_size; /* file size in bytes */
  150. long va_blocksize; /* blocksize preferred for i/o */
  151. struct timespec va_atime; /* time of last access */
  152. struct timespec va_mtime; /* time of last modification */
  153. struct timespec va_ctime; /* time file changed */
  154. u_long va_gen; /* generation number of file */
  155. u_long va_flags; /* flags defined for file */
  156. dev_t va_rdev; /* device the special file represents */
  157. u_quad_t va_bytes; /* bytes of disk space held by file */
  158. u_quad_t va_filerev; /* file modification number */
  159. u_int va_vaflags; /* operations flags, see below */
  160. long va_spare; /* remain quad aligned */
  161. };
  162. /*
  163. * Flags for va_vaflags.
  164. */
  165. #define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */
  166. #define VA_EXCLUSIVE 0x02 /* exclusive create request */
  167. #define VA_UTIMES_CHANGE 0x04 /* ctime should be updated */
  168. /*
  169. * Flags for ioflag.
  170. */
  171. #define IO_UNIT 0x01 /* do I/O as atomic unit */
  172. #define IO_APPEND 0x02 /* append write to end */
  173. #define IO_SYNC 0x04 /* do I/O synchronously */
  174. #define IO_NODELOCKED 0x08 /* underlying node already locked */
  175. #define IO_NDELAY 0x10 /* FNDELAY flag set in file table */
  176. #define IO_NOLIMIT 0x20 /* don't enforce limits on i/o */
  177. #define IO_NOCACHE 0x40 /* don't cache result of this i/o */
  178. /*
  179. * Modes. Some values same as Ixxx entries from inode.h for now.
  180. */
  181. #define VSUID 04000 /* set user id on execution */
  182. #define VSGID 02000 /* set group id on execution */
  183. #define VSVTX 01000 /* save swapped text even after use */
  184. #define VREAD 00400 /* read, write, execute permissions */
  185. #define VWRITE 00200
  186. #define VEXEC 00100
  187. /*
  188. * Token indicating no attribute value yet assigned.
  189. */
  190. #define VNOVAL (-1)
  191. #ifdef _KERNEL
  192. /*
  193. * Convert between vnode types and inode formats (since POSIX.1
  194. * defines mode word of stat structure in terms of inode formats).
  195. */
  196. extern enum vtype iftovt_tab[];
  197. extern int vttoif_tab[];
  198. #define IFTOVT(mode) (iftovt_tab[((mode) & S_IFMT) >> 12])
  199. #define VTTOIF(indx) (vttoif_tab[(int)(indx)])
  200. #define MAKEIMODE(indx, mode) (int)(VTTOIF(indx) | (mode))
  201. /*
  202. * Flags to various vnode functions.
  203. */
  204. #define SKIPSYSTEM 0x0001 /* vflush: skip vnodes marked VSYSTEM */
  205. #define FORCECLOSE 0x0002 /* vflush: force file closeure */
  206. #define WRITECLOSE 0x0004 /* vflush: only close writeable files */
  207. #define DOCLOSE 0x0008 /* vclean: close active files */
  208. #define V_SAVE 0x0001 /* vinvalbuf: sync file first */
  209. #define V_SAVEMETA 0x0002 /* vinvalbuf: leave indirect blocks */
  210. #define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */
  211. TAILQ_HEAD(freelst, vnode);
  212. extern struct freelst vnode_hold_list; /* free vnodes referencing buffers */
  213. extern struct freelst vnode_free_list; /* vnode free list */
  214. #define VATTR_NULL(vap) vattr_null(vap)
  215. #define NULLVP ((struct vnode *)NULL)
  216. #define VN_KNOTE(vp, b) \
  217. KNOTE(&vp->v_selectinfo.si_note, (b))
  218. /*
  219. * Global vnode data.
  220. */
  221. extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
  222. extern int initialvnodes; /* XXX number of vnodes to start */
  223. extern int maxvnodes; /* XXX number of vnodes to allocate */
  224. extern int syncdelay; /* seconds to delay syncing vnodes */
  225. extern int rushjob; /* # of slots syncer should run ASAP */
  226. extern void vhold(struct vnode *);
  227. extern void vdrop(struct vnode *);
  228. /* vnode operations */
  229. struct vops {
  230. int (*vop_lock)(void *);
  231. int (*vop_unlock)(void *);
  232. int (*vop_islocked)(void *);
  233. int (*vop_abortop)(void *);
  234. int (*vop_access)(void *);
  235. int (*vop_advlock)(void *);
  236. int (*vop_bmap)(void *);
  237. int (*vop_bwrite)(void *);
  238. int (*vop_close)(void *);
  239. int (*vop_create)(void *);
  240. int (*vop_fsync)(void *);
  241. int (*vop_getattr)(void *);
  242. int (*vop_inactive)(void *);
  243. int (*vop_ioctl)(void *);
  244. int (*vop_link)(void *);
  245. int (*vop_lookup)(void *);
  246. int (*vop_mknod)(void *);
  247. int (*vop_open)(void *);
  248. int (*vop_pathconf)(void *);
  249. int (*vop_poll)(void *);
  250. int (*vop_print)(void *);
  251. int (*vop_read)(void *);
  252. int (*vop_readdir)(void *);
  253. int (*vop_readlink)(void *);
  254. int (*vop_reallocblks)(void *);
  255. int (*vop_reclaim)(void *);
  256. int (*vop_remove)(void *);
  257. int (*vop_rename)(void *);
  258. int (*vop_revoke)(void *);
  259. int (*vop_mkdir)(void *);
  260. int (*vop_rmdir)(void *);
  261. int (*vop_setattr)(void *);
  262. int (*vop_strategy)(void *);
  263. int (*vop_symlink)(void *);
  264. int (*vop_write)(void *);
  265. int (*vop_kqfilter)(void *);
  266. };
  267. extern struct vops dead_vops;
  268. extern struct vops spec_vops;
  269. struct vop_generic_args {
  270. void *a_garbage;
  271. /* Other data probably follows; */
  272. };
  273. struct vop_islocked_args {
  274. struct vnode *a_vp;
  275. };
  276. int VOP_ISLOCKED(struct vnode *);
  277. struct vop_lookup_args {
  278. struct vnode *a_dvp;
  279. struct vnode **a_vpp;
  280. struct componentname *a_cnp;
  281. };
  282. int VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *);
  283. struct vop_create_args {
  284. struct vnode *a_dvp;
  285. struct vnode **a_vpp;
  286. struct componentname *a_cnp;
  287. struct vattr *a_vap;
  288. };
  289. int VOP_CREATE(struct vnode *, struct vnode **, struct componentname *,
  290. struct vattr *);
  291. struct vop_mknod_args {
  292. struct vnode *a_dvp;
  293. struct vnode **a_vpp;
  294. struct componentname *a_cnp;
  295. struct vattr *a_vap;
  296. };
  297. int VOP_MKNOD(struct vnode *, struct vnode **, struct componentname *,
  298. struct vattr *);
  299. struct vop_open_args {
  300. struct vnode *a_vp;
  301. int a_mode;
  302. struct ucred *a_cred;
  303. struct proc *a_p;
  304. };
  305. int VOP_OPEN(struct vnode *, int, struct ucred *, struct proc *);
  306. struct vop_close_args {
  307. struct vnode *a_vp;
  308. int a_fflag;
  309. struct ucred *a_cred;
  310. struct proc *a_p;
  311. };
  312. int VOP_CLOSE(struct vnode *, int, struct ucred *, struct proc *);
  313. struct vop_access_args {
  314. struct vnode *a_vp;
  315. int a_mode;
  316. struct ucred *a_cred;
  317. struct proc *a_p;
  318. };
  319. int VOP_ACCESS(struct vnode *, int, struct ucred *, struct proc *);
  320. struct vop_getattr_args {
  321. struct vnode *a_vp;
  322. struct vattr *a_vap;
  323. struct ucred *a_cred;
  324. struct proc *a_p;
  325. };
  326. int VOP_GETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *);
  327. struct vop_setattr_args {
  328. struct vnode *a_vp;
  329. struct vattr *a_vap;
  330. struct ucred *a_cred;
  331. struct proc *a_p;
  332. };
  333. int VOP_SETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *);
  334. struct vop_read_args {
  335. struct vnode *a_vp;
  336. struct uio *a_uio;
  337. int a_ioflag;
  338. struct ucred *a_cred;
  339. };
  340. int VOP_READ(struct vnode *, struct uio *, int, struct ucred *);
  341. struct vop_write_args {
  342. struct vnode *a_vp;
  343. struct uio *a_uio;
  344. int a_ioflag;
  345. struct ucred *a_cred;
  346. };
  347. int VOP_WRITE(struct vnode *, struct uio *, int, struct ucred *);
  348. struct vop_ioctl_args {
  349. struct vnode *a_vp;
  350. u_long a_command;
  351. void *a_data;
  352. int a_fflag;
  353. struct ucred *a_cred;
  354. struct proc *a_p;
  355. };
  356. int VOP_IOCTL(struct vnode *, u_long, void *, int, struct ucred *,
  357. struct proc *);
  358. struct vop_poll_args {
  359. struct vnode *a_vp;
  360. int a_fflag;
  361. int a_events;
  362. struct proc *a_p;
  363. };
  364. int VOP_POLL(struct vnode *, int, int, struct proc *);
  365. struct vop_kqfilter_args {
  366. struct vnode *a_vp;
  367. struct knote *a_kn;
  368. };
  369. int VOP_KQFILTER(struct vnode *, struct knote *);
  370. struct vop_revoke_args {
  371. struct vnode *a_vp;
  372. int a_flags;
  373. };
  374. int VOP_REVOKE(struct vnode *, int);
  375. struct vop_fsync_args {
  376. struct vnode *a_vp;
  377. struct ucred *a_cred;
  378. int a_waitfor;
  379. struct proc *a_p;
  380. };
  381. int VOP_FSYNC(struct vnode *, struct ucred *, int, struct proc *);
  382. struct vop_remove_args {
  383. struct vnode *a_dvp;
  384. struct vnode *a_vp;
  385. struct componentname *a_cnp;
  386. };
  387. int VOP_REMOVE(struct vnode *, struct vnode *, struct componentname *);
  388. struct vop_link_args {
  389. struct vnode *a_dvp;
  390. struct vnode *a_vp;
  391. struct componentname *a_cnp;
  392. };
  393. int VOP_LINK(struct vnode *, struct vnode *, struct componentname *);
  394. struct vop_rename_args {
  395. struct vnode *a_fdvp;
  396. struct vnode *a_fvp;
  397. struct componentname *a_fcnp;
  398. struct vnode *a_tdvp;
  399. struct vnode *a_tvp;
  400. struct componentname *a_tcnp;
  401. };
  402. int VOP_RENAME(struct vnode *, struct vnode *, struct componentname *,
  403. struct vnode *, struct vnode *, struct componentname *);
  404. struct vop_mkdir_args {
  405. struct vnode *a_dvp;
  406. struct vnode **a_vpp;
  407. struct componentname *a_cnp;
  408. struct vattr *a_vap;
  409. };
  410. int VOP_MKDIR(struct vnode *, struct vnode **, struct componentname *,
  411. struct vattr *);
  412. struct vop_rmdir_args {
  413. struct vnode *a_dvp;
  414. struct vnode *a_vp;
  415. struct componentname *a_cnp;
  416. };
  417. int VOP_RMDIR(struct vnode *, struct vnode *, struct componentname *);
  418. struct vop_symlink_args {
  419. struct vnode *a_dvp;
  420. struct vnode **a_vpp;
  421. struct componentname *a_cnp;
  422. struct vattr *a_vap;
  423. char *a_target;
  424. };
  425. int VOP_SYMLINK(struct vnode *, struct vnode **, struct componentname *,
  426. struct vattr *, char *);
  427. struct vop_readdir_args {
  428. struct vnode *a_vp;
  429. struct uio *a_uio;
  430. struct ucred *a_cred;
  431. int *a_eofflag;
  432. };
  433. int VOP_READDIR(struct vnode *, struct uio *, struct ucred *, int *);
  434. struct vop_readlink_args {
  435. struct vnode *a_vp;
  436. struct uio *a_uio;
  437. struct ucred *a_cred;
  438. };
  439. int VOP_READLINK(struct vnode *, struct uio *, struct ucred *);
  440. struct vop_abortop_args {
  441. struct vnode *a_dvp;
  442. struct componentname *a_cnp;
  443. };
  444. int VOP_ABORTOP(struct vnode *, struct componentname *);
  445. struct vop_inactive_args {
  446. struct vnode *a_vp;
  447. struct proc *a_p;
  448. };
  449. int VOP_INACTIVE(struct vnode *, struct proc *);
  450. struct vop_reclaim_args {
  451. struct vnode *a_vp;
  452. struct proc *a_p;
  453. };
  454. int VOP_RECLAIM(struct vnode *, struct proc *);
  455. struct vop_lock_args {
  456. struct vnode *a_vp;
  457. int a_flags;
  458. struct proc *a_p;
  459. };
  460. int VOP_LOCK(struct vnode *, int, struct proc *);
  461. struct vop_unlock_args {
  462. struct vnode *a_vp;
  463. int a_flags;
  464. struct proc *a_p;
  465. };
  466. int VOP_UNLOCK(struct vnode *, int, struct proc *);
  467. struct vop_bmap_args {
  468. struct vnode *a_vp;
  469. daddr_t a_bn;
  470. struct vnode **a_vpp;
  471. daddr_t *a_bnp;
  472. int *a_runp;
  473. };
  474. int VOP_BMAP(struct vnode *, daddr_t, struct vnode **, daddr_t *, int *);
  475. struct vop_print_args {
  476. struct vnode *a_vp;
  477. };
  478. int VOP_PRINT(struct vnode *);
  479. struct vop_pathconf_args {
  480. struct vnode *a_vp;
  481. int a_name;
  482. register_t *a_retval;
  483. };
  484. int VOP_PATHCONF(struct vnode *, int, register_t *);
  485. struct vop_advlock_args {
  486. struct vnode *a_vp;
  487. void *a_id;
  488. int a_op;
  489. struct flock *a_fl;
  490. int a_flags;
  491. };
  492. int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int);
  493. struct vop_reallocblks_args {
  494. struct vnode *a_vp;
  495. struct cluster_save *a_buflist;
  496. };
  497. int VOP_REALLOCBLKS(struct vnode *, struct cluster_save *);
  498. /* Special cases: */
  499. struct vop_strategy_args {
  500. struct buf *a_bp;
  501. };
  502. int VOP_STRATEGY(struct buf *);
  503. struct vop_bwrite_args {
  504. struct buf *a_bp;
  505. };
  506. int VOP_BWRITE(struct buf *);
  507. /* End of special cases. */
  508. /* Public vnode manipulation functions. */
  509. struct file;
  510. struct filedesc;
  511. struct mount;
  512. struct nameidata;
  513. struct proc;
  514. struct stat;
  515. struct statfs;
  516. struct ucred;
  517. struct uio;
  518. struct vattr;
  519. struct vnode;
  520. /* vfs_subr */
  521. int bdevvp(dev_t, struct vnode **);
  522. int cdevvp(dev_t, struct vnode **);
  523. struct vnode *checkalias(struct vnode *, dev_t, struct mount *);
  524. int getnewvnode(enum vtagtype, struct mount *, struct vops *,
  525. struct vnode **);
  526. int vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, struct ucred *);
  527. void vattr_null(struct vattr *);
  528. void vdevgone(int, int, int, enum vtype);
  529. int vcount(struct vnode *);
  530. int vfinddev(dev_t, enum vtype, struct vnode **);
  531. void vflushbuf(struct vnode *, int);
  532. int vflush(struct mount *, struct vnode *, int);
  533. int vget(struct vnode *, int, struct proc *);
  534. void vgone(struct vnode *);
  535. void vgonel(struct vnode *, struct proc *);
  536. int vinvalbuf(struct vnode *, int, struct ucred *, struct proc *,
  537. int, int);
  538. void vntblinit(void);
  539. int vwaitforio(struct vnode *, int, char *, int);
  540. void vwakeup(struct vnode *);
  541. void vput(struct vnode *);
  542. int vrecycle(struct vnode *, struct proc *);
  543. int vrele(struct vnode *);
  544. void vref(struct vnode *);
  545. void vprint(char *, struct vnode *);
  546. void copy_statfs_info(struct statfs *, const struct mount *);
  547. /* vfs_getcwd.c */
  548. #define GETCWD_CHECK_ACCESS 0x0001
  549. int vfs_getcwd_scandir(struct vnode **, struct vnode **, char **, char *,
  550. struct proc *);
  551. int vfs_getcwd_common(struct vnode *, struct vnode *, char **, char *, int,
  552. int, struct proc *);
  553. int vfs_getcwd_getcache(struct vnode **, struct vnode **, char **, char *);
  554. /* vfs_default.c */
  555. int vop_generic_abortop(void *);
  556. int vop_generic_bmap(void *);
  557. int vop_generic_bwrite(void *);
  558. int vop_generic_islocked(void *);
  559. int vop_generic_lock(void *);
  560. int vop_generic_unlock(void *);
  561. int vop_generic_revoke(void *);
  562. int vop_generic_kqfilter(void *);
  563. int vop_generic_lookup(void *);
  564. /* vfs_vnops.c */
  565. int vn_isunder(struct vnode *, struct vnode *, struct proc *);
  566. int vn_close(struct vnode *, int, struct ucred *, struct proc *);
  567. int vn_open(struct nameidata *, int, int);
  568. int vn_rdwr(enum uio_rw, struct vnode *, caddr_t, int, off_t,
  569. enum uio_seg, int, struct ucred *, size_t *, struct proc *);
  570. int vn_stat(struct vnode *, struct stat *, struct proc *);
  571. int vn_statfile(struct file *, struct stat *, struct proc *);
  572. int vn_lock(struct vnode *, int, struct proc *);
  573. int vn_writechk(struct vnode *);
  574. int vn_fsizechk(struct vnode *, struct uio *, int, ssize_t *);
  575. int vn_ioctl(struct file *, u_long, caddr_t, struct proc *);
  576. void vn_marktext(struct vnode *);
  577. /* vfs_sync.c */
  578. void sched_sync(struct proc *);
  579. void vn_initialize_syncerd(void);
  580. void vn_syncer_add_to_worklist(struct vnode *, int);
  581. /* misc */
  582. int vn_isdisk(struct vnode *, int *);
  583. int softdep_fsync(struct vnode *);
  584. int getvnode(struct proc *, int, struct file **);
  585. /* uvm */
  586. void uvm_vnp_setsize(struct vnode *, off_t);
  587. void uvm_vnp_sync(struct mount *);
  588. void uvm_vnp_terminate(struct vnode *);
  589. int uvm_vnp_uncache(struct vnode *);
  590. #endif /* _KERNEL */
  591. #endif /* _SYS_VNODE_H_ */