aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/root_node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2026-02-08 20:25:47 +0100
committerJakob Unterwurzacher2026-02-08 20:27:30 +0100
commit23c145174d336f739f1e7504e2a0e1ff5a864ee9 (patch)
treee290e24713b86e180269498f2c89674ba978d0e2 /internal/fusefrontend/root_node.go
parent3384217ee698a6c5d0eca2078961a69d9cbe0be0 (diff)
fusefrontend: convert mangleOpenFlags method to a functiono_symlink
No need to attach it to the root node. Also rename it to mangleOpenCreateFlags.
Diffstat (limited to 'internal/fusefrontend/root_node.go')
-rw-r--r--internal/fusefrontend/root_node.go25
1 files changed, 0 insertions, 25 deletions
diff --git a/internal/fusefrontend/root_node.go b/internal/fusefrontend/root_node.go
index 362290d..aa26b9c 100644
--- a/internal/fusefrontend/root_node.go
+++ b/internal/fusefrontend/root_node.go
@@ -1,7 +1,6 @@
package fusefrontend
import (
- "os"
"strings"
"sync"
"sync/atomic"
@@ -108,30 +107,6 @@ func (rn *RootNode) AfterUnmount() {
rn.dirCache.stats()
}
-// mangleOpenFlags is used by Create() and Open() to convert the open flags the user
-// wants to the flags we internally use to open the backing file.
-// The returned flags always contain O_NOFOLLOW.
-func (rn *RootNode) mangleOpenFlags(flags uint32) (newFlags int) {
- newFlags = int(flags)
- // Convert WRONLY to RDWR. We always need read access to do read-modify-write cycles.
- if (newFlags & syscall.O_ACCMODE) == syscall.O_WRONLY {
- newFlags = newFlags ^ os.O_WRONLY | os.O_RDWR
- }
- // We also cannot open the file in append mode, we need to seek back for RMW
- newFlags = newFlags &^ os.O_APPEND
- // O_DIRECT accesses must be aligned in both offset and length. Due to our
- // crypto header, alignment will be off, even if userspace makes aligned
- // accesses. Running xfstests generic/013 on ext4 used to trigger lots of
- // EINVAL errors due to missing alignment. Just fall back to buffered IO.
- newFlags = newFlags &^ syscallcompat.O_DIRECT
- // Create and Open are two separate FUSE operations, so O_CREAT should usually not
- // be part of the Open() flags. Create() will add O_CREAT back itself.
- newFlags = newFlags &^ syscall.O_CREAT
- // We always want O_NOFOLLOW/O_SYMLINK to be safe against symlink races
- newFlags |= syscallcompat.OpenatFlagNofollowSymlink
- return newFlags
-}
-
// reportMitigatedCorruption is used to report a corruption that was transparently
// mitigated and did not return an error to the user. Pass the name of the corrupt
// item (filename for OpenDir(), xattr name for ListXAttr() etc).