rutabaga_gfx/cross_domain/sys/
stub.rs

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright 2021 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::fs::File;

use super::super::cross_domain_protocol::CrossDomainInit;
use super::super::cross_domain_protocol::CrossDomainSendReceive;
use super::super::CrossDomainContext;
use super::super::CrossDomainState;
use crate::cross_domain::CrossDomainEvent;
use crate::cross_domain::CrossDomainToken;
use crate::rutabaga_utils::RutabagaError;
use crate::rutabaga_utils::RutabagaResult;

pub struct Stub(());
pub type SystemStream = Stub;

// Determine type of OS-specific descriptor.
pub fn descriptor_analysis(
    _descriptor: &mut File,
    _descriptor_type: &mut u32,
    _size: &mut u32,
) -> RutabagaResult<()> {
    Err(RutabagaError::Unsupported)
}

impl CrossDomainState {
    pub(crate) fn receive_msg(
        &self,
        _opaque_data: &mut [u8],
    ) -> RutabagaResult<(usize, Vec<File>)> {
        Err(RutabagaError::Unsupported)
    }
}

impl CrossDomainContext {
    pub(crate) fn get_connection(
        &mut self,
        _cmd_init: &CrossDomainInit,
    ) -> RutabagaResult<Option<SystemStream>> {
        Err(RutabagaError::Unsupported)
    }

    pub(crate) fn send(
        &self,
        _cmd_send: &CrossDomainSendReceive,
        _opaque_data: &[u8],
    ) -> RutabagaResult<()> {
        Err(RutabagaError::Unsupported)
    }
}

pub type Sender = Stub;
pub type Receiver = Stub;

pub fn channel_signal(_sender: &Sender) -> RutabagaResult<()> {
    Err(RutabagaError::Unsupported)
}

pub fn channel_wait(_receiver: &Receiver) -> RutabagaResult<()> {
    Err(RutabagaError::Unsupported)
}

pub fn read_volatile(_file: &File, _opaque_data: &mut [u8]) -> RutabagaResult<usize> {
    Err(RutabagaError::Unsupported)
}

pub fn write_volatile(_file: &File, _opaque_data: &[u8]) -> RutabagaResult<()> {
    Err(RutabagaError::Unsupported)
}

pub fn channel() -> RutabagaResult<(Sender, Receiver)> {
    Err(RutabagaError::Unsupported)
}

pub type WaitContext = Stub;

pub trait WaitTrait {}
impl WaitTrait for Stub {}
impl WaitTrait for &Stub {}
impl WaitTrait for File {}
impl WaitTrait for &File {}
impl WaitTrait for &mut File {}

impl WaitContext {
    pub fn new() -> RutabagaResult<WaitContext> {
        Err(RutabagaError::Unsupported)
    }

    pub fn add<Waitable: WaitTrait>(
        &mut self,
        _token: CrossDomainToken,
        _waitable: Waitable,
    ) -> RutabagaResult<()> {
        Err(RutabagaError::Unsupported)
    }

    pub fn wait(&mut self) -> RutabagaResult<Vec<CrossDomainEvent>> {
        Err(RutabagaError::Unsupported)
    }

    pub fn delete<Waitable: WaitTrait>(
        &mut self,
        _token: CrossDomainToken,
        _waitable: Waitable,
    ) -> RutabagaResult<()> {
        Err(RutabagaError::Unsupported)
    }
}