/DragonOS/kernel/src/exception/ |
H A D | dummychip.rs | 1 use alloc::sync::Arc; 12 static mut NO_IRQ_CHIP: Option<Arc<NoIrqChip>> = None; 13 static mut DUMMY_IRQ_CHIP: Option<Arc<DummyIrqChip>> = None; 16 pub fn no_irq_chip() -> Arc<dyn IrqChip> { in no_irq_chip() 22 pub fn dummy_irq_chip() -> Arc<dyn IrqChip> { in dummy_irq_chip() 26 fn ack_bad(irq_data: &Arc<IrqData>) { in ack_bad() 49 fn irq_enable(&self, _irq: &Arc<IrqData>) -> Result<(), SystemError> { in irq_enable() 61 fn irq_disable(&self, _irq: &Arc<IrqData>) {} in irq_disable() 63 fn irq_ack(&self, irq: &Arc<IrqData>) { in irq_ack() 67 fn irq_startup(&self, _irq: &Arc<IrqData>) -> Result<(), SystemError> { in irq_startup() [all …]
|
H A D | irqchip.rs | 5 sync::{Arc, Weak}, 42 fn irq_startup(&self, _irq_data: &Arc<IrqData>) -> Result<(), SystemError> { in irq_startup() 47 fn irq_shutdown(&self, _irq_data: &Arc<IrqData>) -> Result<(), SystemError> { in irq_shutdown() 54 fn irq_enable(&self, _irq_data: &Arc<IrqData>) -> Result<(), SystemError> { in irq_enable() 59 fn irq_disable(&self, irq_data: &Arc<IrqData>); in irq_disable() 62 fn irq_ack(&self, irq_data: &Arc<IrqData>); in irq_ack() 71 fn irq_mask(&self, _irq_data: &Arc<IrqData>) -> Result<(), SystemError> { in irq_mask() 79 fn irq_mask_ack(&self, _irq_data: &Arc<IrqData>) {} in irq_mask_ack() 86 fn irq_unmask(&self, _irq_data: &Arc<IrqData>) -> Result<(), SystemError> { in irq_unmask() 90 fn irq_eoi(&self, _irq_data: &Arc<IrqData>) {} in irq_eoi() [all …]
|
/DragonOS/kernel/src/driver/pci/ |
H A D | driver.rs | 1 use alloc::{sync::Arc, vec::Vec}; 27 fn probe(&self, device: &Arc<dyn PciDevice>, id: &PciDeviceID) -> Result<(), SystemError>; in probe() 28 fn remove(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in remove() 29 fn shutdown(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in shutdown() 30 fn suspend(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in suspend() 31 fn resume(&self, device: &Arc<dyn PciDevice>) -> Result<(), SystemError>; in resume() 48 fn locked_dynid_list(&self) -> Option<Vec<Arc<PciDeviceID>>>; in locked_dynid_list() 58 fn match_dev(&self, dev: &Arc<dyn PciDevice>) -> Option<Arc<PciDeviceID>> { in match_dev() 75 pub fn register(&self, driver: Arc<dyn PciDriver>) -> Result<(), SystemError> { in register() 76 driver.set_bus(Some(Arc::downgrade(&(pci_bus() as Arc<dyn Bus>)))); in register() [all …]
|
H A D | subsys.rs | 3 sync::{Arc, Weak}, 29 static mut PCI_BUS_DEVICE: Option<Arc<PciBusDevice>> = None; 30 static mut PCI_BUS: Option<Arc<PciBus>> = None; 32 pub(super) fn set_pci_bus_device(device: Arc<PciBusDevice>) { in set_pci_bus_device() 38 pub(super) fn set_pci_bus(bus: Arc<PciBus>) { in set_pci_bus() 44 pub fn pci_bus_device() -> Arc<PciBusDevice> { in pci_bus_device() 50 pub fn pci_bus() -> Arc<PciBus> { in pci_bus() 65 pub fn new() -> Arc<Self> { in new() 68 let bus = Arc::new(Self { private }); in new() 90 fn probe(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() [all …]
|
/DragonOS/kernel/src/driver/input/serio/ |
H A D | serio_driver.rs | 1 use alloc::sync::Arc; 17 fn write_wakeup(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in write_wakeup() 32 device: &Arc<dyn SerioDevice>, in interrupt() 37 fn connect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in connect() 39 fn reconnect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in reconnect() 41 fn fast_reconnect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in fast_reconnect() 43 fn disconnect(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in disconnect() 45 fn cleanup(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in cleanup() 67 pub fn register(&self, driver: Arc<dyn SerioDriver>) -> Result<(), SystemError> { in register() 68 driver.set_bus(Some(Arc::downgrade(&(serio_bus() as Arc<dyn Bus>)))); in register() [all …]
|
H A D | serio_device.rs | 1 use alloc::sync::Arc; 24 fn write(&self, device: &Arc<dyn SerioDevice>, data: u8) -> Result<(), SystemError>; in write() 26 fn open(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in open() 28 fn close(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in close() 30 fn start(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in start() 32 fn stop(&self, device: &Arc<dyn SerioDevice>) -> Result<(), SystemError>; in stop() 51 pub fn register_port(&self, device: Arc<dyn SerioDevice>) -> Result<(), SystemError> { in register_port() 65 pub fn init_port(&self, device: Arc<dyn SerioDevice>) -> Result<(), SystemError> { in init_port() 66 device.set_bus(Some(Arc::downgrade(&(serio_bus() as Arc<dyn Bus>)))); in init_port() 67 device_manager().add_device(device.clone() as Arc<dyn Device>)?; in init_port()
|
/DragonOS/kernel/src/driver/base/platform/ |
H A D | platform_driver.rs | 1 use alloc::sync::Arc; 25 fn probe(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in probe() 26 fn remove(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in remove() 27 fn shutdown(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in shutdown() 28 fn suspend(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in suspend() 29 fn resume(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError>; in resume() 44 pub fn register(&self, driver: Arc<dyn PlatformDriver>) -> Result<(), SystemError> { in register() 45 driver.set_bus(Some(Arc::downgrade(&(platform_bus() as Arc<dyn Bus>)))); in register() 46 return driver_manager().register(driver as Arc<dyn Driver>); in register() 51 pub fn unregister(&self, driver: &Arc<dyn PlatformDriver>) { in unregister() [all …]
|
/DragonOS/kernel/src/driver/acpi/ |
H A D | bus.rs | 11 sync::Arc, 23 _driver: &Arc<dyn Driver>, in driver_match_device() 24 _device: &Arc<dyn Device>, in driver_match_device() 37 .register(acpi_bus as Arc<dyn Bus>) in bus_init() 52 pub fn new() -> Arc<Self> { in new() 53 let bus = Arc::new(Self { in new() 57 .set_bus(Some(Arc::downgrade(&(bus.clone() as Arc<dyn Bus>)))); in new() 72 fn remove(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> { in remove() 76 fn shutdown(&self, _device: &Arc<dyn Device>) { in shutdown() 80 fn resume(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> { in resume() [all …]
|
/DragonOS/kernel/src/driver/input/serio/i8042/ |
H A D | mod.rs | 1 use alloc::sync::Arc; 27 static mut I8042_PLATFORM_DEVICE: Option<Arc<I8042PlatformDevice>> = None; 29 pub fn i8042_platform_device() -> Arc<I8042PlatformDevice> { in i8042_platform_device() 37 let i8042_device = Arc::new(I8042PlatformDevice::new()); in i8042_init() 38 device_manager().device_default_initialize(&(i8042_device.clone() as Arc<dyn Device>)); in i8042_init() 39 platform_device_manager().device_add(i8042_device.clone() as Arc<dyn PlatformDevice>)?; in i8042_init() 45 platform_driver_manager().register(i8042_driver.clone() as Arc<dyn PlatformDriver>)?; in i8042_init() 51 pub fn i8042_start(_serio: &Arc<dyn SerioDevice>) -> Result<(), SystemError> { in i8042_start() 57 pub fn i8042_stop(_serio: &Arc<dyn SerioDevice>) -> Result<(), SystemError> { in i8042_stop() 66 let aux_port = Arc::new(I8042AuxPort::new()); in i8042_setup_aux() [all …]
|
H A D | i8042_driver.rs | 3 sync::{Arc, Weak}, 33 pub fn new() -> Arc<I8042Driver> { in new() 34 let r = Arc::new(Self { in new() 47 r.inner.lock().self_ref = Arc::downgrade(&r); in new() 56 kset: Option<Arc<KSet>>, 58 kernfs_inode: Option<Arc<KernFSInode>>, 59 devices: Vec<Arc<dyn Device>>, 67 fn probe(&self, device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError> { in probe() 81 fn remove(&self, _device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError> { in remove() 86 fn shutdown(&self, _device: &Arc<dyn PlatformDevice>) -> Result<(), SystemError> { in shutdown() [all …]
|
/DragonOS/kernel/src/namespaces/ |
H A D | mnt_namespace.rs | 10 use alloc::sync::Arc; 32 ns_common: Arc<NsCommon>, 34 user_ns: Arc<UserNamespace>, 36 ucounts: Arc<UCounts>, 38 root: Option<Arc<MountFS>>, 67 pub root: Arc<dyn IndexNode>, 68 pub pwd: Arc<dyn IndexNode>, 84 pub fn set_root(&mut self, inode: Arc<dyn IndexNode>) { in set_root() 87 pub fn set_pwd(&mut self, inode: Arc<dyn IndexNode>) { in set_pwd() 93 fn ns_common_to_ns(ns_common: Arc<NsCommon>) -> Arc<Self> { in ns_common_to_ns() [all …]
|
H A D | pid_namespace.rs | 18 use alloc::sync::Arc; 37 parent: Option<Arc<PidNamespace>>, 39 ucounts: Arc<UCounts>, 41 user_ns: Arc<UserNamespace>, 43 child_reaper: Arc<RwLock<Pid>>, 45 pub ns_common: Arc<NsCommon>, 58 pub stashed: Arc<dyn IndexNode>, 69 pub ns: Arc<PidNamespace>, 78 ns: Arc::new(PidNamespace::new()), in new() 89 pub fn alloc_pid(ns: Arc<PidNamespace>, set_tid: Vec<usize>) -> Result<PidStrcut, SystemError> { in alloc_pid() [all …]
|
H A D | mod.rs | 1 use alloc::sync::Arc; 24 pub fs: Arc<SpinLock<FsStruct>>, 28 pub pid_namespace: Arc<PidNamespace>, 29 pub mnt_namespace: Arc<MntNamespace>, 40 pid_namespace: Arc::new(PidNamespace::new()), in new() 41 mnt_namespace: Arc::new(MntNamespace::new()), in new() 44 pub fn set_pid_namespace(&mut self, new_pid_ns: Arc<PidNamespace>) { in set_pid_namespace() 48 pub fn set_mnt_namespace(&mut self, new_mnt_ns: Arc<MntNamespace>) { in set_mnt_namespace() 55 pcb: &Arc<ProcessControlBlock>, in create_new_namespaces() 56 user_ns: Arc<UserNamespace>, in create_new_namespaces() [all …]
|
/DragonOS/kernel/src/libs/ |
H A D | casting.rs | 21 use alloc::sync::Arc; 57 fn as_any_arc(self: Arc<Self>) -> Arc<dyn Any>; in as_any_arc() 64 fn downcast_arc<T: Any + Send + Sync>(self: Arc<Self>) -> Option<Arc<T>> { in downcast_arc() 65 let x: Arc<dyn Any> = self.as_any_arc(); in downcast_arc() 68 let p = Arc::into_raw(x); in downcast_arc() 69 let new = unsafe { Arc::from_raw(p as *const T) }; in downcast_arc()
|
/DragonOS/kernel/src/driver/base/device/ |
H A D | mod.rs | 4 sync::{Arc, Weak}, 63 pub static ref CHARDEVS: Arc<LockedDevsMap> = Arc::new(LockedDevsMap::default()); 66 pub static ref BLOCKDEVS: Arc<LockedDevsMap> = Arc::new(LockedDevsMap::default()); 69 pub static ref DEVMAP: Arc<LockedKObjMap> = Arc::new(LockedKObjMap::default()); 74 static mut DEVICES_KSET_INSTANCE: Option<Arc<KSet>> = None; 76 static mut DEV_KSET_INSTANCE: Option<Arc<KSet>> = None; 78 static mut DEV_BLOCK_KSET_INSTANCE: Option<Arc<KSet>> = None; 80 static mut DEV_CHAR_KSET_INSTANCE: Option<Arc<KSet>> = None; 83 static mut DEVICES_VIRTUAL_KSET_INSTANCE: Option<Arc<KSet>> = None; 87 pub fn sys_devices_kset() -> Arc<KSet> { in sys_devices_kset() [all …]
|
H A D | driver.rs | 14 sync::{Arc, Weak}, 57 fn coredump(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> { in coredump() 66 fn devices(&self) -> Vec<Arc<dyn Device>>; in devices() 69 fn add_device(&self, device: Arc<dyn Device>); in add_device() 72 fn delete_device(&self, device: &Arc<dyn Device>); in delete_device() 83 fn __find_device_by_name_fast(&self, _name: &str) -> Option<Arc<dyn Device>> { in __find_device_by_name_fast() 119 pub devices: Vec<Arc<dyn Device>>, 124 pub fn push_device(&mut self, device: Arc<dyn Device>) { in push_device() 125 if !self.devices.iter().any(|d| Arc::ptr_eq(d, &device)) { in push_device() 130 pub fn delete_device(&mut self, device: &Arc<dyn Device>) { in delete_device() [all …]
|
H A D | bus.rs | 23 sync::{Arc, Weak}, 32 static mut BUS_KSET_INSTANCE: Option<Arc<KSet>> = None; 34 static mut DEVICES_SYSTEM_KSET_INSTANCE: Option<Arc<KSet>> = None; 39 pub fn sys_bus_kset() -> Arc<KSet> { in sys_bus_kset() 45 pub fn sys_devices_system_kset() -> Arc<KSet> { in sys_devices_system_kset() 139 fn probe(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() 142 fn remove(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError>; in remove() 143 fn sync_state(&self, _device: &Arc<dyn Device>) {} in sync_state() 144 fn shutdown(&self, _device: &Arc<dyn Device>); in shutdown() 145 fn suspend(&self, _device: &Arc<dyn Device>) { in suspend() [all …]
|
/DragonOS/kernel/src/filesystem/vfs/ |
H A D | mount.rs | 10 sync::{Arc, Weak}, 40 inner_filesystem: Arc<dyn FileSystem>, 42 mountpoints: SpinLock<BTreeMap<InodeId, Arc<MountFS>>>, 44 self_mountpoint: Option<Arc<MountFSInode>>, 54 inner_inode: Arc<dyn IndexNode>, 56 mount_fs: Arc<MountFS>, 63 inner_filesystem: Arc<dyn FileSystem>, in new() 64 self_mountpoint: Option<Arc<MountFSInode>>, in new() 65 ) -> Arc<Self> { in new() 66 return Arc::new_cyclic(|self_ref| MountFS { in new() [all …]
|
/DragonOS/kernel/src/driver/open_firmware/ |
H A D | device_node.rs | 12 sync::{Arc, Weak}, 31 children: Vec<Arc<DeviceNode>>, 33 private_data: Option<Arc<dyn DeviceNodePrivateData>>, 41 ) -> Option<Arc<Self>> { in new() 58 return Some(Arc::new(x)); in new() 69 pub fn parent(&self) -> Option<Arc<DeviceNode>> { in parent() 73 pub fn set_parent(&self, parent: Arc<DeviceNode>) { in set_parent() 74 self.inner.lock().parent = Arc::downgrade(&parent); in set_parent() 77 pub fn children(&self) -> Vec<Arc<DeviceNode>> { in children() 81 pub fn add_child(&self, child: Arc<DeviceNode>) { in add_child() [all …]
|
/DragonOS/kernel/crates/intertrait/src/cast/ |
H A D | cast_arc.rs | 1 use alloc::sync::Arc; 34 fn cast<T: ?Sized + 'static>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>>; in cast() 39 fn cast<T: ?Sized + 'static>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>> { in cast()
|
/DragonOS/kernel/src/driver/net/ |
H A D | class.rs | 13 sync::{Arc, Weak}, 21 static mut CLASS_NET_INSTANCE: Option<Arc<NetClass>> = None; 26 pub fn sys_class_net_instance() -> Option<&'static Arc<NetClass>> { in sys_class_net_instance() 33 let net_class: Arc<NetClass> = NetClass::new(); in net_init() 34 class_manager().class_register(&(net_class.clone() as Arc<dyn Class>))?; in net_init() 51 pub fn new() -> Arc<Self> { in new() 52 let net_class = Arc::new(Self { in new() 57 .set_class(Some(Arc::downgrade(&net_class) as Weak<dyn Class>)); in new() 68 fn dev_kobj(&self) -> Option<Arc<dyn KObject>> { in dev_kobj() 69 Some(sys_dev_char_kset() as Arc<dyn KObject>) in dev_kobj() [all …]
|
/DragonOS/kernel/src/driver/base/ |
H A D | subsys.rs | 13 sync::{Arc, Weak}, 33 subsys: Arc<KSet>, 41 devices: RwLock<Vec<Arc<dyn Device>>>, 43 drivers: RwLock<Vec<Arc<dyn Driver>>>, 45 bus_notifier: AtomicNotifierChain<BusNotifyEvent, Arc<dyn Device>>, 51 devices_kset: Option<Arc<KSet>>, 53 drivers_kset: Option<Arc<KSet>>, 90 pub fn subsys(&self) -> Arc<KSet> { in subsys() 120 pub fn devices(&self) -> RwLockReadGuard<Vec<Arc<dyn Device>>> { in devices() 124 pub fn drivers(&self) -> RwLockReadGuard<Vec<Arc<dyn Driver>>> { in drivers() [all …]
|
/DragonOS/kernel/src/driver/virtio/ |
H A D | sysfs.rs | 3 sync::{Arc, Weak}, 38 static mut VIRTIO_BUS: Option<Arc<VirtIOBus>> = None; 41 pub fn virtio_bus() -> Arc<VirtIOBus> { in virtio_bus() 51 pub fn new() -> Arc<Self> { in new() 54 let bus = Arc::new(Self { private }); in new() 56 .set_bus(Some(Arc::downgrade(&(bus.clone() as Arc<dyn Bus>)))); in new() 80 fn probe(&self, device: &Arc<dyn Device>) -> Result<(), SystemError> { in probe() 101 fn remove(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> { in remove() 105 fn sync_state(&self, _device: &Arc<dyn Device>) { in sync_state() 109 fn shutdown(&self, _device: &Arc<dyn Device>) { in shutdown() [all …]
|
/DragonOS/kernel/src/driver/tty/ |
H A D | sysfs.rs | 3 sync::{Arc, Weak}, 19 static mut CLASS_TTY_INSTANCE: Option<Arc<TtyClass>> = None; 24 pub fn sys_class_tty_instance() -> Option<&'static Arc<TtyClass>> { in sys_class_tty_instance() 36 pub fn new() -> Arc<Self> { in new() 40 let r = Arc::new(r); in new() 42 .set_class(Some(Arc::downgrade(&r) as Weak<dyn Class>)); in new() 53 fn dev_kobj(&self) -> Option<Arc<dyn KObject>> { in dev_kobj() 54 Some(sys_dev_char_kset() as Arc<dyn KObject>) in dev_kobj() 57 fn set_dev_kobj(&self, _kobj: Arc<dyn KObject>) { in set_dev_kobj() 70 class_manager().class_register(&(tty_class.clone() as Arc<dyn Class>))?; in tty_sysfs_init()
|
/DragonOS/kernel/src/driver/tty/tty_ldisc/ |
H A D | mod.rs | 3 use alloc::sync::Arc; 16 fn open(&self, tty: Arc<TtyCore>) -> Result<(), SystemError>; in open() 17 fn close(&self, tty: Arc<TtyCore>) -> Result<(), SystemError>; in close() 18 fn flush_buffer(&self, tty: Arc<TtyCore>) -> Result<(), SystemError>; in flush_buffer() 30 tty: Arc<TtyCore>, in read() 39 tty: Arc<TtyCore>, in write() 44 fn ioctl(&self, tty: Arc<TtyCore>, cmd: u32, arg: usize) -> Result<usize, SystemError>; in ioctl() 49 fn set_termios(&self, tty: Arc<TtyCore>, old: Option<Termios>) -> Result<(), SystemError>; in set_termios() 51 fn poll(&self, tty: Arc<TtyCore>) -> Result<usize, SystemError>; in poll() 52 fn hangup(&self, tty: Arc<TtyCore>) -> Result<(), SystemError>; in hangup() [all …]
|