Skip to main content

vm_object_bindings/
vm_object_bindings.rs

1// Copyright 2026 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This file is automatically generated by //zircon/kernel/vm:_kernel_bindgen_crate.vm-object-bindings.bindgen.
6
7#![expect(non_camel_case_types)]
8#![expect(non_upper_case_globals)]
9#![no_std]
10use attribution_bindings::vm_AttributionCounts;
11use page_bindings::vm_page_t;
12use page_source_bindings::MultiPageRequest;
13use vm_page_list_bindings::VmPageSpliceList;
14use zx_types::{zx_koid_t, zx_paddr_t as paddr_t, zx_pager_vmo_stats_t, zx_status_t};
15pub type VmMapping = core::ffi::c_void;
16pub use zx_types::zx_vmo_lock_state_t;
17
18#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
19#[repr(C, align(8))]
20pub struct __BindgenOpaqueArray8<T>(pub T);
21impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray8<[T; N]> {
22    fn default() -> Self {
23        Self([<T as Default>::default(); N])
24    }
25}
26pub type arch_mmu_flags_t = u8;
27#[repr(C)]
28#[derive(Debug)]
29pub struct StreamSizeManager {
30    _unused: [u8; 0],
31}
32#[repr(C)]
33#[repr(align(8))]
34#[derive(Debug, Copy, Clone)]
35pub struct VmObjectChildObserver {
36    pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 8usize]>,
37}
38#[repr(i32)]
39#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
40pub enum Resizability {
41    Resizable = 0,
42    NonResizable = 1,
43}
44#[repr(i32)]
45#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
46pub enum SnapshotType {
47    Full = 0,
48    Modified = 1,
49    OnWrite = 2,
50}
51#[repr(u8)]
52#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
53pub enum SupplyOptions {
54    PagerSupply = 0,
55    TransferData = 1,
56    PhysicalPageProvider = 2,
57}
58pub const VmObjectReadWriteOptions_None: VmObjectReadWriteOptions = 0;
59pub const VmObjectReadWriteOptions_TrimLength: VmObjectReadWriteOptions = 1;
60pub type VmObjectReadWriteOptions = u8;
61unsafe extern "C" {
62    pub fn cpp_vm_object_free(vmo: *mut VmObject);
63}
64#[repr(C)]
65#[repr(align(8))]
66#[derive(Debug, Copy, Clone)]
67pub struct VmObject {
68    pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 128usize]>,
69}
70#[repr(u32)]
71#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
72pub enum VmObject_EvictionHint {
73    DontNeed = 0,
74    AlwaysNeed = 1,
75}
76#[repr(i32)]
77#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
78pub enum VmObject_CacheOpType {
79    Invalidate = 0,
80    Clean = 1,
81    CleanInvalidate = 2,
82    Sync = 3,
83}
84#[repr(u32)]
85#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
86pub enum VmObject_ChildType {
87    kNotChild = 0,
88    kCowClone = 1,
89    kSlice = 2,
90    kReference = 3,
91}
92#[repr(C)]
93#[derive(Debug, Copy, Clone)]
94pub struct VmObject_ChildListLock {
95    pub _base: __BindgenOpaqueArray8<[u8; 24usize]>,
96}
97#[repr(C)]
98#[derive(Debug, Copy, Clone)]
99pub struct VmObject_AllVmosLock {
100    pub _base: __BindgenOpaqueArray8<[u8; 24usize]>,
101}
102pub const VmObject_MAX_SIZE: u64 = 18446744073709486080;
103pub type cpp_vm_object_lookup_fn = ::core::option::Option<
104    unsafe extern "C" fn(ctx: *mut ::core::ffi::c_void, offset: u64, paddr: u64) -> zx_status_t,
105>;
106unsafe extern "C" {
107    pub fn cpp_vm_object_get_ref_counted(vmo: *const VmObject) -> *mut ::core::ffi::c_void;
108}
109unsafe extern "C" {
110    pub fn cpp_vm_object_decommit_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
111}
112unsafe extern "C" {
113    pub fn cpp_vm_object_commit_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
114}
115unsafe extern "C" {
116    pub fn cpp_vm_object_hint_range(
117        vmo: *mut VmObject,
118        offset: u64,
119        len: u64,
120        hint: VmObject_EvictionHint,
121    ) -> zx_status_t;
122}
123unsafe extern "C" {
124    pub fn cpp_vm_object_size_locked(vmo: *const VmObject) -> u64;
125}
126unsafe extern "C" {
127    pub fn cpp_vm_object_is_resizable(vmo: *const VmObject) -> bool;
128}
129unsafe extern "C" {
130    pub fn cpp_vm_object_is_discardable(vmo: *const VmObject) -> bool;
131}
132unsafe extern "C" {
133    pub fn cpp_vm_object_is_contiguous(vmo: *const VmObject) -> bool;
134}
135unsafe extern "C" {
136    pub fn cpp_vm_object_is_stream_compatible(vmo: *const VmObject) -> bool;
137}
138unsafe extern "C" {
139    pub fn cpp_vm_object_lock(vmo: *const VmObject) -> *mut ::core::ffi::c_void;
140}
141unsafe extern "C" {
142    pub fn cpp_vm_object_resize(vmo: *mut VmObject, size: u64) -> zx_status_t;
143}
144unsafe extern "C" {
145    pub fn cpp_vm_object_write(
146        vmo: *mut VmObject,
147        ptr: *const ::core::ffi::c_void,
148        offset: u64,
149        len: usize,
150    ) -> zx_status_t;
151}
152unsafe extern "C" {
153    pub fn cpp_vm_object_set_name(
154        vmo: *mut VmObject,
155        name: *const ::core::ffi::c_char,
156        len: usize,
157    ) -> zx_status_t;
158}
159unsafe extern "C" {
160    pub fn cpp_vm_object_get_name(
161        vmo: *const VmObject,
162        out_name: *mut ::core::ffi::c_char,
163        len: usize,
164    );
165}
166unsafe extern "C" {
167    pub fn cpp_vm_object_set_child_observer(
168        vmo: *mut VmObject,
169        child_observer: *mut VmObjectChildObserver,
170    );
171}
172unsafe extern "C" {
173    pub fn cpp_vm_object_commit_range_pinned(
174        vmo: *mut VmObject,
175        offset: u64,
176        len: u64,
177        write: bool,
178    ) -> zx_status_t;
179}
180unsafe extern "C" {
181    pub fn cpp_vm_object_unpin(vmo: *mut VmObject, offset: u64, len: u64);
182}
183unsafe extern "C" {
184    pub fn cpp_vm_object_get_mapping_cache_policy(vmo: *const VmObject) -> arch_mmu_flags_t;
185}
186unsafe extern "C" {
187    pub fn cpp_vm_object_get_mapping_cache_policy_locked(vmo: *const VmObject) -> arch_mmu_flags_t;
188}
189unsafe extern "C" {
190    pub fn cpp_vm_object_set_mapping_cache_policy(
191        vmo: *mut VmObject,
192        cache_policy: arch_mmu_flags_t,
193    ) -> zx_status_t;
194}
195unsafe extern "C" {
196    pub fn cpp_vm_object_add_mapping_locked(
197        vmo: *mut VmObject,
198        mapping: *mut VmMapping,
199    ) -> zx_status_t;
200}
201unsafe extern "C" {
202    pub fn cpp_vm_object_remove_mapping_locked(vmo: *mut VmObject, mapping: *mut VmMapping);
203}
204unsafe extern "C" {
205    pub fn cpp_vm_object_create_clone(
206        vmo: *mut VmObject,
207        resizable: Resizability,
208        snapshot_type: SnapshotType,
209        offset: u64,
210        size: u64,
211        copy_name: bool,
212        out_status: *mut zx_status_t,
213    ) -> *mut VmObject;
214}
215unsafe extern "C" {
216    pub fn cpp_vm_object_get_page_blocking(
217        vmo: *mut VmObject,
218        offset: u64,
219        pf_flags: u32,
220        out_page: *mut *mut vm_page_t,
221        out_pa: *mut paddr_t,
222    ) -> zx_status_t;
223}
224unsafe extern "C" {
225    pub fn cpp_vm_object_create_child_slice(
226        vmo: *mut VmObject,
227        offset: u64,
228        size: u64,
229        copy_name: bool,
230        out_status: *mut zx_status_t,
231    ) -> *mut VmObject;
232}
233unsafe extern "C" {
234    pub fn cpp_vm_object_create_child_reference(
235        vmo: *mut VmObject,
236        resizable: Resizability,
237        offset: u64,
238        size: u64,
239        copy_name: bool,
240        out_first_child: *mut bool,
241        out_status: *mut zx_status_t,
242    ) -> *mut VmObject;
243}
244unsafe extern "C" {
245    pub fn cpp_vm_object_set_user_id(vmo: *mut VmObject, user_id: u64);
246}
247unsafe extern "C" {
248    pub fn cpp_vm_object_user_id(vmo: *const VmObject) -> u64;
249}
250unsafe extern "C" {
251    pub fn cpp_vm_object_parent_user_id(vmo: *const VmObject) -> u64;
252}
253unsafe extern "C" {
254    pub fn cpp_vm_object_num_children(vmo: *const VmObject) -> u32;
255}
256unsafe extern "C" {
257    pub fn cpp_vm_object_lookup(
258        vmo: *mut VmObject,
259        offset: u64,
260        len: u64,
261        ctx: *mut ::core::ffi::c_void,
262        callback: cpp_vm_object_lookup_fn,
263    ) -> zx_status_t;
264}
265unsafe extern "C" {
266    pub fn cpp_vm_object_lookup_contiguous(
267        vmo: *mut VmObject,
268        offset: u64,
269        len: u64,
270        out_paddr: *mut paddr_t,
271    ) -> zx_status_t;
272}
273unsafe extern "C" {
274    pub fn cpp_vm_object_get_page(
275        vmo: *mut VmObject,
276        offset: u64,
277        pf_flags: u32,
278        page_request: *mut MultiPageRequest,
279        out_page: *mut *mut vm_page_t,
280        out_pa: *mut paddr_t,
281    ) -> zx_status_t;
282}
283unsafe extern "C" {
284    pub fn cpp_vm_object_get_attributed_memory(
285        vmo: *const VmObject,
286        out_counts: *mut vm_AttributionCounts,
287    );
288}
289unsafe extern "C" {
290    pub fn cpp_vm_object_get_attributed_memory_in_reference_owner(
291        vmo: *const VmObject,
292        out_counts: *mut vm_AttributionCounts,
293    );
294}
295unsafe extern "C" {
296    pub fn cpp_vm_object_read(
297        vmo: *mut VmObject,
298        ptr: *mut ::core::ffi::c_void,
299        offset: u64,
300        len: usize,
301    ) -> zx_status_t;
302}
303unsafe extern "C" {
304    pub fn cpp_vm_object_zero_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
305}
306unsafe extern "C" {
307    pub fn cpp_vm_object_dirty_pages(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
308}
309unsafe extern "C" {
310    pub fn cpp_vm_object_writeback_begin(
311        vmo: *mut VmObject,
312        offset: u64,
313        len: u64,
314        is_zero_range: bool,
315    ) -> zx_status_t;
316}
317unsafe extern "C" {
318    pub fn cpp_vm_object_writeback_end(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
319}
320unsafe extern "C" {
321    pub fn cpp_vm_object_reclamation_event_count(vmo: *const VmObject) -> u64;
322}
323unsafe extern "C" {
324    pub fn cpp_vm_object_detach_source(vmo: *mut VmObject);
325}
326unsafe extern "C" {
327    pub fn cpp_vm_object_get_attributed_memory_in_range(
328        vmo: *const VmObject,
329        offset: u64,
330        len: u64,
331        out_counts: *mut vm_AttributionCounts,
332    );
333}
334unsafe extern "C" {
335    pub fn cpp_vm_object_try_lock_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
336}
337unsafe extern "C" {
338    pub fn cpp_vm_object_lock_range(
339        vmo: *mut VmObject,
340        offset: u64,
341        len: u64,
342        lock_state_out: *mut zx_vmo_lock_state_t,
343    ) -> zx_status_t;
344}
345unsafe extern "C" {
346    pub fn cpp_vm_object_unlock_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
347}
348unsafe extern "C" {
349    pub fn cpp_vm_object_read_user(
350        vmo: *mut VmObject,
351        buffer: *mut ::core::ffi::c_void,
352        offset: u64,
353        size: usize,
354        options: u8,
355        out_actual: *mut usize,
356    ) -> zx_status_t;
357}
358unsafe extern "C" {
359    pub fn cpp_vm_object_write_user(
360        vmo: *mut VmObject,
361        buffer: *const ::core::ffi::c_void,
362        offset: u64,
363        size: usize,
364        options: u8,
365        on_bytes_transferred: ::core::option::Option<
366            unsafe extern "C" fn(ctx: *mut ::core::ffi::c_void, offset: u64, len: usize),
367        >,
368        on_bytes_transferred_ctx: *mut ::core::ffi::c_void,
369        out_actual: *mut usize,
370    ) -> zx_status_t;
371}
372unsafe extern "C" {
373    pub fn cpp_vm_object_take_pages(
374        vmo: *mut VmObject,
375        offset: u64,
376        len: u64,
377        pages: *mut VmPageSpliceList,
378    ) -> zx_status_t;
379}
380unsafe extern "C" {
381    pub fn cpp_vm_object_supply_pages(
382        vmo: *mut VmObject,
383        offset: u64,
384        len: u64,
385        pages: *mut VmPageSpliceList,
386        options: SupplyOptions,
387    ) -> zx_status_t;
388}
389unsafe extern "C" {
390    pub fn cpp_vm_object_dump(vmo: *mut VmObject, depth: u32, verbose: bool);
391}
392unsafe extern "C" {
393    pub fn cpp_vm_object_commit_high_priority_pages(vmo: *mut VmObject, offset: u64, len: u64);
394}
395pub type cpp_vm_object_dirty_range_fn = ::core::option::Option<
396    unsafe extern "C" fn(
397        ctx: *mut ::core::ffi::c_void,
398        range_offset: u64,
399        range_len: u64,
400        range_is_zero: bool,
401    ) -> zx_status_t,
402>;
403unsafe extern "C" {
404    pub fn cpp_vm_object_enumerate_dirty_ranges(
405        vmo: *mut VmObject,
406        offset: u64,
407        len: u64,
408        ctx: *mut ::core::ffi::c_void,
409        dirty_range_fn: cpp_vm_object_dirty_range_fn,
410    ) -> zx_status_t;
411}
412unsafe extern "C" {
413    pub fn cpp_vm_object_fail_page_requests(
414        vmo: *mut VmObject,
415        offset: u64,
416        len: u64,
417        error_status: zx_status_t,
418    ) -> zx_status_t;
419}
420unsafe extern "C" {
421    pub fn cpp_vm_object_query_pager_vmo_stats(
422        vmo: *mut VmObject,
423        reset: bool,
424        stats: *mut zx_pager_vmo_stats_t,
425    ) -> zx_status_t;
426}
427unsafe extern "C" {
428    pub fn cpp_vm_object_get_page_source_koid(vmo: *const VmObject) -> zx_koid_t;
429}
430unsafe extern "C" {
431    pub fn cpp_vm_object_is_paged(vmo: *const VmObject) -> bool;
432}
433unsafe extern "C" {
434    pub fn cpp_vm_object_num_mappings(vmo: *const VmObject) -> u32;
435}
436unsafe extern "C" {
437    pub fn cpp_vm_object_share_count(vmo: *const VmObject) -> u32;
438}
439unsafe extern "C" {
440    pub fn cpp_vm_object_is_user_pager_backed(vmo: *const VmObject) -> bool;
441}
442unsafe extern "C" {
443    pub fn cpp_vm_object_child_type(vmo: *const VmObject) -> VmObject_ChildType;
444}
445unsafe extern "C" {
446    pub fn cpp_vm_object_heap_allocation_bytes(vmo: *const VmObject) -> u64;
447}
448unsafe extern "C" {
449    pub fn cpp_vm_object_cache_op(
450        vmo: *mut VmObject,
451        offset: u64,
452        len: u64,
453        type_: VmObject_CacheOpType,
454    ) -> zx_status_t;
455}
456unsafe extern "C" {
457    pub fn cpp_vm_object_prefetch_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
458}
459unsafe extern "C" {
460    pub fn cpp_vm_object_zero_range_untracked(
461        vmo: *mut VmObject,
462        offset: u64,
463        len: u64,
464    ) -> zx_status_t;
465}
466unsafe extern "C" {
467    pub fn cpp_vm_object_set_user_stream_size(vmo: *mut VmObject, ssm: *mut StreamSizeManager);
468}