Contents

vnode_open

Open a file identified by a path--roughly speaking an in-kernel open(2).

Declaration

errno_t vnode_open(const char *path, int fmode, int cmode, int flags, vnode_t *vpp, vfs_context_t ctx);

Parameters

  • path:

    Path to look up.

  • fmode:

    e.g. O_NONBLOCK, O_APPEND; see bsd/sys/fcntl.h.

  • cmode:

    Permissions with which to create file if it does not exist.

  • flags:

    Same as vnode_lookup().

  • vpp:

    Destination for vnode.

  • ctx:

    Context with which to authorize open/creation.

Return Value

0 for success or an error code.

Discussion

If vnode_open() succeeds, it returns with both an iocount and a usecount on the returned vnode. These must be released eventually; the iocount should be released with vnode_put() as soon as any initial operations on the vnode are over, whereas the usecount should be released via vnode_close().

See Also

vnode