Skip to content

[wasmfs] Expose wasmfs headers file for out-of-tree filesystems #24744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions system/lib/wasmfs/backends/fetch_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

// This file defines the fetch backend.

#include "fetch_backend.h"
#include "backend.h"
#include "fetch_backend.h"
#include <emscripten/wasmfs_internal/backend.h>
#include "proxied_async_js_impl_backend.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace wasmfs {

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/backends/fetch_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.

#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

extern "C" {
// See library_wasmfs_fetch.js
Expand Down
6 changes: 3 additions & 3 deletions system/lib/wasmfs/backends/ignore_case_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// See the comment in virtual.h for an explanation of why DataFiles and Symlinks
// must have no-op wrappers.

#include "backend.h"
#include "file.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/file.h>
#include "virtual.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace {

Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/backends/js_file_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// This file defines the JS file backend.

#include "js_file_backend.h"
#include "backend.h"
#include <emscripten/wasmfs_internal/backend.h>
#include "js_impl_backend.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace wasmfs {

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/backends/js_file_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.

#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

extern "C" {

Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/backends/memory_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// This file defines the memory file backend.

#include "memory_backend.h"
#include "backend.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace wasmfs {

Expand Down
8 changes: 4 additions & 4 deletions system/lib/wasmfs/backends/node_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

#include <memory>

#include "backend.h"
#include "file.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/file.h>
#include "node_backend.h"
#include "support.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/support.h>
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace wasmfs {

Expand Down
8 changes: 4 additions & 4 deletions system/lib/wasmfs/backends/opfs_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#include <emscripten/threading.h>
#include <stdlib.h>

#include "backend.h"
#include "file.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/file.h>
#include "opfs_backend.h"
#include "support.h"
#include <emscripten/wasmfs_internal/support.h>
#include "thread_utils.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

using namespace wasmfs;

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/backends/opfs_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <emscripten/proxying.h>

#include "backend.h"
#include <emscripten/wasmfs_internal/backend.h>

using namespace wasmfs;

Expand Down
6 changes: 3 additions & 3 deletions system/lib/wasmfs/emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#include <string>

#include "file.h"
#include "file_table.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/file.h>
#include <emscripten/wasmfs_internal/file_table.h>
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace wasmfs {

Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

// This file defines the file object.

#include "file.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/file.h>
#include <emscripten/wasmfs_internal/wasmfs.h>
#include "wasmfs_internal.h"
#include <emscripten/threading.h>

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/file_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// This file defines the open file table.

#include "file_table.h"
#include <emscripten/wasmfs_internal/file_table.h>
#include "special_files.h"

namespace wasmfs {
Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/js_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <unistd.h>
#include <emscripten/wasmfs.h>

#include "backend.h"
#include "file.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/file.h>
#include "paths.h"

// Some APIs return data using a thread-local allocation that is never freed.
Expand Down
6 changes: 3 additions & 3 deletions system/lib/wasmfs/js_impl_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#pragma once

#include "backend.h"
#include <emscripten/wasmfs_internal/backend.h>
#include "memory_backend.h"
#include "support.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/support.h>
#include <emscripten/wasmfs_internal/wasmfs.h>

//
// A JS Impl backend has files that are implemented by JS code. Each backend
Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/memory_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#pragma once

#include "backend.h"
#include "file.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/file.h>
#include <emscripten/threading.h>

namespace wasmfs {
Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

#include <string_view>

#include "file.h"
#include <emscripten/wasmfs_internal/file.h>
#include "paths.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

namespace wasmfs::path {

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string_view>
#include <variant>

#include "file.h"
#include <emscripten/wasmfs_internal/file.h>

namespace wasmfs::path {

Expand Down
4 changes: 2 additions & 2 deletions system/lib/wasmfs/pipe_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <queue>

#include "file.h"
#include "support.h"
#include <emscripten/wasmfs_internal/file.h>
#include <emscripten/wasmfs_internal/support.h>

namespace wasmfs {

Expand Down
6 changes: 3 additions & 3 deletions system/lib/wasmfs/proxied_async_js_impl_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

#pragma once

#include "backend.h"
#include <emscripten/wasmfs_internal/backend.h>
#include "memory_backend.h"
#include "support.h"
#include <emscripten/wasmfs_internal/support.h>
#include "thread_utils.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

//
// Similar to JSImplBackend, but proxies to another thread where the JS can be
Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/special_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#pragma once

#include "file.h"
#include <emscripten/wasmfs_internal/file.h>

namespace wasmfs::SpecialFiles {

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <iostream>
#endif

#include "support.h"
#include <emscripten/wasmfs_internal/support.h>

namespace wasmfs {

Expand Down
8 changes: 4 additions & 4 deletions system/lib/wasmfs/syscalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
#include <vector>
#include <wasi/api.h>

#include "backend.h"
#include "file.h"
#include "file_table.h"
#include <emscripten/wasmfs_internal/backend.h>
#include <emscripten/wasmfs_internal/file.h>
#include <emscripten/wasmfs_internal/file_table.h>
#include "paths.h"
#include "pipe_backend.h"
#include "special_files.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>

// File permission macros for wasmfs.
// Used to improve readability compared to those in stat.h
Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/virtual.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#pragma once

#include "file.h"
#include <emscripten/wasmfs_internal/file.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would hope we could keep wasmfs_internal headers in the system/lib/wasmfs directory and then have them installed via the install_system_headers help in tools/system_libs.py. No need to relocate them in git to system/include I would hope.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I will check, if this PR is necessary at all.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, change it as suggested,


namespace wasmfs {

Expand Down
2 changes: 1 addition & 1 deletion system/lib/wasmfs/wasmfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "memory_backend.h"
#include "paths.h"
#include "special_files.h"
#include "wasmfs.h"
#include <emscripten/wasmfs_internal/wasmfs.h>
#include "wasmfs_internal.h"

namespace wasmfs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// found in the LICENSE file.

// This file defines the modular backend abstract class.
// The declarations from this files should only be used by file system implementers

#pragma once

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// found in the LICENSE file.

// This file defines the file object.
// The declarations from this files should only be used by file system implementers

#pragma once

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// found in the LICENSE file.

// This file defines the open file table.
// The declarations from this files should only be used by file system implementers

#pragma once

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// found in the LICENSE file.

// This file defines the global state.
// The declarations from this files should only be used by file system implementers

#pragma once

Expand Down
1 change: 1 addition & 0 deletions tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2499,6 +2499,7 @@ def safe_copytree(src, dst):
def install_system_headers(stamp):
install_dirs = {
('include',): '',
('lib','wasmfs', 'wasmfs_internal'): 'emscripten/wasmfs_internal',
('lib', 'compiler-rt', 'include'): '',
('lib', 'libunwind', 'include'): '',
# Copy the generic arch files first then
Expand Down