1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071(*
* Copyright (c) 2011-2015 Anil Madhavapeddy <anil@recoil.org>
* Copyright (c) 2013-2015 Thomas Gazagnaire <thomas@gazagnaire.org>
* Copyright (c) 2013 Citrix Systems Inc
*
* 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=[|`Is_a_directory|`No_directory_entry|`Not_a_directory]typewrite_error=[|error|`File_already_exists|`No_directory_entry|`No_space]letpp_errorppf=function|`Is_a_directory->Fmt.stringppf"is a directory"|`Not_a_directory->Fmt.stringppf"is not a directory"|`No_directory_entry->Fmt.stringppf"a directory in the path does not exist"letpp_write_errorppf=function|#errorase->pp_errorppfe|`Directory_not_empty->Fmt.stringppf"directory is not empty"|`File_already_exists->Fmt.stringppf"file already exists"|`No_space->Fmt.stringppf"device has no more free space"typestat={filename:string;read_only:bool;directory:bool;size:int64;}typefs_error=errortypefs_write_error=write_errormoduletypeS=sigtypeerror=private[>fs_error]valpp_error:errorFmt.ttypewrite_error=private[>fs_write_error]valpp_write_error:write_errorFmt.tincludeMirage_device.Stypepage_aligned_buffervalread:t->string->int->int->(page_aligned_bufferlist,error)resultiovalsize:t->string->(int64,error)resultiovalcreate:t->string->(unit,write_error)resultiovalmkdir:t->string->(unit,write_error)resultiovaldestroy:t->string->(unit,write_error)resultiovalstat:t->string->(stat,error)resultiovallistdir:t->string->(stringlist,error)resultiovalwrite:t->string->int->page_aligned_buffer->(unit,write_error)resultioend