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