Commit graph

151 commits

Author SHA1 Message Date
hello-smile6 b96665285b
Allow sharing files with guest using UI, even with custom profile (#702)
The 9p filesystem is always accessible by the guest, even if the UI is hidden. This will make the file picker UI be shown when needed
2022-07-14 10:26:13 +02:00
Fabian 4fa37f354f fix: 9p: limit read size to replybuffer size (fix Linux 5.15) 2022-02-17 17:38:01 +01:00
Ryo Ota df94bd595a fix typo 2021-09-23 19:30:13 +02:00
Fabian 5f86008338 Dead code (Unmarshall2) 2021-04-03 21:10:49 -05:00
Fabian b052280c37 Dead code (closure-base.js) 2021-04-03 21:10:49 -05:00
Fabian ea4c0e3c91 Compile without /usr/include 2021-01-03 22:43:03 -06:00
Fabian 497f618cab Merge branch 'wasm' into master 2021-01-03 02:07:20 -06:00
Fabian ac9d248c85 9p stats: Show file in progress after parallel operation finishes 2020-12-31 19:14:34 -06:00
Fabian 6b38af941e Reduce size of filesystem state 2020-12-31 19:14:33 -06:00
Fabian b34d4d95b7 Add zstd 2020-12-31 19:14:33 -06:00
Fabian cd3f48c0a3 Simplify recursive state handling (don't require get_state for set_state) 2020-12-31 19:14:32 -06:00
Fabian b96f984963 Use softfloat f80 for x87 fpu
This fixes several long-standing issues with x87 float emulation, in particular:

- 80 bit precision floats, fixing Haiku after its switch to musl libc (hrev53728)
- the precision bit in the x87 control word
- fucom and fucomi (unordered comparisons)
- aliasing of x87 and mmx registers
- rounding during conversion to integers

Operations that are not implemented in softfloat were implemented by
converting to f64 (sine, pow, ln, etc.) and thus operate with lower
precision.

Softfloat has been combined into a single file using a script [0] and checked into the repository.

[0] 57df21e2eb/contrib/single_file_libs/combine.sh
2020-12-31 19:14:32 -06:00
Fabian acb8ad5423 Avoid console.assert (doesn't throw) 2020-12-31 19:14:30 -06:00
Fabian d5c9b29942 Upgrade jshint 2020-12-31 19:14:29 -06:00
Fabian b0a34e7a86 fs: assert that sha256 is present 2020-12-31 19:14:29 -06:00
Ernest Wong 3dde97f14a Filesystem: Work on entire buffer when writing to file
The Uint8Array that stores the file data is usually larger than the file
size itself, to improve the amortized complexity of resizing the array.

When we previously switched over to using FileStorages, the method
fs#Write() was modified to retrieve only the subarray of the Uint8Array
that contains the file (i.e. excluding the unused padding at the end),
so appending to a file always tries to resize the array even though the
ArrayBuffer that backs it has enough space for the new data.
2020-08-30 19:37:15 -05:00
Ernest Wong 4651e28177 Fix type annotations for async functions 2020-08-30 19:37:15 -05:00
Ernest Wong ad16fb0656 Filesystem: Add missing awaits to async function calls 2020-08-30 19:37:15 -05:00
Ernest Wong 840415a052 Filestorage: (minor) Improve naming can_uncache() -> uncache() 2020-08-30 19:37:15 -05:00
Ernest Wong 2f4520619a Filesystem: Tidy naming of STATUS_ON_SERVER to ON_STORAGE 2020-08-30 19:37:15 -05:00
Ernest Wong c625bba498 Filestorage: Implement cache cleanup - avoid memory growth 2020-08-30 19:37:15 -05:00
Ernest Wong 04d2b72248 9p: Simplify read - OpenInode is not asynchronous 2020-08-30 19:37:15 -05:00
Ernest Wong 62c880b415 Filestorage: Integrate chunking and revert unnecessary chunking
- Integrate new FileStorage interface with lib/filesystem.js
- Simplify the FileStorage interface with the intention that it only
serves read-only files.
2020-08-30 19:37:15 -05:00
Ernest Wong c029944965 Filesystem: Distinguish server file via inode status.
Also make file_storage a mandatory argument to FS.
2020-08-30 19:37:15 -05:00
Ernest Wong 6a06a7108a Tidy: file_storage snake case and interface naming convention 2020-08-30 19:37:15 -05:00
Fabian 639ec0019b Commit a temporary workaround 2020-08-30 19:37:15 -05:00
Fabian d2f86799e9 Simplify load_from_json: Accept json object directly, don't run asynchronously 2020-08-30 19:37:14 -05:00
Fabian eb93fa5db7 Filesystem: Temporarily cache inode data until storage is chunked properly 2020-08-30 19:37:14 -05:00
Fabian fe5a1f5322 Fix error case in read_dir/read_file 2020-08-30 19:37:14 -05:00
Fabian 028e131ddb Rename OnJSONLoaded & small refactor 2020-08-30 19:37:14 -05:00
Fabian 3f79814e05 Detect initrd/bzimage in 9p filesystem and load before boot 2020-08-30 19:37:14 -05:00
Fabian b83ed1b7c1 Minor 2020-08-30 19:29:54 -05:00
Fabian dd929f52c5 9p: Add create event, add file name to the read event 2020-08-30 19:29:54 -05:00
Fabian fbdb4a28ea Remove all uses of "for in" 2020-08-30 19:29:54 -05:00
Fabian 3b86889a99 Throw proper error 2020-08-30 19:29:54 -05:00
Ernest Wong 44d54facb7 Filesystem: Remove remnants of file loader 2020-08-30 19:29:54 -05:00
Ernest Wong c1729b7daf Filesystem: Don't modify local copy of filedata after set_data
While the original code would've worked for MemoryFileStorage, it will
not work for FileStorages that clone the data before saving (e.g.
IndexedDBFileStorage) as local changes won't be reflected onto the
storage class.
2020-08-30 19:29:54 -05:00
Ernest Wong 0a67e3532f Filesystem: Introduce FileStorage class for server-loaded files 2020-08-30 19:29:54 -05:00
Ernest Wong 595d6dca55 Filesystem: Refactor inodedata accesses to async methods
The "// jshint ignore:line" comments are pretty messy, so squint your eyes.
They're systematically placed, so we can regex it out when jshint's
new version finally arrives.

Using async/await instead of callbacks due to callback hell, and it also
helps minimising the diff)
2020-08-30 19:29:54 -05:00
Ernest Wong adc035368f Filesystem: Log lock types as readable strings 2020-08-30 19:29:54 -05:00
Ernest Wong 401b814f93 Filesystem: Store infinite lock lengths
Having both lock.length and lock.get_length() giving different values is
confusing.
2020-08-30 19:29:54 -05:00
Ernest Wong 2bac2198e8 Filesystem: Don't store lock length of Infinity
Infinity is not JSON.stringifiable and will turn into null during state
save and restore.
2020-08-30 19:29:54 -05:00
Ernest Wong 267083e897 Filesystem: Implement POSIX record locks 2020-08-30 19:29:54 -05:00
Ernest Wong 40ed4f8dde Filesystem: Simplify nlinks management across filesystems
Now that hard links aren't allowed across filesystems, it's ok to store
the relevant nlinks information within local inode.

For mountpoints (forwarder inodes that point to a root inode), it is
possible to bump the nlinks of the forwarder during link_under_dir and
unlink_from_dir so that this nlinks counter is modified independently
from the real inode's nlinks counter.

For divert(), it is actually ok to divert forwarder inodes that point to
hardlinked files, so I've relaxed the assertion predicate.
2020-08-30 19:29:54 -05:00
Ernest Wong 66cf97e0a7 Filesystem: Tidy comments, clarify nlinks special case. 2020-08-30 19:29:54 -05:00
Ernest Wong 6c61d48c8f Filesystem: Fix typo with path concatenation during Rename 2020-08-30 19:29:54 -05:00
Ernest Wong c3739fc22a 9p: Disable filename tracking by default 2020-08-30 19:29:54 -05:00
Ernest Wong c7dda46de1 Filesystem: Disallow hardlinks across filesystems
Although hardlinks across filesystems worked quite well in the current
implementation, we will run into problems when we try to implement
different backends for each sub-filesystem.

Note: EPERM is used instead of EXDEV since the mv command will silently
try to use copy-and-unlink when rename(2) fails with EXDEV.

The rules for linking has been reverted back:
 - Before commit: Any inode, including forwarders, could be linked as
long as the parent is not a forwarder and is a directory.
 - After commit: Only non-forwarders and root-forwarders are allowed to
be linked, and must be linked under a directory and not a forwarder.
2020-08-30 19:29:54 -05:00
Ernest Wong 1a7dc59f07 9p: Track filename during RENAMEAT 2020-08-30 19:29:54 -05:00
Ernest Wong 0d885e5e8c 9p: put dbg_name into state and document its limitations 2020-08-30 19:29:54 -05:00