1# zx_vmo_op_range
2
3## NAME
4
5<!-- Updated by update-docs-from-abigen, do not edit. -->
6
7vmo_op_range - perform an operation on a range of a VMO
8
9## SYNOPSIS
10
11<!-- Updated by update-docs-from-abigen, do not edit. -->
12
13```
14#include <zircon/syscalls.h>
15
16zx_status_t zx_vmo_op_range(zx_handle_t handle,
17                            uint32_t op,
18                            uint64_t offset,
19                            uint64_t size,
20                            void* buffer,
21                            size_t buffer_size);
22```
23
24## DESCRIPTION
25
26`zx_vmo_op_range()` performs cache and memory operations against pages held by the VMO.
27
28*offset* byte offset specifying the starting location for *op* in the VMO's held memory.
29
30*size* length, in bytes, to perform the operation on.
31
32*op* the operation to perform:
33
34*buffer* and *buffer_size* are currently unused.
35
36**ZX_VMO_OP_COMMIT** - Commit *size* bytes worth of pages starting at byte *offset* for the VMO.
37More information can be found in the [vm object documentation](../objects/vm_object.md).
38Requires the **ZX_RIGHT_WRITE** right.
39
40**ZX_VMO_OP_DECOMMIT** - Release a range of pages previously committed to the VMO from *offset* to *offset*+*size*.
41Requires the **ZX_RIGHT_WRITE** right.
42
43**ZX_VMO_OP_LOCK** - Presently unsupported.
44
45**ZX_VMO_OP_UNLOCK** - Presently unsupported.
46
47**ZX_VMO_OP_CACHE_SYNC** - Performs a cache sync operation.
48Requires the **ZX_RIGHT_READ** right.
49
50**ZX_VMO_OP_CACHE_INVALIDATE** - Performs a cache invalidation operation.
51Requires the **ZX_RIGHT_WRITE** right.
52
53**ZX_VMO_OP_CACHE_CLEAN** - Performs a cache clean operation.
54Requires the **ZX_RIGHT_READ** right.
55
56**ZX_VMO_OP_CACHE_CLEAN_INVALIDATE** - Performs cache clean and invalidate operations together.
57Requires the **ZX_RIGHT_READ** right.
58
59
60## RIGHTS
61
62<!-- Updated by update-docs-from-abigen, do not edit. -->
63
64If *op* is **ZX_VMO_OP_COMMIT**, *handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_WRITE**.
65
66If *op* is **ZX_VMO_OP_DECOMMIT**, *handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_WRITE**.
67
68If *op* is **ZX_VMO_OP_CACHE_SYNC**, *handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
69
70If *op* is **ZX_VMO_OP_CACHE_INVALIDATE**, *handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_WRITE**.
71
72If *op* is **ZX_VMO_OP_CACHE_CLEAN**, *handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
73
74If *op* is **ZX_VMO_OP_CACHE_CLEAN_INVALIDATE**, *handle* must be of type **ZX_OBJ_TYPE_VMO** and have **ZX_RIGHT_READ**.
75
76## RETURN VALUE
77
78`zx_vmo_op_range()` returns **ZX_OK** on success. In the event of failure, a negative error
79value is returned.
80
81## ERRORS
82
83**ZX_ERR_BAD_HANDLE**  *handle* is not a valid handle.
84
85**ZX_ERR_OUT_OF_RANGE**  An invalid memory range specified by *offset* and *size*.
86
87**ZX_ERR_NO_MEMORY**  Allocations to commit pages for **ZX_VMO_OP_COMMIT** failed.
88
89**ZX_ERR_WRONG_TYPE**  *handle* is not a VMO handle.
90
91**ZX_ERR_ACCESS_DENIED**  *handle* does not have sufficient rights to perform the operation.
92
93**ZX_ERR_INVALID_ARGS**  *out* is an invalid pointer, *op* is not a valid
94operation, or *size* is zero and *op* is a cache operation.
95
96**ZX_ERR_NOT_SUPPORTED**  *op* was **ZX_VMO_OP_LOCK** or **ZX_VMO_OP_UNLOCK**, or
97*op* was **ZX_VMO_OP_DECOMMIT** and the underlying VMO does not allow decommiting.
98
99## SEE ALSO
100
101 - [`zx_vmo_clone()`]
102 - [`zx_vmo_create()`]
103 - [`zx_vmo_get_size()`]
104 - [`zx_vmo_read()`]
105 - [`zx_vmo_set_size()`]
106 - [`zx_vmo_write()`]
107
108<!-- References updated by update-docs-from-abigen, do not edit. -->
109
110[`zx_vmo_clone()`]: vmo_clone.md
111[`zx_vmo_create()`]: vmo_create.md
112[`zx_vmo_get_size()`]: vmo_get_size.md
113[`zx_vmo_read()`]: vmo_read.md
114[`zx_vmo_set_size()`]: vmo_set_size.md
115[`zx_vmo_write()`]: vmo_write.md
116