diff options
author | Damien Zammit <damien@zamaudio.com> | 2022-09-20 03:01:18 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-09-20 23:39:29 +0200 |
commit | 9c7a1bc253ba4a264e8e3d6ae7983f2fc645f2b3 (patch) | |
tree | 07892fe8350ec6defec702790b158ee8bbc038fa /acpi/acpifs.c | |
parent | 432ecc4bed0ef5341d8dc7637d7631fe05ffd717 (diff) | |
download | hurd-9c7a1bc253ba4a264e8e3d6ae7983f2fc645f2b3.tar.gz hurd-9c7a1bc253ba4a264e8e3d6ae7983f2fc645f2b3.tar.bz2 hurd-9c7a1bc253ba4a264e8e3d6ae7983f2fc645f2b3.zip |
acpi: Convert translator to an emulated mach device
This makes acpi usable as a bootstrap translator.
Message-Id: <20220920030035.931113-1-damien@zamaudio.com>
Diffstat (limited to 'acpi/acpifs.c')
-rw-r--r-- | acpi/acpifs.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/acpi/acpifs.c b/acpi/acpifs.c index 2b5fbc00..1b9fbcf2 100644 --- a/acpi/acpifs.c +++ b/acpi/acpifs.c @@ -81,16 +81,19 @@ alloc_file_system (struct acpifs **fs) } error_t -init_file_system (file_t underlying_node, struct acpifs *fs) +init_root_node (file_t underlying_node) { error_t err; struct node *np; - io_statbuf_t underlying_node_stat; + io_statbuf_t underlying_node_stat = { 0 }; - /* Initialize status from underlying node. */ - err = io_stat (underlying_node, &underlying_node_stat); - if (err) - return err; + 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) @@ -106,18 +109,30 @@ init_file_system (file_t underlying_node, struct acpifs *fs) fshelp_touch (&np->nn_stat, TOUCH_ATIME | TOUCH_MTIME | TOUCH_CTIME, acpifs_maptime); + netfs_root_node = np; + return 0; +} + +error_t +init_file_system (struct acpifs *fs) +{ + error_t err; + struct node *np = netfs_root_node; + fs->entries = calloc (1, sizeof (struct acpifs_dirent)); if (!fs->entries) - { - free (fs->entries); - return ENOMEM; - } + return ENOMEM; /* Create the root entry */ err = create_dir_entry ("", 0, 0, np->nn_stat, np, fs->entries); + if (err) + { + free(fs->entries); + 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); |