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)
Unfortunately, I didn't split this into multiple commits:
- Keeping track of nlinks is now all done by link_under_dir and
unlink_from_dir methods.
- Inodes are no longer associated with a name.
- Directory structure is now represented using a Map<name to idx>, so
the directory inode fully owns the directory entries instead a linked
list scattered across many inodes.
- The parameter order for FS#Link and FS#link_under_dir has been
modified to be consistent with 9p's: (dirid, fid, name)
- Allowed the movement of hardlinked files between filesystems
"vertically", as long as the target inode is reachable within the
filesystem and subfilesystems without ever having to traverse to the
parent filesystem.
- The methods FS#copy_inode and FS#divert does not put the filesystem in
an invalid state: FS#copy_inode does not modify inode.nlinks nor
inode.direntries, and FS#divert makes sure to delete the original nlinks
and direntries after it has been copied over to a new inode.
- Added extra assertions in FS#link_under_dir and FS#unlink_from_dir
- Forwarders should not be deleted upon unlink: the files are still
accessible.
- Non-root non-directory forwarders can now be linked under
non-forwarder directories for extra freedom for hardlinks. Now, the rule
for linking is: never link under a forwarder, and never link a directory
more than once.
Some tests and some 9p debug code is broken because they rely on
inode.name which no longer exists nor makes sense to exist.
Will fix in next commit.
If mountpoint already exists, then we're silently making its children
inaccessible which may not be what we expected/intended.
Create a new forwarder inode upon mounting.
Previously:
(1) The number of bytes to read (aka count) is readjusted to become negative.
Driver reports bogus count value.
(2) However, when sending the data through virtio, the payload buffer was
incorrectly subarrayed with the negative end-offset, so wrong data was
still sent through.
Now:
(1) 9P read(dir) now clamps the count value to non-negative numbers.
(2) Add asserts for negative replybuffersize and payloadsize as those
should not happen in the first place.
Previous intention: virtqueue.flush_replies was to be called after all
current pending requests have been processed.
Previous implementation: flush_replies was called at the end of the
notify handler, assuming that all replies are pushed by then.
However, some replies are pushed asynchronously sometime after the
notify handler finishes, so the guest OS never gets interrupted for
that reply and the guest OS will appear stuck.
- Use array.includes over .indexOf for existence checking.
- Immediate object returns.
- Correct commenting for non JSDoc comments.
- Improve assert messages for failures.
- Move generic reusable code into lib.js
Implement queue push, pop and flush
Implement get/set_next_blob.
- Old interface used to use GetByte
- Later, GetByte was replaced with code that copies all data into a
single contiguous buffer so buffer bounds don't need to be checked for
every GetByte call.
- get_next_blob allows data to be copied directly into a destination buffer
(e.g. in lib/filesystem.js) without first copying into an intermediate
buffer.
Fix handling of 64bit fields.
Fix device status handling.
If multiple devices need its own virtio interface, it's cleaner for
each device to contain its own virtio than for a single virtio to manage
multiple devices.
Replaced original virtio v0.9 header in BAR0 with several virtio v1.0
PCI capabilities.
Began abstracting virtqueues.