diff options
author | Damien Zammit <damien@zamaudio.com> | 2020-07-25 11:18:44 +1000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-07-25 13:09:31 +0200 |
commit | 67c9d475e7204296ca9bcfbd08a896df1a87e74a (patch) | |
tree | 2a1d624c891740becfb2b95dd547dba4aa779036 /libmachdev/ds_routines.c | |
parent | 1bb4fdc3a2c725276d457d2fa7cd1962d3e232d6 (diff) | |
download | hurd-67c9d475e7204296ca9bcfbd08a896df1a87e74a.tar.gz hurd-67c9d475e7204296ca9bcfbd08a896df1a87e74a.tar.bz2 hurd-67c9d475e7204296ca9bcfbd08a896df1a87e74a.zip |
libmachdev: Add resume for bootstrap server
machdev users can now pass along a port to the next translator in the
bootstrap chain (bootstrap_resume_task), that they'll get from their
command line set by the bootloader. machdev will then call task_resume
on it as appropriate. It will also have the opportunity to get
fsys_getpriv calls, and thus redirect the device master port, thus
having the opportunity to expose its devices on the device master port,
as if they were handled by the kernel.
Message-Id: <20200725011847.186969-1-damien@zamaudio.com>
Diffstat (limited to 'libmachdev/ds_routines.c')
-rw-r--r-- | libmachdev/ds_routines.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c index da5e47e2..53e0c080 100644 --- a/libmachdev/ds_routines.c +++ b/libmachdev/ds_routines.c @@ -65,6 +65,7 @@ #include <hurd.h> #include <mach.h> +#include <device/device.h> /* fallback to kernel device */ #include "device_S.h" #include "notify_S.h" @@ -94,7 +95,8 @@ ds_device_open (mach_port_t open_port, mach_port_t reply_port, char *name, device_t *devp, mach_msg_type_name_t *devicePoly) { int i; - io_return_t err; + mach_port_t dev_master; + io_return_t err = D_NO_SUCH_DEVICE; /* Open must be called on the master device port. */ if (!machdev_is_master_device (open_port)) @@ -108,11 +110,18 @@ ds_device_open (mach_port_t open_port, mach_port_t reply_port, for (i = 0; i < num_emul; i++) { err = (*emulation_list[i]->open) (reply_port, reply_port_type, - mode, name, devp, devicePoly); + mode, name, devp, devicePoly); if (err != D_NO_SUCH_DEVICE) - break; + break; } + /* Fall back to opening kernel device master */ + if (err) + { + get_privileged_ports(NULL, &dev_master); + err = device_open (dev_master, mode, name, devp); + *devicePoly = MACH_MSG_TYPE_MOVE_SEND; + } return err; } |