summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2021-03-07 11:15:07 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-03-07 11:15:07 +0100
commit06ffcd932adfddf0e0dbd11c7a36e841ddfc9fa3 (patch)
tree1618d63c72c61736e146ade67eb6bbddc7ad1449
parent3463fcd26a392eb414794be409a3a640d071af77 (diff)
pci-arbiter: Accept not having an underlying node.
* pci-arbiter/pcifs.c (underlying_stat): New variable. (init_file_system): When underlying_node is nul, use the underlying_stat content.
-rw-r--r--pci-arbiter/pcifs.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/pci-arbiter/pcifs.c b/pci-arbiter/pcifs.c
index 0535779e..e09bdd13 100644
--- a/pci-arbiter/pcifs.c
+++ b/pci-arbiter/pcifs.c
@@ -31,6 +31,9 @@
#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,
@@ -93,17 +96,20 @@ init_file_system (file_t underlying_node, struct pcifs * fs)
{
error_t err;
struct node *np;
- io_statbuf_t underlying_node_stat;
+ io_statbuf_t *underlying_node_stat = &underlying_stat;
- /* Initialize status from underlying node. */
- err = io_stat (underlying_node, &underlying_node_stat);
- if (err)
- return err;
+ 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;
- 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 |