From b261eb886e4ee068515484727955e416517a03b4 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Tue, 9 Mar 2021 00:04:56 +1100 Subject: pci-arbiter: Introduce machdev into this server * pci-arbiter/Makefile Add machdev lib and simplify * pci-arbiter/main.c (pci_device_{open,close,shutdown}): New methods (netfs_server_func): Thread the demuxer loop (pcifs_startup): Custom startup method (main): Use machdev for server and detach worker threads * pci-arbiter/options.{c,h} Add disk-server-task and priv ports * pci-arbiter/startup-ops.c Delete file Message-Id: <20210308130457.693821-4-damien@zamaudio.com> --- pci-arbiter/pcifs.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'pci-arbiter/pcifs.c') diff --git a/pci-arbiter/pcifs.c b/pci-arbiter/pcifs.c index e09bdd13..699d5942 100644 --- a/pci-arbiter/pcifs.c +++ b/pci-arbiter/pcifs.c @@ -92,20 +92,11 @@ alloc_file_system (struct pcifs ** fs) } error_t -init_file_system (file_t underlying_node, struct pcifs * fs) +init_root_node (void) { - error_t err; struct node *np; io_statbuf_t *underlying_node_stat = &underlying_stat; - if (underlying_node) - { - /* 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; @@ -120,19 +111,29 @@ init_file_system (file_t underlying_node, struct pcifs * fs) fshelp_touch (&np->nn_stat, TOUCH_ATIME | TOUCH_MTIME | TOUCH_CTIME, pcifs_maptime); + netfs_root_node = np; + return 0; +} + +error_t +init_file_system (struct pcifs * fs) +{ + error_t err; + struct node *np = netfs_root_node; + fs->entries = calloc (1, sizeof (struct pcifs_dirent)); if (!fs->entries) - { - return ENOMEM; - } + return ENOMEM; /* Create the root entry */ err = create_dir_entry (-1, -1, -1, -1, -1, "", 0, np->nn_stat, np, 0, fs->entries); + if (err) + return err; fs->num_entries = 1; - fs->root = netfs_root_node = np; + fs->root = np; fs->root->nn->ln = fs->entries; pthread_mutex_init (&fs->node_cache_lock, 0); pthread_mutex_init (&fs->pci_conf_lock, 0); -- cgit v1.2.3