summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-06 19:56:34 +0200
committerEdoardo La Greca2025-08-06 20:06:24 +0200
commit4030d1880474e2188a01a5fd6f20c8d068e5afeb (patch)
treed20d5249b04a60520e3dfee3f2b5ff527f3b914d /src/main
parent309b9eac8bf62e53d8efefb15852105218026bf9 (diff)
add documentation for write
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/ProtocolTranslator.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/kotlin/ProtocolTranslator.kt b/src/main/kotlin/ProtocolTranslator.kt
index e24d60c..e938224 100644
--- a/src/main/kotlin/ProtocolTranslator.kt
+++ b/src/main/kotlin/ProtocolTranslator.kt
@@ -66,7 +66,14 @@ interface ProtocolTranslator {
fun read(fid: UInt, offset: ULong, count: UInt): Pair<String?, Array<UByte>>
/**
- * Transfer data to file.
+ * Transfer data to file. Due to the negotiated maximum size of 9P messages, called `msize`, one is supposed to
+ * call this method multiple times, unless the content is smaller than `msize`.
+ *
+ * @param fid The FID to write to.
+ * @param offset The distance between the beginning of the file and the first written byte.
+ * @param data The raw bytes that are going to be written.
+ * @return A pair of: (1) an optional error message and (2) the amount of bytes written with the call just made. If
+ * the string is not null, an error occurred and the amount of written bytes is going to be zero.
*/
fun write(fid: UInt, offset: ULong, count: UInt, data: Iterable<UByte>): Pair<String?, UInt>