Skip to content

[WasmFS] Skip mounting special files under NODERAWFS#26607

Open
kleisauke wants to merge 3 commits intoemscripten-core:mainfrom
kleisauke:wasmfs-skip-special-files-mount-noderawfs
Open

[WasmFS] Skip mounting special files under NODERAWFS#26607
kleisauke wants to merge 3 commits intoemscripten-core:mainfrom
kleisauke:wasmfs-skip-special-files-mount-noderawfs

Conversation

@kleisauke
Copy link
Copy Markdown
Collaborator

Resolves: #24836.

Split out from #24733.

This is an automatic change generated by tools/maint/rebaseline_tests.py.

The following (2) test expectation files were updated by
running the tests with `--rebaseline`:

```
codesize/test_codesize_cxx_wasmfs.json: 179737 => 179764 [+27 bytes / +0.02%]
codesize/test_codesize_files_wasmfs.json: 63883 => 63908 [+25 bytes / +0.04%]

Average change: +0.03% (+0.02% - +0.04%)
```
virtual std::shared_ptr<Directory> createDirectory(mode_t mode) = 0;
virtual std::shared_ptr<Symlink> createSymlink(std::string target) = 0;

virtual bool shouldMountSpecialFiles() { return true; }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking maybe shouldPopulateRoot, but maybe your name is more explicit?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name was mentioned in comment #24733 (comment). But I'd like shouldPopulateRoot as well.

self.set_setting('WASMFS')
self.do_run_in_out_file_test('wasmfs/wasmfs_chown.c')

@wasmfs_all_backends
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Does wasmfs_getdents.c need to get re-written to handle the rawfs mabye?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just skip under NODERAWFS rather than removing wasmfs_all_backends completely?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-added the @wasmfs_all_backends decorator and skipped this only under NODERAWFS with commit f3b85c9.

See for details:

------------- Reading from /dev Directory via JS -------------
.
..
null
random
stderr
stdin
stdout
urandom

@kleisauke
Copy link
Copy Markdown
Collaborator Author

Perhaps this setup logic belongs in the MEMFS backend (and possibly others) instead? In other words, when FS.mount(MEMFS, {}, '/memory'); is called on a NODERAWFS root backend, should it produce the following layout?:

$ tree / -L 3 --dirsfirst
/ (NODERAWFS)
└── memory (MEMFS)
    ├── dev
    │   ├── null -> SpecialFiles::getNull()
    │   ├── random -> SpecialFiles::getRandom()
    │   ├── stderr -> SpecialFiles::getStderr()
    │   ├── stdin -> SpecialFiles::getStdin()
    │   ├── stdout -> SpecialFiles::getStdout()
    │   └── urandom -> SpecialFiles::getURandom()
    └── tmp

This would avoid the need of the shouldMountSpecialFiles overridable hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WasmFS: -sNODERAWFS creates redundant dev and tmp dirs within the CWD

2 participants