Damien Zammit
unread,Jul 28, 2020, 6:09:20 AM7/28/20You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to bug-...@gnu.org, Damien Zammit
NB: Not sure why this seems to have no effect on /dev/rumpdisk
Am I setting the translator on the wrong port?
---
rumpdisk/main.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/rumpdisk/main.c b/rumpdisk/main.c
index 27a8ea38..68fb8be2 100644
--- a/rumpdisk/main.c
+++ b/rumpdisk/main.c
@@ -31,6 +31,8 @@
#include <pthread.h>
#include <mach.h>
+#define DEV_RUMPDISK "/dev/rumpdisk"
+
/* TODO: Add api to pciaccess to allow selecting backend.
* For now we pretend to be the arbiter and claim x86 method.
*/
@@ -97,6 +99,28 @@ static struct argp_child empty_argp_children[] = {{0}};
static struct argp rumpdisk_argp = {options, parse_opt, 0, 0, empty_argp_children};
static const struct argp *rumpdisk_argp_bootup = &rumpdisk_argp;
+static void
+install_as_translator (mach_port_t rumpdisk_port)
+{
+ error_t err;
+ file_t node;
+
+ node = file_name_lookup (DEV_RUMPDISK, O_NOTRANS, 0);
+ if (! MACH_PORT_VALID (node))
+ {
+ if (errno == ENOENT)
+ mach_print("Missing DEV_RUMPDISK\n");
+ return;
+ }
+
+ err = file_set_translator (node,
+ 0, FS_TRANS_SET, 0,
+ NULL, 0,
+ rumpdisk_port, MACH_MSG_TYPE_COPY_SEND);
+ mach_port_deallocate (mach_task_self (), node);
+ assert_perror_backtrace (err);
+}
+
int
main (int argc, char **argv)
{
@@ -119,10 +143,15 @@ main (int argc, char **argv)
rump_register_block ();
machdev_device_init ();
machdev_trivfs_init (bootstrap_resume_task, "fs", &bootstrap);
+
err = pthread_create (&t, NULL, machdev_server, NULL);
if (err)
return err;
pthread_detach (t);
+
+ if (bootstrap != MACH_PORT_NULL)
+ install_as_translator (bootstrap);
+
machdev_trivfs_server (bootstrap);
return 0;
}
--
2.25.1