aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend_reverse')
-rw-r--r--internal/fusefrontend_reverse/root_node.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/internal/fusefrontend_reverse/root_node.go b/internal/fusefrontend_reverse/root_node.go
index 1a68ffd..cb04151 100644
--- a/internal/fusefrontend_reverse/root_node.go
+++ b/internal/fusefrontend_reverse/root_node.go
@@ -8,20 +8,18 @@ import (
"sync/atomic"
"syscall"
- "github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
-
- "github.com/rfjakob/gocryptfs/v2/internal/tlog"
-
"golang.org/x/sys/unix"
"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
"github.com/rfjakob/gocryptfs/v2/internal/contentenc"
+ "github.com/rfjakob/gocryptfs/v2/internal/exitcodes"
"github.com/rfjakob/gocryptfs/v2/internal/fusefrontend"
"github.com/rfjakob/gocryptfs/v2/internal/inomap"
"github.com/rfjakob/gocryptfs/v2/internal/nametransform"
"github.com/rfjakob/gocryptfs/v2/internal/syscallcompat"
+ "github.com/rfjakob/gocryptfs/v2/internal/tlog"
"github.com/sabhiram/go-gitignore"
)
@@ -53,6 +51,8 @@ type RootNode struct {
// bizarre problems when inode numbers are reused behind our back,
// like this one: https://github.com/rfjakob/gocryptfs/issues/802
gen uint64
+ // rootIno is the inode number that we report for the root node on mount
+ rootIno uint64
}
// NewRootNode returns an encrypted FUSE overlay filesystem.
@@ -61,9 +61,10 @@ type RootNode struct {
func NewRootNode(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransform.NameTransform) *RootNode {
var rootDev uint64
var st syscall.Stat_t
+ var statErr error
var shortNameMax int
- if err := syscall.Stat(args.Cipherdir, &st); err != nil {
- tlog.Warn.Printf("Could not stat backing directory %q: %v", args.Cipherdir, err)
+ if statErr = syscall.Stat(args.Cipherdir, &st); statErr != nil {
+ tlog.Warn.Printf("Could not stat backing directory %q: %v", args.Cipherdir, statErr)
if args.OneFileSystem {
tlog.Fatal.Printf("This is a fatal error in combination with -one-file-system")
os.Exit(exitcodes.CipherDir)
@@ -83,6 +84,10 @@ func NewRootNode(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransf
rootDev: rootDev,
shortNameMax: shortNameMax,
}
+ if statErr == nil {
+ rn.inoMap.TranslateStat(&st)
+ rn.rootIno = st.Ino
+ }
if len(args.Exclude) > 0 || len(args.ExcludeWildcard) > 0 || len(args.ExcludeFrom) > 0 {
rn.excluder = prepareExcluder(args)
}
@@ -173,3 +178,7 @@ func (rn *RootNode) uniqueStableAttr(mode uint32, ino uint64) fs.StableAttr {
Gen: atomic.AddUint64(&rn.gen, 1),
}
}
+
+func (rn *RootNode) RootIno() uint64 {
+ return rn.rootIno
+}