Migrate to use fuse crate's FuseConfig API
The old API is deprecated with a new replacement in
https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3514617
Note that the original API uses write/read in an opposite perspective:
a write to the filesystem by another process is a read to these FUSE
filesystems. Which is also inconsistent to the mount opion of max_read.
The new API brings consistency. For this specific change:
- zipfuse happened to name them in the opposite (but now correct) way.
- authfs happened to use the same values for both, so just update the
comments. Also remove the comment in remote_file.rs that mentioned
the old API. It's not super helpful anyway with the compiler check.
Bug: 223659448
Test: atest AuthFsHostTest
Change-Id: I33436cdc3bf84c3a0d42a6b517fe9ef28958292a
diff --git a/authfs/src/fusefs/mount.rs b/authfs/src/fusefs/mount.rs
index 294c6b1..38503df 100644
--- a/authfs/src/fusefs/mount.rs
+++ b/authfs/src/fusefs/mount.rs
@@ -21,11 +21,12 @@
use super::AuthFs;
-/// Maximum bytes in the write transaction to the FUSE device. This limits the maximum buffer
-/// size in a read request (including FUSE protocol overhead) that the filesystem writes to.
+/// Maximum bytes (excluding the FUSE header) `AuthFs` will receive from the kernel for write
+/// operations by another process.
pub const MAX_WRITE_BYTES: u32 = 65536;
-/// Maximum bytes in a read operation.
+/// Maximum bytes (excluding the FUSE header) `AuthFs` will receive from the kernel for read
+/// operations by another process.
/// TODO(victorhsieh): This option is deprecated by FUSE. Figure out if we can remove this.
const MAX_READ_BYTES: u32 = 65536;
@@ -61,5 +62,7 @@
)
.expect("Failed to mount fuse");
- fuse::worker::start_message_loop(dev_fuse, MAX_WRITE_BYTES, MAX_READ_BYTES, authfs)
+ let mut config = fuse::FuseConfig::new();
+ config.dev_fuse(dev_fuse).max_write(MAX_WRITE_BYTES).max_read(MAX_READ_BYTES);
+ config.enter_message_loop(authfs)
}