xref: /aosp_15_r20/external/crosvm/vm_memory/src/udmabuf/sys/windows.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2022 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 
5 use base::error;
6 use base::SafeDescriptor;
7 
8 use crate::udmabuf::UdmabufDriverTrait;
9 use crate::udmabuf::UdmabufError;
10 use crate::udmabuf::UdmabufResult;
11 use crate::GuestAddress;
12 use crate::GuestMemory;
13 
14 /// This struct is a no-op because udmabuf driver is not supported on Windows.
15 pub struct WinUdmabufDriver;
16 
17 impl UdmabufDriverTrait for WinUdmabufDriver {
new() -> UdmabufResult<WinUdmabufDriver>18     fn new() -> UdmabufResult<WinUdmabufDriver> {
19         error!("udmabuf is unsupported on Windows");
20         Err(UdmabufError::UdmabufUnsupported)
21     }
22 
create_udmabuf( &self, _mem: &GuestMemory, _iovecs: &[(GuestAddress, usize)], ) -> UdmabufResult<SafeDescriptor>23     fn create_udmabuf(
24         &self,
25         _mem: &GuestMemory,
26         _iovecs: &[(GuestAddress, usize)],
27     ) -> UdmabufResult<SafeDescriptor> {
28         error!("udmabuf is unsupported on Windows");
29         Err(UdmabufError::UdmabufUnsupported)
30     }
31 }
32