aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/root_node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-08-01 20:48:32 +0200
committerJakob Unterwurzacher2020-08-01 21:14:17 +0200
commit18b3bdb1584fd8e3dde89a95c0dfff910dd95ae1 (patch)
treef1b46811d45d0e7430e7bfef5c594c0c6860e707 /internal/fusefrontend_reverse/root_node.go
parent13dc7657ba0aac4da3f4b80ba231a919fdfae0f5 (diff)
v2api/reverse: start fusefrontend_reverse v2 API implementation
Diffstat (limited to 'internal/fusefrontend_reverse/root_node.go')
-rw-r--r--internal/fusefrontend_reverse/root_node.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/root_node.go b/internal/fusefrontend_reverse/root_node.go
new file mode 100644
index 0000000..726380f
--- /dev/null
+++ b/internal/fusefrontend_reverse/root_node.go
@@ -0,0 +1,39 @@
+package fusefrontend_reverse
+
+import (
+ "github.com/rfjakob/gocryptfs/internal/contentenc"
+ "github.com/rfjakob/gocryptfs/internal/fusefrontend"
+ "github.com/rfjakob/gocryptfs/internal/inomap"
+ "github.com/rfjakob/gocryptfs/internal/nametransform"
+
+ "github.com/sabhiram/go-gitignore"
+)
+
+// RootNode is the root directory in a `gocryptfs -reverse` mount
+type RootNode struct {
+ Node
+ // Stores configuration arguments
+ args fusefrontend.Args
+ // Filename encryption helper
+ nameTransform nametransform.NameTransformer
+ // Content encryption helper
+ contentEnc *contentenc.ContentEnc
+ // Tests whether a path is excluded (hiden) from the user. Used by -exclude.
+ excluder ignore.IgnoreParser
+ // inoMap translates inode numbers from different devices to unique inode
+ // numbers.
+ inoMap *inomap.InoMap
+}
+
+// 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.NameTransformer) *RootNode {
+ return &RootNode{
+ args: args,
+ nameTransform: n,
+ contentEnc: c,
+ inoMap: inomap.New(),
+ excluder: prepareExcluder(args),
+ }
+}