diff options
author | Edoardo La Greca | 2025-08-11 20:03:34 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-08-11 20:03:34 +0200 |
commit | dc223aa490efd9706fed6e499131e52496dad1a3 (patch) | |
tree | 984f0b3d7fc6bd0a6aba63dd17ac963472c7df1e | |
parent | 02fba54aecae044744fe5b6137769b6cf25830ce (diff) |
implement wstat
-rw-r--r-- | src/main/kotlin/Connection.kt | 15 | ||||
-rw-r--r-- | src/main/kotlin/ProtocolTranslator.kt | 7 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt index c3d3684..ff12656 100644 --- a/src/main/kotlin/Connection.kt +++ b/src/main/kotlin/Connection.kt @@ -302,7 +302,18 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator { return Stat(fid, rawStat) } - override fun wstat(path: String) { - TODO("Not yet implemented") + override fun wstat(fid: UInt, stat: Stat) { + val omsg = OutMessage(NinePMessageType.TWSTAT, this.tagGen.generate(), listOf("fid", "stat"), + mapOf( + "fid" to Pair(BigInteger(fid.toString()), 4u) + ), + emptyMap(), + mapOf( + "stat" to stat.toRaw() + ), + this.maxSize + ) + omsg.write(this.tl) + val imsg = checkedInMessage(omsg.tag) } }
\ No newline at end of file diff --git a/src/main/kotlin/ProtocolTranslator.kt b/src/main/kotlin/ProtocolTranslator.kt index 1ec4379..b1678a2 100644 --- a/src/main/kotlin/ProtocolTranslator.kt +++ b/src/main/kotlin/ProtocolTranslator.kt @@ -156,6 +156,11 @@ interface ProtocolTranslator { /** * Change file attributes. + * + * @param fid The FID of the file to set attributes of. + * @param stat The attributes to set. + * @throws except.InvalidMessageException if the received message is invalid. + * @throws except.RErrorException if the received message is an R-error message. */ - fun wstat(path: String) + fun wstat(fid: UInt, stat: Stat) }
\ No newline at end of file |