1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
// Copyright 2024 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::time::Duration;
use crate::rutabaga_utils::RutabagaMapping;
pub enum TubeType {
Stream,
Packet,
}
pub enum WaitTimeout {
Finite(Duration),
NoTimeout,
}
pub struct WaitEvent {
pub connection_id: u64,
pub hung_up: bool,
pub readable: bool,
}
#[allow(dead_code)]
pub const WAIT_CONTEXT_MAX: usize = 16;
pub enum DescriptorType {
Unknown,
Memory(u32),
WritePipe,
}
/// # Safety
///
/// Caller must ensure that MappedRegion's lifetime contains the lifetime of
/// pointer returned.
pub unsafe trait MappedRegion: Send + Sync {
/// Returns a pointer to the beginning of the memory region. Should only be
/// used for passing this region to ioctls for setting guest memory.
fn as_ptr(&self) -> *mut u8;
/// Returns the size of the memory region in bytes.
fn size(&self) -> usize;
/// Returns rutabaga mapping representation of the region
fn as_rutabaga_mapping(&self) -> RutabagaMapping;
}