123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333open!Hermetictypekind=Op.kindtypecls=Forwarded|Interceptedofkind|Synthesized|Unsupportedtypeiface=Dir|Read|Write|Dir_handler|File_handlertypet={iface:iface;name:string;cls:cls;why:string}typenone=|letabsurd:none->'a=function_->.(* The entries of an interface's operations are made where a module of the
interface's signature defines them, over an empty type: an operation Eio
adds to the signature leaves the module short of a value. *)letoperations=letentries=ref[]inletopifacenameclswhyv=entries:={iface;name;cls;why}::!entries;vinletdirnameclswhyv=opDirnameclswhyvandreadnameclswhyv=opReadnameclswhyvandwritenameclswhyv=opWritenameclswhyvinletmodule_:Eio.Fs.Pi.DIR=structtypet=noneletopen_in=dir"open_in"(Intercepted`Open_read)"A fault refuses the open before the base opens, or swaps the name for \
a link after; the file is wrapped."absurdletopen_out=dir"open_out"(Intercepted`Open_write)"A fault refuses the open before the base opens, or swaps the name for \
a link after; the file is wrapped."absurdletmkdir=dir"mkdir"(Intercepted`Change)"A fault refuses the change before the base makes it."absurdletopen_subtree=dir"open_subtree"(Intercepted`Open_read)"A fault refuses the open before the base opens; the directory is \
wrapped under the same schedule."absurdletread_dir=dir"read_dir"(Intercepted`Read_dir)"A fault refuses the listing before the base lists."absurdletwith_dir_entries=dir"with_dir_entries"(Intercepted`Read_dir)"A fault refuses the listing before the base lists."absurdletstat=dir"stat"(Intercepted`Stat)"A fault refuses the stat before the base answers, or swaps the name \
for a link after."absurdletunlink=dir"unlink"(Intercepted`Change)"A fault refuses the change before the base makes it."absurdletrmdir=dir"rmdir"(Intercepted`Change)"A fault refuses the change before the base makes it."absurdletrename=dir"rename"(Intercepted`Change)"A fault refuses the change before the base makes it; a target \
directory that is a wrapper is unwrapped for the base."absurdletread_link=dir"read_link"Forwarded"Reading a link changes nothing and fails only as the base does."absurdletsymlink=dir"symlink"(Intercepted`Change)"A fault refuses the change before the base makes it."(fun~link_to:_->absurd)letchmod=dir"chmod"(Intercepted`Change)"A fault refuses the change before the base makes it."absurdletchown=dir"chown"(Intercepted`Change)"A fault refuses the change before the base makes it."(fun~follow:_?uid:_?gid:_->absurd)letsync_dir=dir"sync_dir"(Intercepted`Sync)"A fault refuses the barrier before the base's barrier runs."absurdletpp=dir"pp"Forwarded"A path through the wrapper is named as the base's."(fun_->absurd)letnative=dir"native"Forwarded"The base's native path, so a lock or a barrier taken natively reaches \
the same file."absurdletsplit=dir"split"Synthesized"POSIX syntax, which no instance carries and every base here uses."(fun_->None)letjoin=dir"join"Synthesized"POSIX syntax, which no instance carries and every base here uses."(funa_->a)endinletmoduleRead:Eio.File.Pi.READwithtypet=none=structtypet=noneletread_methods=read"read_methods"Synthesized"None, so every read goes through single_read and its fault."[]letsingle_read=read"single_read"(Intercepted`Read)"A fault refuses the read or shortens the buffer before the base reads."absurdletpread=read"pread"(Intercepted`Read)"A fault refuses the read or shortens the buffers before the base \
reads."absurdletstat=read"stat"(Intercepted`Stat)"A fault refuses the stat before the base answers."absurdletseek=read"seek"Forwarded"The base moves its offset; the wrapper keeps the one it reports \
operations at."absurdletclose=read"close"Forwarded"The base closes, at most once, as it would; the switch the file was \
opened in closes it too."absurdendinletmodule_:Eio.File.Pi.WRITE=structincludeReadletsingle_write=write"single_write"(Intercepted`Write)"A fault refuses the write, shortens it, or tears it after part \
reached the base."absurdletcopy=write"copy"Synthesized"Eio's simple copy through the wrapper's single_write, so each chunk \
is a write a fault may reach."absurdletpwrite=write"pwrite"(Intercepted`Write)"A fault refuses the write, shortens it, or tears it after part \
reached the base."absurdletsync=write"sync"(Intercepted`Sync)"A fault refuses the sync and tells the base it failed, before the \
base syncs."absurdlettruncate=write"truncate"(Intercepted`Truncate)"A fault refuses the truncation before the base truncates."absurdendinList.rev!entriesletdir_handlernameclswhy={iface=Dir_handler;name;cls;why}letfile_handlernameclswhy={iface=File_handler;name;cls;why}letclose_dir=dir_handler"close"Forwarded"The base closes, at most once, as it would; the switch the directory was \
opened in closes it too."letadmin=dir_handler"Eio_fs_internal.Admin"Synthesized"The base's root rights, wrapped under the same schedule, for Crash to \
read and rebuild the tree through."letbase_dir=dir_handler"Eio_fs_internal.Base_dir"Synthesized"The base, for this package's own code alone: a rename into a wrapper, and \
eio-fs.unix's host descriptor."letrebase=dir_handler"Eio_fs_internal.Rebase"Synthesized"The same wrapper, under the same schedule, over another base: \
Eio_fs_mem.as_user runs it as another user."letexclusive=dir_handler"Eio_fs.Sync.Rename.Exclusive"(Intercepted`Change)"A fault refuses the rename before the base makes it."letprocess_local=dir_handler"Eio_fs.Sync.Process_local"Forwarded"The wrapper adds no opener, so who can open the files is the base's to \
say."letmodeless=dir_handler"Eio_fs.Sync.Modeless"Forwarded"Whether modes are kept is the base's to say."letdir_sync=dir_handler"Eio_fs.Sync.Dir_sync"(Intercepted`Sync)"A fault refuses the barrier before the base's barrier runs."letdir_other=dir_handler"a base's own interface"Unsupported"Not carried over, as anything bound to the base steps around the \
schedule: a wrapper over a host directory is no native directory a child \
process starts in."letbase_file=file_handler"Eio_fs_internal.Base_file"Synthesized"The base, for this package's own code alone: eio-fs.unix takes the host \
descriptor a lock is taken on from it."letfile_sync=file_handler"Eio_fs.Sync.File_sync"(Intercepted`Sync)"A fault refuses the barrier and tells the base it failed, before the \
base's barrier runs; a file opened for reading answers it too, as fsync \
does."letsync_failed=file_handler"Eio_fs_internal.Sync_failed"Forwarded"A sync a wrapper above failed is told on to the base, so stacked wrappers \
reach the power-loss model at the bottom."letshutdown=file_handler"Eio.Flow.Pi.Shutdown"Unsupported"A file is no socket: neither the in-memory backend's handle nor \
eio_posix's binds it."(* Eio hides this one, so [binding] cannot name it. *)letsocket=file_handler"Eio.Net.Pi.Socket"Unsupported"A file is no socket: neither the in-memory backend's handle nor \
eio_posix's binds it."letread_only_write=file_handler"write side of a file opened for reading"Unsupported"A file opened for reading is no sink: a backend's handle binds the write \
side and refuses each write with EBADF, where the wrapper binds none; it \
syncs through File_sync."letfile_other=file_handler"a base's own interface"Unsupported"Not carried over, as anything bound to the base steps around the \
schedule: a file opened through a wrapper hands out no host descriptor."lethandlers=[close_dir;admin;base_dir;rebase;exclusive;process_local;modeless;dir_sync;dir_other;base_file;file_sync;sync_failed;shutdown;socket;read_only_write;file_other;]letall=operations@handlersletgetifacename=List.find(fune->e.iface=iface&&String.equale.namename)all(* A file's Close is its READ close. *)letbinding(typea)iface(Eio.Resource.H(pi,_):aEio.Resource.binding)=matchpiwith|Eio.Fs.Pi.Dir->`InterfaceDir|Eio.File.Pi.Read->`InterfaceRead|Eio.Flow.Pi.Source->`InterfaceRead|Eio.File.Pi.Write->`InterfaceWrite|Eio.Flow.Pi.Sink->`InterfaceWrite|Eio.Resource.Closewheniface=Dir_handler->`Opclose_dir|Eio.Resource.Close->`Op(getRead"close")|Eio.Flow.Pi.Shutdown->`Opshutdown|Eio_fs_internal.Admin->`Opadmin|Eio_fs_internal.Base_dir->`Opbase_dir|Eio_fs_internal.Rebase->`Oprebase|Eio_fs_internal.Base_file->`Opbase_file|Eio_fs_internal.Sync_failed->`Opsync_failed|Eio_fs_sync.Rename.Exclusive->`Opexclusive|Eio_fs_sync.Process_local->`Opprocess_local|Eio_fs_sync.Modeless->`Opmodeless|Eio_fs_sync.Dir_sync->`Opdir_sync|Eio_fs_sync.File_sync->`Opfile_sync|_->`Otherletpp_ifaceppf=function|Dir->Fmt.stringppf"Eio.Fs.Pi.DIR"|Read->Fmt.stringppf"Eio.File.Pi.READ"|Write->Fmt.stringppf"Eio.File.Pi.WRITE"|Dir_handler->Fmt.stringppf"directory handler"|File_handler->Fmt.stringppf"file handler"letpp_clsppf=function|Forwarded->Fmt.stringppf"forwarded"|Interceptedk->Fmt.pfppf"intercepted (%s)"(Op.kind_namek)|Synthesized->Fmt.stringppf"synthesized"|Unsupported->Fmt.stringppf"unsupported"letppppfe=Fmt.pfppf"%a %s"pp_ifacee.ifacee.name