1234567891011121314151617181920212223242526272829303132333435363738394041424344(*
* Copyright (C) 2015-present David Scott <dave.scott@unikernel.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*)typeerror=Mirage_device.errortypewrite_error=[error|`Is_read_only]letpp_error=Mirage_device.pp_errorletpp_write_errorppf=function|#Mirage_device.errorase->Mirage_device.pp_errorppfe|`Is_read_only->Fmt.pfppf"attempted to write to a read-only disk"typeinfo={read_write:bool;(** True if we can write, false if read/only *)sector_size:int;(** Octets per sector *)size_sectors:int64;(** Total sectors per device *)}moduletypeS=sigtypeerror=private[>Mirage_device.error]valpp_error:errorFmt.ttypewrite_error=private[>Mirage_device.error|`Is_read_only]valpp_write_error:write_errorFmt.tincludeMirage_device.Svalget_info:t->infoLwt.tvalread:t->int64->Cstruct.tlist->(unit,error)resultLwt.tvalwrite:t->int64->Cstruct.tlist->(unit,write_error)resultLwt.tend