Skip to content

IO_PAGE definition is duplicated and inconsistent #343

@talex5

Description

@talex5

types/V1.mli contains an IO_PAGE signature that is similar to the type of Io_page, but not quite the same. e.g.

io_page.mli:

val get : int -> t
(** [get n] allocates and returns a memory block of [n] pages. If
    there is not enough memory, an [Out_of_memory] exception is
    raised.  Note that this may be a recoverable situation, since
    this function allocates memory from a page-aligned pool, whereas
    the OCaml garbage collector will be running in its own heap that
    may have spare memory despite the [Out_of_memory] being raised
    from this function call. *)

but V1.mli:

module type IO_PAGE = sig
  val get : int -> t
  (** [get n] allocates and returns a memory block of [n] pages. If
      there is not enough memory, the unikernel will terminate. *)

As far as I can tell, no one is using IO_PAGE except for a unit-test in Io_page that checks that Io_page implements the type. Should it be fixed or deleted?

I'd like to clean up the types a bit. e.g. make t private to avoid treating all buffers as IO pages, and perhaps separate out single pages from ranges of pages, since some APIs care (e.g. Netif). That would be easier if the definitions weren't duplicated (or, actually, triplicated, as io_page.mli declares several functions twice).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions