rutabaga_gfx/cross_domain/sys/
stub.rs

1// Copyright 2021 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use std::fs::File;
6
7use super::super::cross_domain_protocol::CrossDomainInit;
8use super::super::cross_domain_protocol::CrossDomainSendReceive;
9use super::super::CrossDomainContext;
10use super::super::CrossDomainState;
11use crate::cross_domain::CrossDomainEvent;
12use crate::cross_domain::CrossDomainToken;
13use crate::rutabaga_utils::RutabagaError;
14use crate::rutabaga_utils::RutabagaResult;
15
16pub struct Stub(());
17pub type SystemStream = Stub;
18
19// Determine type of OS-specific descriptor.
20pub fn descriptor_analysis(
21    _descriptor: &mut File,
22    _descriptor_type: &mut u32,
23    _size: &mut u32,
24) -> RutabagaResult<()> {
25    Err(RutabagaError::Unsupported)
26}
27
28impl CrossDomainState {
29    pub(crate) fn receive_msg(
30        &self,
31        _opaque_data: &mut [u8],
32    ) -> RutabagaResult<(usize, Vec<File>)> {
33        Err(RutabagaError::Unsupported)
34    }
35}
36
37impl CrossDomainContext {
38    pub(crate) fn get_connection(
39        &mut self,
40        _cmd_init: &CrossDomainInit,
41    ) -> RutabagaResult<Option<SystemStream>> {
42        Err(RutabagaError::Unsupported)
43    }
44
45    pub(crate) fn send(
46        &self,
47        _cmd_send: &CrossDomainSendReceive,
48        _opaque_data: &[u8],
49    ) -> RutabagaResult<()> {
50        Err(RutabagaError::Unsupported)
51    }
52}
53
54pub type Sender = Stub;
55pub type Receiver = Stub;
56
57pub fn channel_signal(_sender: &Sender) -> RutabagaResult<()> {
58    Err(RutabagaError::Unsupported)
59}
60
61pub fn channel_wait(_receiver: &Receiver) -> RutabagaResult<()> {
62    Err(RutabagaError::Unsupported)
63}
64
65pub fn read_volatile(_file: &File, _opaque_data: &mut [u8]) -> RutabagaResult<usize> {
66    Err(RutabagaError::Unsupported)
67}
68
69pub fn write_volatile(_file: &File, _opaque_data: &[u8]) -> RutabagaResult<()> {
70    Err(RutabagaError::Unsupported)
71}
72
73pub fn channel() -> RutabagaResult<(Sender, Receiver)> {
74    Err(RutabagaError::Unsupported)
75}
76
77pub type WaitContext = Stub;
78
79pub trait WaitTrait {}
80impl WaitTrait for Stub {}
81impl WaitTrait for &Stub {}
82impl WaitTrait for File {}
83impl WaitTrait for &File {}
84impl WaitTrait for &mut File {}
85
86impl WaitContext {
87    pub fn new() -> RutabagaResult<WaitContext> {
88        Err(RutabagaError::Unsupported)
89    }
90
91    pub fn add<Waitable: WaitTrait>(
92        &mut self,
93        _token: CrossDomainToken,
94        _waitable: Waitable,
95    ) -> RutabagaResult<()> {
96        Err(RutabagaError::Unsupported)
97    }
98
99    pub fn wait(&mut self) -> RutabagaResult<Vec<CrossDomainEvent>> {
100        Err(RutabagaError::Unsupported)
101    }
102
103    pub fn delete<Waitable: WaitTrait>(
104        &mut self,
105        _token: CrossDomainToken,
106        _waitable: Waitable,
107    ) -> RutabagaResult<()> {
108        Err(RutabagaError::Unsupported)
109    }
110}