From 740d2f29700af38b01ca68e3e834db164cc1b789 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 9 Jan 2022 01:09:04 +0100 Subject: hurd: Restore initialization order 3e0d1cde0187 ("hurd: Implement device memory mapping") was making root-running processes insist on using the pci device, and never try the fs-provided translator. This reverts back to trying the pci device first, but completely, and then revert to the fs-provided translator. --- src/hurd_pci.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/hurd_pci.c b/src/hurd_pci.c index ce96cbe..70a9f89 100644 --- a/src/hurd_pci.c +++ b/src/hurd_pci.c @@ -637,18 +637,20 @@ pci_system_hurd_create(void) pci_sys->num_devices = 0; - if ((err = get_privileged_ports (NULL, &device_master)) - || (device_master == MACH_PORT_NULL)) { - root = file_name_lookup (_SERVERS_BUS_PCI, O_RDONLY, 0); - } else { - err = device_open (device_master, D_READ, "pci", &pci_port); - mach_port_deallocate (mach_task_self (), device_master); - if (!err) { - root = file_name_lookup_under (pci_port, ".", - O_DIRECTORY | O_RDONLY | O_EXEC, 0); - device_close (pci_port); - mach_port_deallocate (mach_task_self (), pci_port); - } + if ((err = get_privileged_ports (NULL, &device_master)) || (device_master == MACH_PORT_NULL)) { + pci_system_cleanup(); + return err; + } + + err = device_open (device_master, D_READ|D_WRITE, "pci", &pci_port); + if (!err) { + root = file_name_lookup_under (pci_port, ".", O_DIRECTORY | O_RDWR | O_EXEC, 0); + device_close (pci_port); + mach_port_deallocate (mach_task_self (), pci_port); + } + + if (!root) { + root = file_name_lookup (_SERVERS_BUS_PCI, O_RDWR, 0); } if (!root) { -- cgit v1.2.3