Skip to content

Comments

Don't depend on ppx_cstruct, add mli file#21

Open
reynir wants to merge 3 commits intohaesbaert:masterfrom
reynir:p1
Open

Don't depend on ppx_cstruct, add mli file#21
reynir wants to merge 3 commits intohaesbaert:masterfrom
reynir:p1

Conversation

@reynir
Copy link

@reynir reynir commented Sep 9, 2024

The cstruct ppx was expanded and manually added in the source file. It was only used in one place for a relatively small struct. The hexdump function was omitted.

A lib/rawlink_lowlevel.mli file was added with all members exposed. The intent is to eventually unexpose what is not needed.

The cstruct ppx was expanded and manually added in the source file. It
was only used in one place for a relatively small struct. The hexdump
function was omitted.

A lib/rawlink_lowlevel.mli file was added with all members exposed. The
intent is to eventually unexpose what is not needed.
They seem to be unused, and to me they seem at most useful for mock
testing.
Comment on lines +7 to +12
external driver : unit -> driver = "caml_driver"
external unix_bytes_read :
Unix.file_descr -> Cstruct.buffer -> int -> int -> int
= "caml_unix_bytes_read"
external bpf_align : int -> int -> int = "caml_bpf_align"
val bpf_split_buffer : Cstruct.t -> int -> Cstruct.t list
Copy link
Author

Choose a reason for hiding this comment

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

I think we can remove bpf_align and bpf_split_buffer, and maybe driver as well from the interface.

@@ -0,0 +1,13 @@
type driver = AF_PACKET | BPF
Copy link
Author

Choose a reason for hiding this comment

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

I tried to not expose driver in the mli, but then the compiler warns that the constructors are never used to build values (warn 37). They are built in the C stubs. I guess we can unexpose it and silence the warning in the .ml file.

@haesbaert
Copy link
Owner

haesbaert commented Sep 10, 2024 via email

@reynir
Copy link
Author

reynir commented Sep 10, 2024

Hey! No worries. After some thought this PR is not so important to me (my PR mirage/ocaml-cstruct#316 would alleviate this anyway). So feel free to close it or let it hang as you like. Please take care!

@hannesm
Copy link
Collaborator

hannesm commented Sep 13, 2024

Heya, I'll look into this, just hang on tight, $LIFE has gotten me by the balls.

If you ever feel overwhelmed, don't hesitate to reach out and we can take the repository to maintain (either mirage or robur-coop). Maybe adapt the goals and perspective of the repo (looking at the variety of IO systems supported, it may be sensible to figure which we actually want to support).

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

Successfully merging this pull request may close these issues.

3 participants