1 // Copyright 2017 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 std::ffi::CStr; 6 7 use crate::rutabaga_os::descriptor::AsRawDescriptor; 8 use crate::rutabaga_os::descriptor::IntoRawDescriptor; 9 use crate::rutabaga_os::RawDescriptor; 10 use crate::rutabaga_utils::RutabagaError; 11 use crate::rutabaga_utils::RutabagaResult; 12 13 pub struct SharedMemory { 14 size: u64, 15 } 16 17 impl SharedMemory { 18 /// Creates a new shared memory file descriptor with zero size. new(_debug_name: &CStr, _size: u64) -> RutabagaResult<SharedMemory>19 pub fn new(_debug_name: &CStr, _size: u64) -> RutabagaResult<SharedMemory> { 20 Err(RutabagaError::Unsupported) 21 } 22 23 /// Gets the size in bytes of the shared memory. 24 /// 25 /// The size returned here does not reflect changes by other interfaces or users of the shared 26 /// memory file descriptor.. size(&self) -> u6427 pub fn size(&self) -> u64 { 28 self.size 29 } 30 } 31 32 impl AsRawDescriptor for SharedMemory { as_raw_descriptor(&self) -> RawDescriptor33 fn as_raw_descriptor(&self) -> RawDescriptor { 34 unimplemented!() 35 } 36 } 37 38 impl IntoRawDescriptor for SharedMemory { into_raw_descriptor(self) -> RawDescriptor39 fn into_raw_descriptor(self) -> RawDescriptor { 40 unimplemented!() 41 } 42 } 43 44 /// Uses the system's page size in bytes to round the given value up to the nearest page boundary. round_up_to_page_size(_v: u64) -> RutabagaResult<u64>45pub fn round_up_to_page_size(_v: u64) -> RutabagaResult<u64> { 46 Err(RutabagaError::Unsupported) 47 } 48