-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maintenance: add interface files for vhd-tool (#6052)
This detects some unused bindings and a mutable field. Chunked got also documented and changed the interface to make it more understandable to use.
- Loading branch information
Showing
12 changed files
with
211 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
(* Copyright (C) Cloud Software Group Inc. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation; version 2.1 only. with the special | ||
exception on linking described in file LICENSE. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
*) | ||
|
||
type t = { | ||
really_read: Cstruct.t -> unit Lwt.t | ||
; really_write: Cstruct.t -> unit Lwt.t | ||
; offset: int64 ref | ||
; skip: int64 -> unit Lwt.t | ||
; copy_from: Lwt_unix.file_descr -> int64 -> int64 Lwt.t | ||
; close: unit -> unit Lwt.t | ||
} | ||
|
||
exception Impossible_to_seek | ||
|
||
val of_raw_fd : Lwt_unix.file_descr -> t Lwt.t | ||
|
||
val of_seekable_fd : Lwt_unix.file_descr -> t Lwt.t | ||
|
||
type verification_config = { | ||
sni: string option | ||
; verify: Ssl.verify_mode | ||
; cert_bundle_path: string | ||
} | ||
|
||
val of_ssl_fd : | ||
Lwt_unix.file_descr -> string option -> verification_config option -> t Lwt.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(* Copyright (C) Cloud Software Group Inc. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation; version 2.1 only. with the special | ||
exception on linking described in file LICENSE. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
*) | ||
|
||
val sizeof : int | ||
|
||
(** [t] is the metadata of a chunk of disk that's meant to be streamed. These | ||
are used in a protocol that interleaves the metadata and the data until an | ||
empty metadata block is sent, which signals the end of the stream. *) | ||
type t | ||
|
||
val end_of_stream : t | ||
(** [end_of_stream] is the value that signals the end of the stream of chunks | ||
being transferred. *) | ||
|
||
val make : sector:int64 -> ?size:int64 -> Cstruct.t -> t | ||
(** [make ~sector ?size data] creates a chunk of disk that needs to be | ||
transferred, starting at the sector [sector]. [size] is the sector size, in | ||
bytes. The default is 512. *) | ||
|
||
val marshal : Cstruct.t -> t -> unit | ||
(** [marshall buffer chunk] writes the metadata of [chunk] to [buffer]. When | ||
transferring a whole disk, this is called a header and is written before | ||
the data. *) | ||
|
||
val is_last_chunk : Cstruct.t -> bool | ||
(** [is_last_chunk buffer] returns whether the current [buffer] is | ||
{end_of_stream} *) | ||
|
||
val get_offset : Cstruct.t -> int64 | ||
|
||
val get_len : Cstruct.t -> int32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
(* Copyright (C) Cloud Software Group Inc. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation; version 2.1 only. with the special | ||
exception on linking described in file LICENSE. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
*) | ||
|
||
module F : module type of Vhd_format.F.From_file (Vhd_format_lwt.IO) | ||
|
||
val get : | ||
'a | ||
-> string option | ||
-> string option | ||
-> [> `Error of bool * string | `Ok of unit] | ||
|
||
val info : 'a -> string option -> [> `Error of bool * string | `Ok of unit] | ||
|
||
val contents : 'a -> string option -> [> `Error of bool * string | `Ok of unit] | ||
|
||
val create : | ||
Common.t | ||
-> string option | ||
-> string option | ||
-> string option | ||
-> [> `Error of bool * string | `Ok of unit] | ||
|
||
val check : | ||
Common.t -> string option -> [> `Error of bool * string | `Ok of unit] | ||
|
||
val stream : | ||
Common.t -> StreamCommon.t -> [> `Error of bool * string | `Ok of unit] | ||
|
||
val serve : | ||
Common.t | ||
-> string | ||
-> int option | ||
-> string | ||
-> string option | ||
-> string | ||
-> int option | ||
-> string | ||
-> int64 option | ||
-> bool | ||
-> bool | ||
-> bool | ||
-> string option | ||
-> bool | ||
-> [> `Error of bool * string | `Ok of unit] | ||
|
||
(** Functions used by sparse_dd *) | ||
|
||
val make_stream : | ||
Common.t | ||
-> string | ||
-> string option | ||
-> string | ||
-> string | ||
-> Vhd_format_lwt.IO.fd Nbd_input.F.stream Lwt.t | ||
|
||
val write_stream : | ||
Common.t | ||
-> Vhd_format_lwt.IO.fd F.stream | ||
-> string | ||
-> StreamCommon.protocol option | ||
-> bool | ||
-> (int64 -> int64 -> unit) | ||
-> string option | ||
-> string option | ||
-> Channels.verification_config option | ||
-> unit Lwt.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
(* Copyright (C) Cloud Software Group Inc. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation; version 2.1 only. with the special | ||
exception on linking described in file LICENSE. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
*) | ||
|
||
type 'a t = 'a Lwt.t | ||
|
||
type fd = {fd: Lwt_unix.file_descr; mutable offset: int64} | ||
|
||
include Vhd_format.S.INPUT with type 'a t := 'a t with type fd := fd | ||
|
||
val of_fd : Lwt_unix.file_descr -> fd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(* Copyright (C) Cloud Software Group Inc. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published | ||
by the Free Software Foundation; version 2.1 only. with the special | ||
exception on linking described in file LICENSE. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
*) | ||
|
||
module F : module type of Vhd_format.F.From_file (Vhd_format_lwt.IO) | ||
|
||
val raw : | ||
?extent_reader:string -> 'a -> string -> string -> int64 -> 'a F.stream Lwt.t | ||
|
||
val vhd : | ||
?extent_reader:string | ||
-> Vhd_format_lwt.IO.fd Vhd_format.F.Raw.t | ||
-> string | ||
-> string | ||
-> int64 | ||
-> Vhd_format_lwt.IO.fd F.stream Lwt.t |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters