Home
last modified time | relevance | path

Searched refs:lock (Results 1 – 25 of 95) sorted by relevance

1234

/DragonOS-0.1.9/kernel/src/common/
Dspinlock.h22 int8_t lock; // 1:unlocked 0:locked member
25 extern void __arch_spin_lock(spinlock_t *lock);
26 extern void __arch_spin_unlock(spinlock_t *lock);
28 extern void __arch_spin_lock_no_preempt(spinlock_t *lock);
29 extern void __arch_spin_unlock_no_preempt(spinlock_t *lock);
31 extern long __arch_spin_trylock(spinlock_t *lock);
38 void spin_lock(spinlock_t *lock) in spin_lock() argument
40 __arch_spin_lock(lock); in spin_lock()
48 void spin_unlock(spinlock_t *lock) in spin_unlock() argument
50 __arch_spin_unlock(lock); in spin_unlock()
[all …]
/DragonOS-0.1.9/kernel/src/arch/x86_64/asm/
Dspinlock.c4 void __arch_spin_lock(spinlock_t *lock) in __arch_spin_lock() argument
15 : "=m"(lock->lock)::"memory"); in __arch_spin_lock()
19 void __arch_spin_unlock(spinlock_t *lock) in __arch_spin_unlock() argument
21 __asm__ __volatile__("movb $1, %0 \n\t" : "=m"(lock->lock)::"memory"); in __arch_spin_unlock()
25 void __arch_spin_lock_no_preempt(spinlock_t *lock) in __arch_spin_lock_no_preempt() argument
36 : "=m"(lock->lock)::"memory"); in __arch_spin_lock_no_preempt()
39 void __arch_spin_unlock_no_preempt(spinlock_t *lock) in __arch_spin_unlock_no_preempt() argument
41 __asm__ __volatile__("movb $1, %0 \n\t" : "=m"(lock->lock)::"memory"); in __arch_spin_unlock_no_preempt()
44 long __arch_spin_trylock(spinlock_t *lock) in __arch_spin_trylock() argument
50 : "=q"(tmp_val), "=m"(lock->lock) in __arch_spin_trylock()
/DragonOS-0.1.9/kernel/src/arch/riscv64/asm/
Dspinlock.c4 void __arch_spin_lock(spinlock_t *lock) in __arch_spin_lock() argument
10 void __arch_spin_unlock(spinlock_t *lock) in __arch_spin_unlock() argument
16 void __arch_spin_lock_no_preempt(spinlock_t *lock) in __arch_spin_lock_no_preempt() argument
21 void __arch_spin_unlock_no_preempt(spinlock_t *lock) in __arch_spin_unlock_no_preempt() argument
26 long __arch_spin_trylock(spinlock_t *lock) in __arch_spin_trylock() argument
/DragonOS-0.1.9/kernel/src/driver/input/serio/i8042/
Di8042_device.rs74 self.inner.lock().bus.clone() in bus()
78 self.inner.lock().bus = bus; in set_bus()
82 self.inner.lock().class = class; in set_class()
86 self.inner.lock().driver.clone()?.upgrade() in driver()
90 self.inner.lock().driver = driver; in set_driver()
114 self.inner.lock().kern_inode = inode; in set_inode()
118 self.inner.lock().kern_inode.clone() in inode()
122 self.inner.lock().parent.clone() in parent()
126 self.inner.lock().parent = parent; in set_parent()
130 self.inner.lock().kset.clone() in kset()
[all …]
Di8042_driver.rs47 r.inner.lock().self_ref = Arc::downgrade(&r); in new()
74 device.set_driver(Some(self.inner.lock().self_ref.clone())); in probe()
107 self.inner.lock().devices.clone() in devices()
111 let mut guard = self.inner.lock(); in add_device()
121 let mut guard = self.inner.lock(); in delete_device()
126 self.inner.lock().bus = bus; in set_bus()
130 self.inner.lock().bus.clone() in bus()
140 self.inner.lock().kernfs_inode = inode; in set_inode()
144 self.inner.lock().kernfs_inode.clone() in inode()
148 self.inner.lock().parent.clone() in parent()
[all …]
Di8042_ports.rs72 self.inner.lock().bus.clone() in bus()
76 self.inner.lock().bus = bus; in set_bus()
80 self.inner.lock().class = class; in set_class()
84 self.inner.lock().driver.clone()?.upgrade() in driver()
88 self.inner.lock().driver = driver; in set_driver()
112 self.inner.lock().kern_inode = inode; in set_inode()
116 self.inner.lock().kern_inode.clone() in inode()
120 self.inner.lock().parent.clone() in parent()
124 self.inner.lock().parent = parent; in set_parent()
128 self.inner.lock().kset.clone() in kset()
[all …]
/DragonOS-0.1.9/kernel/src/libs/
Dspinlock.rs18 lock: AtomicBool, field
28 lock: &'a SpinLock<T>, field
48 unsafe { &mut *this.lock.data.get() } in leak()
53 self.lock.force_unlock(); in unlock_no_preempt()
65 lock: AtomicBool::new(false), in new()
71 pub fn lock(&self) -> SpinLockGuard<T> { in lock() method
107 lock: self, in try_lock()
122 .lock in inner_try_lock()
133 lock: self, in try_lock_irqsave()
147 lock: self, in try_lock_no_preempt()
[all …]
Dmutex.rs39 lock: &'a Mutex<T>, field
61 pub fn lock(&self) -> MutexGuard<T> { in lock() method
63 let mut inner: SpinLockGuard<MutexInner> = self.inner.lock(); in lock()
84 return MutexGuard { lock: self }; in lock()
93 let mut inner = self.inner.lock(); in try_lock()
101 return Ok(MutexGuard { lock: self }); in try_lock()
117 let mut inner: SpinLockGuard<MutexInner> = self.inner.lock(); in unlock()
153 return unsafe { &*self.lock.data.get() }; in deref()
160 return unsafe { &mut *self.lock.data.get() }; in deref_mut()
167 self.lock.unlock(); in drop()
Drwlock.rs39 lock: AtomicU32, field
47 lock: &'a AtomicU32, field
79 lock: AtomicU32::new(0), in new()
106 let value = self.lock.fetch_add(READER, Ordering::Acquire); in current_reader()
110 self.lock.fetch_sub(READER, Ordering::Release); in current_reader()
144 self.lock.fetch_sub(READER, Ordering::Release); in inner_try_read()
149 lock: &self.lock, in inner_try_read()
196 let state = self.lock.load(Ordering::Relaxed); in reader_count()
204 return (self.lock.load(Ordering::Relaxed) & WRITER) / WRITER; in writer_count()
242 .lock in inner_try_write()
[all …]
/DragonOS-0.1.9/kernel/src/driver/base/platform/
Dplatform_device.rs160 let state = self.inner.lock().state; in is_initialized()
173 let state = &mut self.inner.lock().state; in set_state()
183 let state = self.inner.lock().state; in get_state()
228 self.inner.lock().parent.clone() in parent()
232 self.inner.lock().kernfs_inode.clone() in inode()
236 self.inner.lock().kernfs_inode = inode; in set_inode()
240 self.inner.lock().ktype.clone() in kobj_type()
244 self.inner.lock().ktype = ktype; in set_kobj_type()
248 self.inner.lock().kset.clone() in kset()
264 self.inner.lock().name.clone() in name()
[all …]
/DragonOS-0.1.9/kernel/src/filesystem/ramfs/
Dmod.rs112 let mut root_guard: SpinLockGuard<RamFSInode> = result.root_inode.0.lock(); in new()
125 let mut inode = self.0.lock(); in truncate()
162 let inode: SpinLockGuard<RamFSInode> = self.0.lock(); in read_at()
195 let mut inode: SpinLockGuard<RamFSInode> = self.0.lock(); in write_at()
215 return self.0.lock().fs.upgrade().unwrap(); in fs()
223 let inode = self.0.lock(); in metadata()
231 let mut inode = self.0.lock(); in set_metadata()
243 let mut inode = self.0.lock(); in resize()
260 let mut inode = self.0.lock(); in create_with_data()
297 result.0.lock().self_ref = Arc::downgrade(&result); in create_with_data()
[all …]
/DragonOS-0.1.9/docs/kernel/locking/
Dmutex.md49 &emsp;&emsp;当需要读取、修改Mutex保护的数据时,请先使用Mutex的`lock()`方法。该方法会返回一个`MutexGuard`。您可以使用被保护的数据的成员函数来进行一些操作。或…
56 let mut g :MutexGuard<Vec<i32>>= x.lock();
101 ### 4.2. lock - 加锁
106 pub fn lock(&self) -> MutexGuard<T>
145 **`void mutex_init(mutex_t *lock)`**
151 **`void mutex_lock(mutex_t *lock)`**
157 **`void mutex_unlock(mutex_t *lock)`**
163 **`void mutex_trylock(mutex_t *lock)`**
169 **`void mutex_is_locked(mutex_t *lock)`**
Dspinlock.md19 需要先调用`lock()`方法,然后当离开临界区时,手动调用`unlock()`方法。我们并没有向编译器显式地指定该自旋锁到底保护的是哪些数据。
39 lock: RawSpinlock,
55 &emsp;&emsp;当需要读取、修改SpinLock保护的数据时,请先使用SpinLock的`lock()`方法。该方法会返回一个`SpinLockGuard`。您可以使用被保护的数据的成员函数…
62 let mut g :SpinLockGuard<Vec<i32>>= x.lock();
94 &emsp;&emsp;`SpinLock`之所以能够实现编译期检查,是因为它引入了一个`SpinLockGuard`作为守卫。我们在编写代码的时候,保证只有调用`SpinLock`的`lock()…
/DragonOS-0.1.9/kernel/src/driver/open_firmware/
Ddevice_node.rs62 self.inner.lock().properties.push(prop); in add_property()
66 self.inner.lock().properties.clone() in properties()
70 self.inner.lock().parent.upgrade() in parent()
74 self.inner.lock().parent = Arc::downgrade(&parent); in set_parent()
78 self.inner.lock().children.clone() in children()
82 self.inner.lock().children.push(child); in add_child()
86 self.inner.lock().sibling.as_ref().and_then(|s| s.upgrade()) in sibling()
90 self.inner.lock().sibling = Some(Arc::downgrade(&sibling)); in set_sibling()
94 self.inner.lock().private_data.clone() in private_data()
98 self.inner.lock().private_data = Some(data); in set_private_data()
/DragonOS-0.1.9/kernel/src/driver/input/ps2_mouse/
Dps_mouse_driver.rs96 r.inner.lock().self_ref = Arc::downgrade(&r); in new()
102 let guard = self.inner.lock(); in process_packet()
131 self.inner.lock().devices.clone() in devices()
135 let mut guard = self.inner.lock(); in add_device()
145 let mut guard = self.inner.lock(); in delete_device()
150 self.inner.lock().bus = bus; in set_bus()
154 self.inner.lock().bus.clone() in bus()
164 self.inner.lock().kernfs_inode = inode; in set_inode()
168 self.inner.lock().kernfs_inode.clone() in inode()
172 self.inner.lock().parent.clone() in parent()
[all …]
/DragonOS-0.1.9/kernel/src/driver/video/fbdev/base/
Dfbmem.rs234 let mut inner_guard = r.inner.lock(); in new()
243 self.inner.lock().fb.upgrade() in framebuffer()
248 let inner_guard = self.inner.lock(); in device_number()
278 self.inner.lock().kern_inode = inode; in set_inode()
282 self.inner.lock().kern_inode.clone() in inode()
286 self.inner.lock().parent.clone() in parent()
290 self.inner.lock().parent = parent; in set_parent()
294 self.inner.lock().kset.clone() in kset()
298 self.inner.lock().kset = kset; in set_kset()
302 self.inner.lock().ktype in kobj_type()
[all …]
/DragonOS-0.1.9/kernel/src/virt/kvm/
Dmod.rs24 let mut vm_list = VM_LIST.lock(); in push_vm()
35 let mut vm_list = VM_LIST.lock(); in remove_vm()
46 let mut vm_list = VM_LIST.lock(); in update_vm()
51 let vm_list = VM_LIST.lock(); in vm()
/DragonOS-0.1.9/kernel/src/driver/disk/ahci/
Dahci_inode.rs62 result.0.lock().self_ref = Arc::downgrade(&result); in new()
70 self.0.lock().fs = fs; in set_fs()
88 return Ok(self.0.lock().metadata.clone()); in metadata()
92 return self.0.lock().fs.upgrade().unwrap(); in fs()
100 let mut inode = self.0.lock(); in set_metadata()
124 return self.0.lock().disk.read_at_bytes(offset, len, buf); in read_at()
143 return self.0.lock().disk.write_at_bytes(offset, len, buf); in write_at()
Dmod.rs68 let mut disks_list = LOCKED_DISKS_LIST.lock(); in ahci_init()
84 let mut hba_mem_list = LOCKED_HBA_MEM_LIST.lock(); in ahci_init()
95 let hba_mem_list = LOCKED_HBA_MEM_LIST.lock(); in ahci_init()
161 let disks_list = LOCKED_DISKS_LIST.lock(); in disks()
167 let disks_list: SpinLockGuard<Vec<Arc<LockedAhciDisk>>> = LOCKED_DISKS_LIST.lock(); in get_disks_by_name()
170 .find(|x| x.0.lock().name == name) in get_disks_by_name()
178 let list: SpinLockGuard<Vec<&mut HbaMem>> = LOCKED_HBA_MEM_LIST.lock(); in _port()
/DragonOS-0.1.9/kernel/src/libs/intertrait/
D.gitignore1 # Cargo lock in subs
2 **/Cargo.lock
/DragonOS-0.1.9/kernel/src/time/
Dclocksource.rs143 let watchdog_list = &WATCHDOG_LIST.lock(); in clocksource_start_watchdog()
289 let list_guard = &mut CLOCKSOURCE_LIST.lock(); in clocksource_enqueue()
343 let mut list_guard = WATCHDOG_LIST.lock(); in clocksource_enqueue_watchdog()
348 let cs_watchdog = &mut CLOCKSOUCE_WATCHDOG.lock(); in clocksource_enqueue_watchdog()
400 let mut locked_watchdog = CLOCKSOUCE_WATCHDOG.lock(); in clocksource_dequeue_watchdog()
407 let mut list = WATCHDOG_LIST.lock(); in clocksource_dequeue_watchdog()
442 let mut clocksource_list = CLOCKSOURCE_LIST.lock(); in clocksource_dequeue_watchdog()
495 let mut list = CLOCKSOURCE_LIST.lock(); in clocksource_dequeue()
622 let list = CLOCKSOURCE_LIST.lock(); in clocksource_resume()
638 let list = CLOCKSOURCE_LIST.lock(); in clocksource_suspend()
[all …]
/DragonOS-0.1.9/kernel/src/driver/video/fbdev/
Dvesafb.rs141 self.inner.lock().fb_id in fb_id()
145 self.inner.lock().fb_id = id; in set_fb_id()
155 self.inner.lock().pdev_id = id; in set_pdev_id()
159 self.inner.lock().pdev_id_auto = id_auto; in set_pdev_id_auto()
167 self.inner.lock().device_state == DeviceState::Initialized in is_initialized()
171 self.inner.lock().device_state = set_state; in set_state()
185 self.inner.lock().bus.clone() in bus()
189 self.inner.lock().bus = bus; in set_bus()
193 self.inner.lock().class = class; in set_class()
197 self.inner.lock().driver.clone()?.upgrade() in driver()
[all …]
/DragonOS-0.1.9/kernel/src/filesystem/procfs/
Dmod.rs321 let mut root_guard: SpinLockGuard<ProcFSInode> = result.root_inode.0.lock(); in new()
340 meminfo_file.0.lock().fdata.pid = Pid::new(0); in new()
341 meminfo_file.0.lock().fdata.ftype = ProcFileType::ProcMeminfo; in new()
353 kmsg_file.0.lock().fdata.pid = Pid::new(1); in new()
354 kmsg_file.0.lock().fdata.ftype = ProcFileType::ProcKmsg; in new()
384 status_file.0.lock().fdata.pid = pid; in register_pid()
385 status_file.0.lock().fdata.ftype = ProcFileType::ProcStatus; in register_pid()
415 let mut inode: SpinLockGuard<ProcFSInode> = self.0.lock(); in open()
438 let guard: SpinLockGuard<ProcFSInode> = self.0.lock(); in close()
460 let inode: SpinLockGuard<ProcFSInode> = self.0.lock(); in read_at()
[all …]
/DragonOS-0.1.9/kernel/src/filesystem/devfs/
Dnull_dev.rs57 result.0.lock().self_ref = Arc::downgrade(&result); in new()
65 self.0.lock().fs = fs; in set_fs()
83 return Ok(self.0.lock().metadata.clone()); in metadata()
87 return self.0.lock().fs.upgrade().unwrap(); in fs()
95 let mut inode = self.0.lock(); in set_metadata()
Dzero_dev.rs57 result.0.lock().self_ref = Arc::downgrade(&result); in new()
65 self.0.lock().fs = fs; in set_fs()
83 return Ok(self.0.lock().metadata.clone()); in metadata()
87 return self.0.lock().fs.upgrade().unwrap(); in fs()
95 let mut inode = self.0.lock(); in set_metadata()

1234