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 zx_types::zx_status_t;
11
12#[derive(PartialEq, Eq, Copy, Clone, Debug, Hash)]
13#[repr(C, align(8))]
14pub struct __BindgenOpaqueArray8<T>(pub T);
15impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray8<[T; N]> {
16    fn default() -> Self {
17        Self([<T as Default>::default(); N])
18    }
19}
20#[repr(i32)]
21#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
22pub enum Resizability {
23    Resizable = 0,
24    NonResizable = 1,
25}
26#[repr(i32)]
27#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
28pub enum SnapshotType {
29    Full = 0,
30    Modified = 1,
31    OnWrite = 2,
32}
33unsafe extern "C" {
34    pub fn cpp_vm_object_free(vmo: *mut VmObject);
35}
36#[repr(C)]
37#[repr(align(8))]
38#[derive(Debug, Copy, Clone)]
39pub struct VmObject {
40    pub _bindgen_opaque_blob: __BindgenOpaqueArray8<[u8; 128usize]>,
41}
42#[repr(u32)]
43#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
44pub enum VmObject_EvictionHint {
45    DontNeed = 0,
46    AlwaysNeed = 1,
47}
48#[repr(C)]
49#[derive(Debug, Copy, Clone)]
50pub struct VmObject_ChildListLock {
51    pub _base: __BindgenOpaqueArray8<[u8; 24usize]>,
52}
53#[repr(C)]
54#[derive(Debug, Copy, Clone)]
55pub struct VmObject_AllVmosLock {
56    pub _base: __BindgenOpaqueArray8<[u8; 24usize]>,
57}
58pub const VmObject_MAX_SIZE: u64 = 18446744073709486080;
59unsafe extern "C" {
60    pub fn cpp_vm_object_get_ref_counted(vmo: *const VmObject) -> *mut ::core::ffi::c_void;
61}
62unsafe extern "C" {
63    pub fn cpp_vm_object_decommit_range(vmo: *mut VmObject, offset: u64, len: u64) -> zx_status_t;
64}
65unsafe extern "C" {
66    pub fn cpp_vm_object_hint_range(
67        vmo: *mut VmObject,
68        offset: u64,
69        len: u64,
70        hint: VmObject_EvictionHint,
71    ) -> zx_status_t;
72}
73unsafe extern "C" {
74    pub fn cpp_vm_object_size(vmo: *const VmObject) -> u64;
75}
76unsafe extern "C" {
77    pub fn cpp_vm_object_is_resizable(vmo: *const VmObject) -> bool;
78}
79unsafe extern "C" {
80    pub fn cpp_vm_object_is_contiguous(vmo: *const VmObject) -> bool;
81}
82unsafe extern "C" {
83    pub fn cpp_vm_object_resize(vmo: *mut VmObject, size: u64) -> zx_status_t;
84}
85unsafe extern "C" {
86    pub fn cpp_vm_object_write(
87        vmo: *mut VmObject,
88        ptr: *const ::core::ffi::c_void,
89        offset: u64,
90        len: usize,
91    ) -> zx_status_t;
92}
93unsafe extern "C" {
94    pub fn cpp_vm_object_set_name(
95        vmo: *mut VmObject,
96        name: *const ::core::ffi::c_char,
97        len: usize,
98    ) -> zx_status_t;
99}
100unsafe extern "C" {
101    pub fn cpp_vm_object_commit_range_pinned(
102        vmo: *mut VmObject,
103        offset: u64,
104        len: u64,
105        write: bool,
106    ) -> zx_status_t;
107}
108unsafe extern "C" {
109    pub fn cpp_vm_object_unpin(vmo: *mut VmObject, offset: u64, len: u64);
110}
111unsafe extern "C" {
112    pub fn cpp_vm_object_get_mapping_cache_policy(vmo: *const VmObject) -> u8;
113}
114unsafe extern "C" {
115    pub fn cpp_vm_object_create_clone(
116        vmo: *mut VmObject,
117        resizable: Resizability,
118        snapshot_type: SnapshotType,
119        offset: u64,
120        size: u64,
121        copy_name: bool,
122        out_status: *mut zx_status_t,
123    ) -> *mut VmObject;
124}
125unsafe extern "C" {
126    pub fn cpp_vm_object_get_page_blocking(
127        vmo: *mut VmObject,
128        offset: u64,
129        pf_flags: u32,
130    ) -> zx_status_t;
131}
132unsafe extern "C" {
133    pub fn cpp_vm_object_set_user_id(vmo: *mut VmObject, user_id: u64);
134}
135unsafe extern "C" {
136    pub fn cpp_vm_object_user_id(vmo: *const VmObject) -> u64;
137}
138unsafe extern "C" {
139    pub fn cpp_vm_object_parent_user_id(vmo: *const VmObject) -> u64;
140}