Home
last modified time | relevance | path

Searched refs:T (Results 1 – 25 of 32) sorted by relevance

12

/DragonOS-0.1.8/kernel/src/libs/
Dvolatile.rs71 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 …]
Dlazy_init.rs28 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 …]
Drwlock.rs35 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 …]
Dnotifier.rs10 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 …]
Dalign.rs16 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 …]
Dmutex.rs30 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 …]
Dspinlock.rs164 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 …]
Dcasting.rs65 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
Dffi_convert.rs2 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()
Dwait_queue.rs99 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/
Dvirtio_net.rs23 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/
Dpercpu.rs48 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> {}
Dmod.rs231 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/
Drwlock.md29 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 …]
Dmutex.md28 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>
Dspinlock.md38 pub struct SpinLock<T> {
41 data: UnsafeCell<T>,
/DragonOS-0.1.8/docs/kernel/core_api/
Dcasting.md42 ### 2.1 从Arc<dyn U>转换为Arc<T>
44 &emsp;&emsp;当我们需要把一个`Arc<dyn U>`转换为`Arc<T>`的具体类型指针时,我们要为`U`这个trait实现`DowncastArc`trait。这个trait定义在`k…
60 let arc_t: Arc<T> = arc.downcast_arc::<T>().unwrap();
63 &emsp;&emsp;如果`arc`的具体类型不是`Arc<T>`,那么`downcast_arc::<T>()`会返回`None`。
/DragonOS-0.1.8/kernel/src/driver/virtio/
Dtransport_pci.rs315 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/
Dbus.rs177 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()
Ddriver.rs127 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()
Dmod.rs270 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/
Dpage_frame.rs304 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/
Dexec.rs269 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/
Dmod.rs77 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/
Dmod.rs98 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()

12