Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
The functions in this module are mapped directly onto individual 9P RPCs. The client must carefully respect the rules on managing fids and stay within the message size limits.
val maximum_write_payload : t -> int32
The largest payload that can be written in one go.
val allocate_fid :
t ->
(Protocol_9p__.Protocol_9p_types.Fid.t, [ `Msg of string ]) Result.result
Lwt.t
allocate_fid t
returns a free fid. Callers must call deallocate_fid t
when they are finished with it.
deallocate_fid t fid
clunks a fid and marks it as free for re-use.
val walk :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
string list ->
(Protocol_9p__.Protocol_9p_response.Walk.t, [ `Msg of string ]) Result.result
Lwt.t
walk t fid newfid wnames
binds newfid
to the result of Walking from fid
along the path given by wnames
val openfid :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
Protocol_9p__.Protocol_9p_types.OpenMode.t ->
(Protocol_9p__.Protocol_9p_response.Open.t, [ `Msg of string ]) Result.result
Lwt.t
open t fid mode
confirms that fid
can be accessed according to mode
val create :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
?extension:string ->
string ->
Protocol_9p__.Protocol_9p_types.FileMode.t ->
Protocol_9p__.Protocol_9p_types.OpenMode.t ->
(Protocol_9p__.Protocol_9p_response.Create.t, [ `Msg of string ])
Result.result
Lwt.t
create t fid name perm mode
creates a new file or directory called name
and with permissions perm
inside the directory fid
and opens it according to mode
(which is not checked against perm
).
val stat :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
(Protocol_9p__.Protocol_9p_response.Stat.t, [ `Msg of string ]) Result.result
Lwt.t
stat t fid
returns a description of the file associated with fid
val wstat :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
Protocol_9p__.Protocol_9p_types.Stat.t ->
(unit, [ `Msg of string ]) Result.result Lwt.t
wstat t fid stat
changes the file metadata according to stat
.
val read :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
int64 ->
int32 ->
(Protocol_9p__.Protocol_9p_response.Read.t, [ `Msg of string ]) Result.result
Lwt.t
read t fid offset count
returns count
bytes of data at offset
in the file referenced by pid
. Note that count
must be less than the server's negotiated maximum message size.
val write :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
int64 ->
Cstruct.t ->
(Protocol_9p__.Protocol_9p_response.Write.t, [ `Msg of string ])
Result.result
Lwt.t
write t fid offset data
writes data
to the file given by fid
at offset offset
. data
must not exceed maximum_write_payload t
.
val clunk :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
(unit, [ `Msg of string ]) Result.result Lwt.t
clunk t fid
informs the server that the reference fid
should be forgotten about. When this call returns, it is safe for the client to re-use the fid.
val remove :
t ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
(unit, [ `Msg of string ]) Result.result Lwt.t
remove t fid
removes the file associated with fid
from the file server. The server will "clunk" the fid whether the call succeeds or fails.
val update :
t ->
?name:string ->
?length:int64 ->
?mode:Protocol_9p__.Protocol_9p_types.FileMode.t ->
?mtime:int32 ->
?gid:string ->
Protocol_9p__.Protocol_9p_types.Fid.t ->
(unit, [ `Msg of string ]) Result.result Lwt.t
Convenience wrapper around wstat
.