summaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/root_node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-08-16 18:40:48 +0200
committerJakob Unterwurzacher2021-08-16 19:23:58 +0200
commitb2724070d95234a8cd281f275211e0f827a8bbe1 (patch)
tree0c4efc4714d0826ac99ec40c905a111c9f9c7015 /internal/fusefrontend_reverse/root_node.go
parentad4b99170b9ad438909f5cba8c32109a18697a7a (diff)
reverse mode: implement -one-file-system
Fixes https://github.com/rfjakob/gocryptfs/issues/475
Diffstat (limited to 'internal/fusefrontend_reverse/root_node.go')
-rw-r--r--internal/fusefrontend_reverse/root_node.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/root_node.go b/internal/fusefrontend_reverse/root_node.go
index b072f85..d57e1e6 100644
--- a/internal/fusefrontend_reverse/root_node.go
+++ b/internal/fusefrontend_reverse/root_node.go
@@ -36,17 +36,31 @@ type RootNode struct {
// inoMap translates inode numbers from different devices to unique inode
// numbers.
inoMap *inomap.InoMap
+ // rootDev stores the device number of the backing directory. Used for
+ // --one-file-system.
+ rootDev uint64
}
// NewRootNode returns an encrypted FUSE overlay filesystem.
// In this case (reverse mode) the backing directory is plain-text and
// ReverseFS provides an encrypted view.
func NewRootNode(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransform.NameTransform) *RootNode {
+ var rootDev uint64
+ if args.OneFileSystem {
+ var st syscall.Stat_t
+ err := syscall.Stat(args.Cipherdir, &st)
+ if err != nil {
+ log.Panicf("Could not stat backing directory %q: %v", args.Cipherdir, err)
+ }
+ rootDev = uint64(st.Dev)
+ }
+
rn := &RootNode{
args: args,
nameTransform: n,
contentEnc: c,
inoMap: inomap.New(),
+ rootDev: rootDev,
}
if len(args.Exclude) > 0 || len(args.ExcludeWildcard) > 0 || len(args.ExcludeFrom) > 0 {
rn.excluder = prepareExcluder(args)