---
name: "VOP_CREATEVOBJECT"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/VOP_CREATEVOBJECT"
---

# VOP\_CREATEVOBJECT(9)

VM object interaction

## NAME

**VOP\_CREATEVOBJECT**, **VOP\_DESTROYVOBJECT**, **VOP\_GETVOBJECT** – VM object interaction

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/vnode.h\>**

*int*\

**VOP\_CREATEVOBJECT**(*struct vnode \*vp*, *struct ucred \*cred*, *struct thread \*td*);

*int*\

**VOP\_DESTROYVOBJECT**(*struct vnode \*vp*);

*int*\

**VOP\_GETVOBJECT**(*struct vnode \*vp*, *struct vm\_object \*\*objpp*);

## DESCRIPTION

These calls are used to control the association of a VM object with a particular vnode.

The arguments specific to these functions are:

- *vp*

  The vnode of the file.

- *objpp*

  The VM object being returned, or NULL if the caller wants to test for the existence of the VM object).

[VFS(9)](/VFS/9.md) invokes **VOP\_CREATEVOBJECT**() when it needs to create a VM object for the given [vnode(9)](/vnode/9.md). File system code may pass this call down to the underlying file system. This VOP can be called multiple times, and file system code should ignore any additional calls, exiting with a zero return code.

**VOP\_DESTROYVOBJECT**() is called when a [vnode(9)](/vnode/9.md) is recycled.

**VOP\_GETVOBJECT**() should be used by all kernel code to get a VM object. The returned VM object may belong to a different file system in the case of stacked mounts.

[VFS(9)](/VFS/9.md) has three functions which perform standard operations by creating and destroying VM objects. These functions are: **vop\_stdcreatevobject**(), **vop\_stddestroyvobject**() and **vop\_stdgetvobject**().

*Note*: a [vnode(9)](/vnode/9.md) should be locked on entry and must be left locked on exit.

## RETURN VALUES

The **VOP\_CREATEVOBJECT**(), **VOP\_DESTROYVOBJECT**() and **VOP\_GETVOBJECT**() functions return zero on success, or a non-zero value on failure. Zero is returned on success, otherwise an error is returned.

## EXAMPLES

By default, file systems leave VM object handling to the **vop\_std\***() functions.

## SEE ALSO

[vnode(9)](/vnode/9.md), [VOP\_GETPAGES(9)](/VOP_GETPAGES/9.md), [VOP\_PUTPAGES(9)](/VOP_PUTPAGES/9.md)

## AUTHORS

This manual page was written by Boris Popov.
