Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1. /*
  2. * Abstract operations on a vnode.
  3. *
  4. * These are used in the form VOP_FOO(vnode, args), which are macros
  5. * that expands to vnode->vn_ops->vop_foo(vnode, args). The operations
  6. * "foo" are:
  7. *
  8. * vop_eachopen - Called on *each* open() of a file. Can be used to
  9. * reject illegal or undesired open modes. Note that
  10. * various operations can be performed without the
  11. * file actually being opened.
  12. * The vnode need not look at O_CREAT, O_EXCL, or
  13. * O_TRUNC, as these are handled in the VFS layer.
  14. *
  15. * VOP_EACHOPEN should not be called directly from
  16. * above the VFS layer - use vfs_open() to open vnodes.
  17. *
  18. * vop_reclaim - Called when vnode is no longer in use.
  19. *
  20. *****************************************
  21. *
  22. * vop_read - Read data from file to uio, at offset specified
  23. * in the uio, updating uio_resid to reflect the
  24. * amount read, and updating uio_offset to match.
  25. * Not allowed on directories or symlinks.
  26. *
  27. * vop_readlink - Read the contents of a symlink into a uio.
  28. * Not allowed on other types of object.
  29. *
  30. * vop_getdirentry - Read a single filename from a directory into a
  31. * uio, choosing what name based on the offset
  32. * field in the uio, and updating that field.
  33. * Unlike with I/O on regular files, the value of
  34. * the offset field is not interpreted outside
  35. * the filesystem and thus need not be a byte
  36. * count. However, the uio_resid field should be
  37. * handled in the normal fashion.
  38. * On non-directory objects, return ENOTDIR.
  39. *
  40. * vop_write - Write data from uio to file at offset specified
  41. * in the uio, updating uio_resid to reflect the
  42. * amount written, and updating uio_offset to match.
  43. * Not allowed on directories or symlinks.
  44. *
  45. * vop_ioctl - Perform ioctl operation OP on file using data
  46. * DATA. The interpretation of the data is specific
  47. * to each ioctl.
  48. *
  49. * vop_stat - Return info about a file. The pointer is a
  50. * pointer to struct stat; see kern/stat.h.
  51. *
  52. * vop_gettype - Return type of file. The values for file types
  53. * are in kern/stattypes.h.
  54. *
  55. * vop_isseekable - Check if this file is seekable. All regular files
  56. * and directories are seekable, but some devices are
  57. * not.
  58. *
  59. * vop_fsync - Force any dirty buffers associated with this file
  60. * to stable storage.
  61. *
  62. * vop_mmap - Map file into memory. If you implement this
  63. * feature, you're responsible for choosing the
  64. * arguments for this operation.
  65. *
  66. * vop_truncate - Forcibly set size of file to the length passed
  67. * in, discarding any excess blocks.
  68. *
  69. * vop_namefile - Compute pathname relative to filesystem root
  70. * of the file and copy to the specified
  71. * uio. Need not work on objects that are not
  72. * directories.
  73. *
  74. *****************************************
  75. *
  76. * vop_creat - Create a regular file named NAME in the passed
  77. * directory DIR. If boolean EXCL is true, fail if
  78. * the file already exists; otherwise, use the
  79. * existing file if there is one. Hand back the
  80. * vnode for the file as per vop_lookup.
  81. *
  82. * vop_symlink - Create symlink named NAME in the passed directory,
  83. * with contents CONTENTS.
  84. *
  85. * vop_mkdir - Make directory NAME in the passed directory PARENTDIR.
  86. *
  87. * vop_link - Create hard link, with name NAME, to file FILE
  88. * in the passed directory DIR.
  89. *
  90. * vop_remove - Delete non-directory object NAME from passed
  91. * directory. If NAME refers to a directory,
  92. * return EISDIR. If passed vnode is not a
  93. * directory, return ENOTDIR.
  94. *
  95. * vop_rmdir - Delete directory object NAME from passed
  96. * directory.
  97. *
  98. * vop_rename - Rename file NAME1 in directory VN1 to be
  99. * file NAME2 in directory VN2.
  100. *
  101. *****************************************
  102. *
  103. * vop_lookup - Parse PATHNAME relative to the passed directory
  104. * DIR, and hand back the vnode for the file it
  105. * refers to. May destroy PATHNAME. Should increment
  106. * refcount on vnode handed back.
  107. *
  108. * vop_lookparent - Parse PATHNAME relative to the passed directory
  109. * DIR, and hand back (1) the vnode for the
  110. * parent directory of the file it refers to, and
  111. * (2) the last component of the filename, copied
  112. * into kernel buffer BUF with max length LEN. May
  113. * destroy PATHNAME. Should increment refcount on
  114. * vnode handed back.
  115. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement