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

Do platform-dependent sub-libraries still make sense with Eio? #406

Closed
Tim-ats-d opened this issue Jan 11, 2023 · 2 comments
Closed

Do platform-dependent sub-libraries still make sense with Eio? #406

Tim-ats-d opened this issue Jan 11, 2023 · 2 comments

Comments

@Tim-ats-d
Copy link

Tim-ats-d commented Jan 11, 2023

Sorry if I'm not expressing myself well, I have a vague idea of the interoperability of Eio with other platforms for now.

For example, to access the file system, it is necessary to have an Eio.Path.t only provided by the environment object. So, I guess Mirage OS support for Eio will not provide #(cwd) and #(fs) methods in environment object. Based on this statement, does a xxx-eio-unix sub-library still make sense?

@talex5
Copy link
Collaborator

talex5 commented Jan 13, 2023

So, I guess Mirage OS support for Eio will not provide #(cwd) and #(fs) methods in environment object.

Eio_main.run is used on Unix-compatible systems, where you have code such as:

let main ~dir = ...

let () =
  Eio_main.run @@ fun env ->
  main ~dir:env#cwd

A unikernel wouldn't call Eio_main.run. Instead the mirage tool will generate whatever entrypoint is appropriate for the platform. e.g. there might be an Eio_xen.run function that would provide access to XenStore. The mirage-generated code would use that to get a block device, and use the block device to make a filesystem. It would then call your main function with that filesystem, e.g.

(* Generated by mirage tool *)
let () =
  Eio_xen.run @@ fun env ->
  let vda = Blkfront.connect env "vda" in
  let fs = Ext4.of_block vda in
  main ~dir:(Ext4.root fs)

@Tim-ats-d
Copy link
Author

Ok thanks, things are clearer for me now.

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

No branches or pull requests

2 participants