/DragonOS-0.1.8/kernel/src/libs/ |
D | volatile.rs | 71 pub struct ReadOnly<T: Copy>(T); 74 impl<T: Copy> ReadOnly<T> { 76 pub fn new(value: T) -> Self { in new() 84 pub struct WriteOnly<T: Copy>(T); 89 pub struct Volatile<T: Copy>(T); 92 impl<T: Copy> Volatile<T> { 94 pub fn new(value: T) -> Self { in new() 100 pub trait VolatileReadable<T> { 102 unsafe fn vread(self) -> T; in vread() argument 105 impl<T: Copy> VolatileReadable<T> for *const ReadOnly<T> { [all …]
|
D | lazy_init.rs | 28 pub struct Lazy<T> { 32 value: UnsafeCell<MaybeUninit<T>>, 37 impl<T> Lazy<T> { 40 pub const fn new() -> Lazy<T> { in new() 68 pub fn init(&self, value: T) { in init() argument 86 pub fn get(&self) -> &T { in get() argument 93 pub fn try_get(&self) -> Option<&T> { in try_get() argument 104 pub fn get_mut(&mut self) -> &mut T { in get_mut() argument 110 pub unsafe fn get_unchecked(&self) -> &T { in get_unchecked() argument 115 pub unsafe fn get_mut_unchecked(&mut self) -> &mut T { in get_mut_unchecked() argument [all …]
|
D | rwlock.rs | 35 pub struct RwLock<T> { 37 data: UnsafeCell<T>, 42 pub struct RwLockReadGuard<'a, T: 'a> { 43 data: *const T, 51 pub struct RwLockUpgradableGuard<'a, T: 'a> { 52 data: *const T, 53 inner: &'a RwLock<T>, 59 pub struct RwLockWriteGuard<'a, T: 'a> { 60 data: *mut T, 61 inner: &'a RwLock<T>, [all …]
|
D | notifier.rs | 10 pub trait NotifierBlock<T> { 12 fn notifier_call(&self, action: u64, data: Option<&T>) -> i32; in notifier_call() 19 struct NotifierChain<T>(Vec<Arc<dyn NotifierBlock<T>>>); 21 impl<T> NotifierChain<T> { 30 block: Arc<dyn NotifierBlock<T>>, in register() argument 64 pub fn unregister(&mut self, block: Arc<dyn NotifierBlock<T>>) -> Result<(), SystemError> { in unregister() 81 data: Option<&T>, in call_chain() argument 99 pub struct AtomicNotifierChain<T>(SpinLock<NotifierChain<T>>); 101 impl<T> AtomicNotifierChain<T> { 103 Self(SpinLock::new(NotifierChain::<T>::new())) in new() [all …]
|
D | align.rs | 16 pub struct AlignedBox<T, const ALIGN: usize> { 17 inner: Unique<T>, 20 impl<T, const ALIGN: usize> AlignedBox<T, ALIGN> { 30 core::mem::size_of::<T>(), 31 max(ALIGN, core::mem::align_of::<T>()), 49 T: SafeForZero, in new_zeroed() 62 impl<T, const ALIGN: usize> Debug for AlignedBox<T, ALIGN> { 67 core::any::type_name::<T>(), in fmt() 68 core::mem::align_of::<T>(), in fmt() 70 core::mem::size_of::<T>() in fmt() [all …]
|
D | mutex.rs | 30 pub struct Mutex<T> { 32 data: UnsafeCell<T>, 39 pub struct MutexGuard<'a, T: 'a> { 40 lock: &'a Mutex<T>, 43 unsafe impl<T> Sync for Mutex<T> where T: Send {} 45 impl<T> Mutex<T> { 48 pub const fn new(value: T) -> Self { in new() 62 pub fn lock(&self) -> MutexGuard<T> { in lock() argument 92 pub fn try_lock(&self) -> Result<MutexGuard<T>, SystemError> { in try_lock() argument 150 impl<T> Deref for MutexGuard<'_, T> { [all …]
|
D | spinlock.rs | 164 pub struct SpinLock<T> { 167 data: UnsafeCell<T>, 174 pub struct SpinLockGuard<'a, T: 'a> { 175 lock: &'a SpinLock<T>, 179 impl<'a, T: 'a> SpinLockGuard<'a, T> { 189 pub unsafe fn leak(this: Self) -> &'a mut T { in leak() argument 199 unsafe impl<T> Sync for SpinLock<T> where T: Send {} 201 impl<T> SpinLock<T> { 202 pub const fn new(value: T) -> Self { in new() 210 pub fn lock(&self) -> SpinLockGuard<T> { in lock() argument [all …]
|
D | casting.rs | 65 fn downcast_arc<T: Any + Send + Sync>(self: Arc<Self>) -> Option<Arc<T>> { in downcast_arc() argument 67 if x.is::<T>() { in downcast_arc() 70 let new = unsafe { Arc::from_raw(p as *const T) }; in downcast_arc() constant
|
D | ffi_convert.rs | 2 pub trait FFIBind2Rust<T> { 4 fn convert_ref(src: *const T) -> Option<&'static Self>; in convert_ref() 6 fn convert_mut(src: *mut T) -> Option<&'static mut Self>; in convert_mut()
|
D | wait_queue.rs | 99 pub fn sleep_unlock_spinlock<T>(&self, to_unlock: SpinLockGuard<T>) { in sleep_unlock_spinlock() argument 110 pub fn sleep_unlock_mutex<T>(&self, to_unlock: MutexGuard<T>) { in sleep_unlock_mutex() argument 121 pub fn sleep_uninterruptible_unlock_spinlock<T>(&self, to_unlock: SpinLockGuard<T>) { in sleep_uninterruptible_unlock_spinlock() argument 132 pub fn sleep_uninterruptible_unlock_mutex<T>(&self, to_unlock: MutexGuard<T>) { in sleep_uninterruptible_unlock_mutex() argument
|
/DragonOS-0.1.8/kernel/src/driver/net/ |
D | virtio_net.rs | 23 pub struct VirtioNICDriver<T: Transport> { 24 pub inner: Arc<SpinLock<VirtIONet<HalImpl, T, 2>>>, 27 impl<T: Transport> Clone for VirtioNICDriver<T> { 38 struct VirtioNICDriverWrapper<T: Transport>(UnsafeCell<VirtioNICDriver<T>>); 39 unsafe impl<T: Transport> Send for VirtioNICDriverWrapper<T> {} 40 unsafe impl<T: Transport> Sync for VirtioNICDriverWrapper<T> {} 42 impl<T: Transport> Deref for VirtioNICDriverWrapper<T> { 43 type Target = VirtioNICDriver<T>; 48 impl<T: Transport> DerefMut for VirtioNICDriverWrapper<T> { 54 impl<T: Transport> VirtioNICDriverWrapper<T> { [all …]
|
/DragonOS-0.1.8/kernel/src/mm/ |
D | percpu.rs | 48 pub struct PerCpuVar<T> { 49 inner: Vec<T>, 53 impl<T> PerCpuVar<T> { 59 pub fn new(data: Vec<T>) -> Option<Self> { in new() 77 pub fn get(&self) -> &T { in get() argument 82 pub fn get_mut(&mut self) -> &mut T { in get_mut() argument 89 unsafe impl<T> Sync for PerCpuVar<T> {} 90 unsafe impl<T> Send for PerCpuVar<T> {}
|
D | mod.rs | 231 pub fn as_ptr<T>(self) -> *mut T { in as_ptr() argument 232 return self.0 as *mut T; in as_ptr() 393 unsafe fn read<T>(address: VirtAddr) -> T { in read() argument 394 return ptr::read(address.data() as *const T); in read() constant 399 unsafe fn write<T>(address: VirtAddr, value: T) { in write() argument 400 ptr::write(address.data() as *mut T, value); in write()
|
/DragonOS-0.1.8/docs/kernel/locking/ |
D | rwlock.md | 29 pub struct RwLock<T> { 31 data: UnsafeCell<T>, 36 pub struct RwLockReadGuard<'a, T: 'a> { 37 data: *const T, 44 pub struct RwLockUpgradableGuard<'a, T: 'a> { 45 data: *const T, 46 inner: &'a RwLock<T>, 52 pub struct RwLockWriteGuard<'a, T: 'a> { 53 data: *mut T, 54 inner: &'a RwLock<T>, [all …]
|
D | mutex.md | 28 pub struct Mutex<T> { 30 data: UnsafeCell<T>, 93 pub const fn new(value: T) -> Self 106 pub fn lock(&self) -> MutexGuard<T> 120 pub fn try_lock(&self) -> Result<MutexGuard<T>, i32>
|
D | spinlock.md | 38 pub struct SpinLock<T> { 41 data: UnsafeCell<T>,
|
/DragonOS-0.1.8/docs/kernel/core_api/ |
D | casting.md | 42 ### 2.1 从Arc<dyn U>转换为Arc<T> 44   当我们需要把一个`Arc<dyn U>`转换为`Arc<T>`的具体类型指针时,我们要为`U`这个trait实现`DowncastArc`trait。这个trait定义在`k… 60 let arc_t: Arc<T> = arc.downcast_arc::<T>().unwrap(); 63   如果`arc`的具体类型不是`Arc<T>`,那么`downcast_arc::<T>()`会返回`None`。
|
/DragonOS-0.1.8/kernel/src/driver/virtio/ |
D | transport_pci.rs | 315 fn config_space<T>(&self) -> Result<NonNull<T>, Error> { in config_space() argument 317 if size_of::<T>() > config_space.len() * size_of::<u32>() { in config_space() 319 } else if align_of::<T>() > 4 { in config_space() 323 align_of::<T>() in config_space() 459 fn get_bar_region<T>( in get_bar_region() 462 ) -> Result<NonNull<T>, VirtioPciError> { in get_bar_region() argument 471 || size_of::<T>() > struct_info.length as usize in get_bar_region() 480 if vaddr % align_of::<T>() != 0 { in get_bar_region() 483 alignment: align_of::<T>(), in get_bar_region() 493 fn get_bar_region_slice<T>( in get_bar_region_slice() [all …]
|
/DragonOS-0.1.8/kernel/src/driver/base/device/ |
D | bus.rs | 177 pub fn bus_register<T: Bus>(bus: Arc<T>) -> Result<(), DeviceError> { in bus_register() 192 pub fn bus_unregister<T: Bus>(bus: Arc<T>) -> Result<(), DeviceError> { in bus_unregister() 200 pub fn bus_driver_register<T: BusDriver>(bus_driver: Arc<T>) -> Result<(), DriverError> { in bus_driver_register() 209 pub fn bus_driver_unregister<T: BusDriver>(bus_driver: Arc<T>) -> Result<(), DriverError> { in bus_driver_unregister()
|
D | driver.rs | 127 pub fn driver_register<T: Driver>(driver: Arc<T>) -> Result<(), DriverError> { in driver_register() 136 pub fn driver_unregister<T: Driver>(driver: Arc<T>) -> Result<(), DriverError> { in driver_unregister()
|
D | mod.rs | 270 pub fn device_register<T: Device>(device: Arc<T>) -> Result<(), DeviceError> { in device_register() 284 pub fn device_unregister<T: Device>(device: Arc<T>) -> Result<(), DeviceError> { in device_unregister()
|
/DragonOS-0.1.8/kernel/src/mm/allocator/ |
D | page_frame.rs | 304 impl<T: FrameAllocator> FrameAllocator for &mut T { implementation 306 return T::allocate(self, count); in allocate() 309 return T::free(self, address, count); in free() 312 return T::allocate_one(self); in allocate_one() 315 return T::free_one(self, address); in free_one() 318 return T::usage(self); in usage()
|
/DragonOS-0.1.8/kernel/src/process/ |
D | exec.rs | 269 fn push_slice<T: Copy>(&self, ustack: &mut UserStack, slice: &[T]) -> Result<(), SystemError> { in push_slice() 271 sp -= slice.len() * core::mem::size_of::<T>(); in push_slice() 272 sp -= sp.data() % core::mem::align_of::<T>(); in push_slice() 274 unsafe { core::slice::from_raw_parts_mut(sp.data() as *mut T, slice.len()) } in push_slice()
|
/DragonOS-0.1.8/kernel/src/time/ |
D | mod.rs | 77 pub fn from_micros<T: Into<i64>>(micros: T) -> Instant { in from_micros() 88 pub fn from_millis<T: Into<i64>>(millis: T) -> Instant { in from_millis() 102 pub fn from_secs<T: Into<i64>>(secs: T) -> Instant { in from_secs()
|
/DragonOS-0.1.8/kernel/src/filesystem/devfs/ |
D | mod.rs | 98 pub fn register_device<T: DeviceINode>( in register_device() 101 device: Arc<T>, in register_device() argument 149 pub fn unregister_device<T: DeviceINode>( in unregister_device() 152 device: Arc<T>, in unregister_device() argument 523 pub fn devfs_register<T: DeviceINode>(name: &str, device: Arc<T>) -> Result<(), SystemError> { in devfs_register() 529 pub fn devfs_unregister<T: DeviceINode>(name: &str, device: Arc<T>) -> Result<(), SystemError> { in devfs_unregister()
|