Skip to content
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

Support for virtio 9p filesystem #23

Closed
s-macke opened this issue Jul 22, 2014 · 5 comments
Closed

Support for virtio 9p filesystem #23

s-macke opened this issue Jul 22, 2014 · 5 comments
Assignees

Comments

@s-macke
Copy link
Owner

s-macke commented Jul 22, 2014

Support for the virtio 9p filesystem would allow us to manage a whole filesystem outside of the emulated machine.
For example a home folder which is mounted via the FileSystem APIs of modern web browsers.
Once this is done we can use 9p as root filesystem and load directly files from the webserver instead of a block device image.

@s-macke s-macke self-assigned this Jul 28, 2014
@s-macke
Copy link
Owner Author

s-macke commented Aug 10, 2014

In principle done.
Currently in the branch "transferto9p" but this will be standard in future.

@s-macke s-macke closed this as completed Aug 10, 2014
@coltonmercurio
Copy link
Contributor

Could you expand on how this enables the mounting of a file system outside of the VM? What api is exposed that enables this?

@s-macke
Copy link
Owner Author

s-macke commented Nov 16, 2015

You can describe the filesystem as "filesystem as a device". Instead of having a block device with linear access to a data area, you send open, close, read,write,rename,remove,.... commands to the device. The interface to this filesystem device is virtio implemented as memory managed IO.
The metadata of the filesystem is saved in a json file:
https://github.com/s-macke/jor1k-sysroot/blob/master/fs.json and the files are saved on the server.

The implementation and API of the filesystem is in the following file: https://github.com/s-macke/jor1k/blob/master/js/worker/filesystem/filesystem.js

The API to access the filesystem from the master thread (where the graphical web elements reside) is pretty limited. Take a look at the following demo for watching a file: http://s-macke.github.io/jor1k/demos/watch.html
The question is what do you want? With further patches it is possible to have full control of the whole filesystem from the outside of the emulator.

@coltonmercurio
Copy link
Contributor

That is exactly what I am after, full control of the filesystem from outside the emulator. I was looking around and found https://github.com/s-macke/jor1k/blob/master/js/worker/filesystem/filesystem.js , but I wasn't too sure if that was the correct point of entry as the stack trace was showing interaction with virtio 9p as well.
As I see it now, I can modify /worker/filesystem/filesystem.j to register more messages and implement functions such as recursively delete, notify changes in directory. Then work in https://github.com/s-macke/jor1k/blob/master/js/master/dev/filesystem.js to do the message passing for the additional functionality.

@s-macke
Copy link
Owner Author

s-macke commented Nov 16, 2015

Yes, that is the correct way to handle the filesystem. Just add the message handling to both files and you are done. Most functions are implemented in an atomic way. The only exception is the open function which might put the execution of the function in a queue until the file is loaded from the server. Also you will get problems when you alter or remove a file, which is currently opened by Linux.
If you have further questions don't hesitate to ask. I wanted to implement such new messages a long time before in order to add something like a file browser to the main window via the jsTree Javascript library.

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

No branches or pull requests

2 participants