From a6fee75f15ba75b78ce9e94bc5d8754b704c6796 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Sun, 29 Oct 2023 23:12:50 +0100 Subject: [PATCH] Phase out / in scheme names. --- acpid/src/main.rs | 8 ++++---- ahcid/src/main.rs | 2 +- ided/src/main.rs | 2 +- inputd/src/main.rs | 2 +- lived/src/main.rs | 4 ++-- nvmed/src/main.rs | 6 ++---- usbhidd/src/main.rs | 2 +- usbscsid/src/main.rs | 2 +- vesad/src/main.rs | 2 +- virtio-blkd/src/main.rs | 2 +- virtio-gpud/src/main.rs | 2 +- virtio-gpud/src/scheme.rs | 2 +- xhcid/src/main.rs | 2 +- 13 files changed, 18 insertions(+), 20 deletions(-) diff --git a/acpid/src/main.rs b/acpid/src/main.rs index 47a4cd5cbd..e4c8711045 100644 --- a/acpid/src/main.rs +++ b/acpid/src/main.rs @@ -81,8 +81,8 @@ fn setup_logging() -> Option<&'static RedoxLogger> { fn daemon(daemon: redox_daemon::Daemon) -> ! { setup_logging(); - let rxsdt_raw_data: Arc<[u8]> = std::fs::read("kernel/acpi:rxsdt") - .expect("acpid: failed to read `kernel/acpi:rxsdt`") + let rxsdt_raw_data: Arc<[u8]> = std::fs::read("kernel.acpi:rxsdt") + .expect("acpid: failed to read `kernel.acpi:rxsdt`") .into(); let sdt = self::acpi::Sdt::new(rxsdt_raw_data) @@ -116,8 +116,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { // TODO: I/O permission bitmap unsafe { syscall::iopl(3) }.expect("acpid: failed to set I/O privilege level to Ring 3"); - let shutdown_pipe = File::open("kernel/acpi:kstop") - .expect("acpid: failed to open `kernel/acpi:kstop`"); + let shutdown_pipe = File::open("kernel.acpi:kstop") + .expect("acpid: failed to open `kernel.acpi:kstop`"); let mut event_queue = OpenOptions::new() .write(true) diff --git a/ahcid/src/main.rs b/ahcid/src/main.rs index 584f6e1ec2..1e5d44b4bf 100644 --- a/ahcid/src/main.rs +++ b/ahcid/src/main.rs @@ -98,7 +98,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { ).expect("ahcid: failed to map address") }; { - let scheme_name = format!("disk/{}", name); + let scheme_name = format!("disk.{}", name); let socket_fd = syscall::open( &format!(":{}", scheme_name), syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK diff --git a/ided/src/main.rs b/ided/src/main.rs index 4556084d02..f8e42c5deb 100644 --- a/ided/src/main.rs +++ b/ided/src/main.rs @@ -233,7 +233,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { } } - let scheme_name = format!("disk/{}", name); + let scheme_name = format!("disk.{}", name); let socket_fd = syscall::open( &format!(":{}", scheme_name), syscall::O_RDWR | syscall::O_CREAT | syscall::O_NONBLOCK diff --git a/inputd/src/main.rs b/inputd/src/main.rs index 02e2cd2b36..2a359f9b75 100644 --- a/inputd/src/main.rs +++ b/inputd/src/main.rs @@ -134,7 +134,7 @@ impl SchemeMut for InputScheme { } } "handle" => { - let display = path_parts.collect::>().join("/"); + let display = path_parts.collect::>().join("."); Handle::Device { device: display } } diff --git a/lived/src/main.rs b/lived/src/main.rs index a133404c0e..411d44db3f 100644 --- a/lived/src/main.rs +++ b/lived/src/main.rs @@ -173,7 +173,7 @@ impl SchemeMut for DiskScheme { HandleType::TheData => "0", }; - let src = format!("disk/live:{}", path).into_bytes(); + let src = format!("disk.live:{}", path).into_bytes(); let byte_count = std::cmp::min(buf.len(), src.len()); buf[..byte_count].copy_from_slice(&src[..byte_count]); @@ -201,7 +201,7 @@ impl SchemeMut for DiskScheme { } fn main() -> anyhow::Result<()> { redox_daemon::Daemon::new(move |daemon| { - let mut socket = File::create(":disk/live").expect("failed to open scheme"); + let mut socket = File::create(":disk.live").expect("failed to open scheme"); let mut scheme = DiskScheme::new().unwrap_or_else(|err| { eprintln!("failed to initialize livedisk scheme: {}", err); std::process::exit(1) diff --git a/nvmed/src/main.rs b/nvmed/src/main.rs index 65da7182c1..9074dcc4d7 100644 --- a/nvmed/src/main.rs +++ b/nvmed/src/main.rs @@ -299,10 +299,9 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { .fetch_config() .expect("nvmed: failed to fetch config"); - let mut name = pci_config.func.name(); - name.push_str("_nvme"); + let mut scheme_name = format!("disk.pci-{:x}+{:x}+{:x}-nvme", pci_config.func.bus_num, pci_config.func.dev_num, pci_config.func.func_num); - let _logger_ref = setup_logging(&name); + let _logger_ref = setup_logging(&scheme_name); let bar = match pci_config.func.bars[0] { PciBar::Memory32(mem) => match mem { @@ -337,7 +336,6 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { ptr: NonNull::new(address as *mut u8).expect("Physmapping BAR gave nullptr"), }); - let scheme_name = format!("disk/{}", name); let socket_fd = syscall::open( &format!(":{}", scheme_name), syscall::O_RDWR | syscall::O_CREAT | syscall::O_CLOEXEC, diff --git a/usbhidd/src/main.rs b/usbhidd/src/main.rs index bfefd2f798..8e11c70aed 100644 --- a/usbhidd/src/main.rs +++ b/usbhidd/src/main.rs @@ -382,7 +382,7 @@ fn main() { let report_ty = ReportTy::Input; let report_id = 0; - let mut display = File::open("display/vesa:input").expect("Failed to open orbital input socket"); + let mut display = File::open("display.vesa:input").expect("Failed to open orbital input socket"); //TODO: get dynamically let mut display_width = 0; diff --git a/usbscsid/src/main.rs b/usbscsid/src/main.rs index 05d37942f0..6f698e8c19 100644 --- a/usbscsid/src/main.rs +++ b/usbscsid/src/main.rs @@ -39,7 +39,7 @@ fn main() { redox_daemon::Daemon::new(move |d| daemon(d, scheme, port, protocol)).expect("usbscsid: failed to daemonize"); } fn daemon(daemon: redox_daemon::Daemon, scheme: String, port: usize, protocol: u8) -> ! { - let disk_scheme_name = format!(":disk/{}-{}_scsi", scheme, port); + let disk_scheme_name = format!(":disk.usb-{scheme}+{port}-scsi"); // TODO: Use eventfds. let handle = XhciClientHandle::new(scheme.to_owned(), port); diff --git a/vesad/src/main.rs b/vesad/src/main.rs index 08046147ca..47bd535022 100644 --- a/vesad/src/main.rs +++ b/vesad/src/main.rs @@ -90,7 +90,7 @@ fn main() { redox_daemon::Daemon::new(|daemon| inner(daemon, framebuffers, &spec)).expect("failed to create daemon"); } fn inner(daemon: redox_daemon::Daemon, framebuffers: Vec, spec: &[bool]) -> ! { - let mut socket = File::create(":display/vesa").expect("vesad: failed to create display scheme"); + let mut socket = File::create(":display.vesa").expect("vesad: failed to create display scheme"); let mut scheme = DisplayScheme::new(framebuffers, &spec); diff --git a/virtio-blkd/src/main.rs b/virtio-blkd/src/main.rs index 2083530c70..e280f62b6a 100644 --- a/virtio-blkd/src/main.rs +++ b/virtio-blkd/src/main.rs @@ -140,7 +140,7 @@ fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> { let mut name = pci_config.func.name(); name.push_str("_virtio_blk"); - let scheme_name = format!("disk/{}", name); + let scheme_name = format!("disk.{}", name); let socket_fd = syscall::open( &format!(":{}", scheme_name), diff --git a/virtio-gpud/src/main.rs b/virtio-gpud/src/main.rs index f181b38ff2..4d16d87a97 100644 --- a/virtio-gpud/src/main.rs +++ b/virtio-gpud/src/main.rs @@ -438,7 +438,7 @@ fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> { device.transport.run_device(); deamon.ready().unwrap(); - let mut socket_file = File::create(":display/virtio-gpu")?; + let mut socket_file = File::create(":display.virtio-gpu")?; let mut scheme = futures::executor::block_on(scheme::Scheme::new( config, control_queue.clone(), diff --git a/virtio-gpud/src/scheme.rs b/virtio-gpud/src/scheme.rs index e4f294dad4..30dded638f 100644 --- a/virtio-gpud/src/scheme.rs +++ b/virtio-gpud/src/scheme.rs @@ -86,7 +86,7 @@ impl<'a> Display<'a> { } async fn get_fpath(&self, buffer: &mut [u8]) -> Result { - let path = format!("display/virtio-gpu:3.0/{}/{}", self.width, self.height); + let path = format!("display.virtio-gpu:3.0/{}/{}", self.width, self.height); // Copy the path into the target buffer. buffer[..path.len()].copy_from_slice(path.as_bytes()); diff --git a/xhcid/src/main.rs b/xhcid/src/main.rs index decacdd666..8f33ddce1a 100644 --- a/xhcid/src/main.rs +++ b/xhcid/src/main.rs @@ -275,7 +275,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! { format!(" + XHCI {} on: {} IRQ: {}\n", name, bar, irq) ); - let scheme_name = format!("usb/{}", name); + let scheme_name = format!("usb.{}", name); let socket_fd = syscall::open( format!(":{}", scheme_name), syscall::O_RDWR | syscall::O_CREAT,