diff options
-rw-r--r-- | pci-arbiter/main.c | 11 | ||||
-rw-r--r-- | pci-arbiter/pcifs.c | 18 | ||||
-rw-r--r-- | pci-arbiter/pcifs.h | 2 |
3 files changed, 21 insertions, 10 deletions
diff --git a/pci-arbiter/main.c b/pci-arbiter/main.c index 050f1aac..4f4f13da 100644 --- a/pci-arbiter/main.c +++ b/pci-arbiter/main.c @@ -205,6 +205,7 @@ main (int argc, char **argv) mach_port_t bootstrap; mach_port_t disk_server_task; pthread_t t, nt; + file_t underlying_node = MACH_PORT_NULL; /* Parse options */ alloc_file_system (&fs); @@ -245,12 +246,16 @@ main (int argc, char **argv) machdev_trivfs_server(bootstrap); /* Timer started, quickly do all these next, before we call rump_init */ + if (disk_server_task == MACH_PORT_NULL) + underlying_node = netfs_startup (bootstrap, O_READ); + /* Create the root node first */ - err = init_root_node (); + err = init_root_node (underlying_node); if (err) error (1, err, "Creating the root node"); - - pcifs_startup (bootstrap, O_READ); + + if (disk_server_task != MACH_PORT_NULL) + pcifs_startup (bootstrap, O_READ); err = init_file_system (fs); if (err) diff --git a/pci-arbiter/pcifs.c b/pci-arbiter/pcifs.c index 699d5942..3b13e437 100644 --- a/pci-arbiter/pcifs.c +++ b/pci-arbiter/pcifs.c @@ -31,9 +31,6 @@ #include "ncache.h" #include "func_files.h" -/* Empty status for root node when bootstrapping */ -static io_statbuf_t underlying_stat; - static error_t create_dir_entry (int32_t domain, int16_t bus, int16_t dev, int16_t func, int32_t device_class, char *name, @@ -92,15 +89,24 @@ alloc_file_system (struct pcifs ** fs) } error_t -init_root_node (void) +init_root_node (file_t underlying_node) { + error_t err; struct node *np; - io_statbuf_t *underlying_node_stat = &underlying_stat; + io_statbuf_t underlying_node_stat = { 0 }; + + if (underlying_node != MACH_PORT_NULL) + { + /* Initialize status from underlying node. */ + err = io_stat (underlying_node, &underlying_node_stat); + if (err) + return err; + } np = netfs_make_node_alloc (sizeof (struct netnode)); if (!np) return ENOMEM; - np->nn_stat = *underlying_node_stat; + np->nn_stat = underlying_node_stat; np->nn_stat.st_fsid = getpid (); np->nn_stat.st_mode = S_IFDIR | S_IROOT | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | diff --git a/pci-arbiter/pcifs.h b/pci-arbiter/pcifs.h index 33a2b8c1..ba16ebaa 100644 --- a/pci-arbiter/pcifs.h +++ b/pci-arbiter/pcifs.h @@ -205,7 +205,7 @@ extern volatile struct mapped_time_value *pcifs_maptime; /* FS manipulation functions */ error_t alloc_file_system (struct pcifs **fs); -error_t init_root_node (void); +error_t init_root_node (file_t underlying_node); error_t init_file_system (struct pcifs *fs); error_t create_fs_tree (struct pcifs *fs); error_t fs_set_permissions (struct pcifs *fs); |