| VNSUBR(9) | Kernel Developer's Manual | VNSUBR(9) | 
vnsubr, vn_bwrite,
  vn_close, vn_default_error,
  vn_isunder, vn_lock,
  vn_markexec, vn_marktext,
  vn_rdwr, vn_open,
  vn_bdev_open,
  vn_bdev_openpath, vn_stat,
  vn_writechk —
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/vnode.h>
int
  
  vn_bwrite(void
    *ap);
int
  
  vn_close(struct
    vnode *vp, int
    flags, kauth_cred_t
    cred);
int
  
  vn_default_error(void
    *v);
int
  
  vn_isunder(struct
    vnode *dvp, struct vnode
    *rvp, struct lwp
    *l);
int
  
  vn_lock(struct
    vnode *vp, int
    flags);
void
  
  vn_markexec(struct
    vnode *vp);
void
  
  vn_marktext(struct
    vnode *vp);
int
  
  vn_open(struct vnode *at_dvp,
    struct pathbuf *pb, int nmode,
    int fmode, int cmode,
    struct vnode **ret_vp, bool
    *ret_domove, int *ret_fd);
int
  
  vn_bdev_open(dev_t
    dev, struct vnode
    **vpp, struct lwp
    *l);
int
  
  vn_bdev_openpath(struct
    pathbuf *pb, struct vnode
    **vpp, struct lwp
    *l);
int
  
  vn_rdwr(enum uio_rw rw,
    struct vnode *vp, void *base,
    int len, off_t offset,
    enum uio_seg segflg, int ioflg,
    kauth_cred_t cred, size_t
    *aresid, struct lwp *l);
int
  
  vn_readdir(file_t
    *fp, char *buf,
    int segflg,
    u_int count,
    int *done,
    struct lwp *l,
    off_t **cookies,
    int *ncookies);
int
  
  vn_stat(struct
    vnode *vp, struct stat
    *sb);
int
  
  vn_writechk(struct
    vnode *vp);
vn_bwrite(ap)vn_close(vp,
    flags, cred)vn_close() simply locks the vnode, invokes the
      vnode operation
      VOP_CLOSE(9) and calls
      vput() to return the vnode to the freelist or
      holdlist. Note that vn_close() expects an
      unlocked, referenced vnode and will dereference the vnode prior to
      returning. If the operation is successful zero is returned, otherwise an
      appropriate error is returned.vn_default_error(v)vn_isunder(dvp,
    rvp, l)vn_isunder() is intended
      to be used in chroot(2),
      chdir(2),
      fchdir(2), etc., to ensure
      that chroot(2) actually
      means something. If the operation is successful zero is returned,
      otherwise 1 is returned.vn_lock(vp,
    flags)If the operation is successful zero is returned, otherwise an appropriate error code is returned.
vn_lock() must not be called when the
        vnode's reference count is zero.
vn_markexec(vp)vn_marktext(vp)vn_open(at_dvp,
    pb, nmode,
    fmode, cmode,
    ret_vp, ret_domove,
    ret_fd)F* from O_* form) and the
      access mode (permissions) for creation, respectively. The
      nmode argument is restricted to one or perhaps both
      of the flags TRYEMULROOT and
      NOCHROOT. Other
      name(9) modes should be
      selected via fmode(). The
      ret_vp, ret_domove, and
      ret_fd arguments encode the possible return values.
      When called, vn_open() checks permissions and
      invokes the VOP_OPEN(9) or
      VOP_CREATE(9) vnode
      operations. If the operation is unsuccessful an appropriate error code is
      returned. Otherwise, zero is returned. If a vnode is produced, it is
      returned locked via ret_vp. If a file descriptor
      number is produced instead, the pointer passed via
      ret_vp is NULL, the file descriptor is returned via
      ret_fd, and the ret_domove
      returns a value that is true if the file descriptor should be moved rather
      than copied. These cases correspond to the internal errors
      EMOVEFD and EDUPFD
      respectively. See errno(9)
      for further information. Callers unprepared to handle file descriptors can
      set ret_fd and ret_domove to
      NULL, in which case an operation that would produce a file descriptor will
      instead fail with EOPNOTSUPP.vn_bdev_open(dev,
    vpp, l)vn_bdev_openpath(pb,
    vpp, l)vn_bdev_open() but looks up a file
      system path pb to determine the device ID.vn_rdwr(rw,
    vp, base,
    len, offset,
    segflg, ioflg,
    cred, aresid,
    l)UIO_READ) or write
      (UIO_WRITE) operation. The vnode is specified by
      vp. The arguments l and
      cred are the calling lwp and its credentials. If
      ioflg contains
      IO_NODELOCKED, it is expected that the vnode is
      locked. ioflg will be passed to
      VOP_READ()/VOP_WRITE().
      The remaining arguments specify the uio parameters. For further
      information on these parameters see
      uiomove(9).vn_readdir(fp,
    buf, segflg,
    count, done,
    l, cookies,
    ncookies)NULL if
      they aren't required to be returned by
      vn_readdir(). If the operation is successful zero
      is returned, otherwise an appropriate error code is returned.vn_stat(vp,
    sb)vn_stat()
      basically calls the vnode operation
      VOP_GETATTR(9) and
      transfers the contents of a vattr structure into a struct stat. If the
      operation is successful zero is returned, otherwise an appropriate error
      code is returned.vn_writechk(vp)| June 28, 2021 | NetBSD 10.0 |