summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-06-21 12:44:32 +0200
committerJakob Unterwurzacher2020-06-21 12:44:32 +0200
commit74a4accf0cc1fd3265abd8fa53b0721cd72c2158 (patch)
tree4f637a7d28a53ff5da0c1fe22dd8f8926f5f7fc4 /internal
parentebdf58b9ebf366ac6dbf500c0f4f4d211451bb44 (diff)
v2api: collect RootNode code in root_node.go
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend/node.go42
-rw-r--r--internal/fusefrontend/root_node.go41
2 files changed, 41 insertions, 42 deletions
diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go
index f4359a2..9074f72 100644
--- a/internal/fusefrontend/node.go
+++ b/internal/fusefrontend/node.go
@@ -10,9 +10,6 @@ import (
"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
- "github.com/rfjakob/gocryptfs/internal/contentenc"
- "github.com/rfjakob/gocryptfs/internal/inomap"
- "github.com/rfjakob/gocryptfs/internal/nametransform"
"github.com/rfjakob/gocryptfs/internal/syscallcompat"
)
@@ -22,45 +19,6 @@ type Node struct {
fs.Inode
}
-// RootNode is the root of the filesystem tree of Nodes.
-type RootNode struct {
- Node
- // args stores configuration arguments
- args Args
- // Filename encryption helper
- nameTransform nametransform.NameTransformer
- // Content encryption helper
- contentEnc *contentenc.ContentEnc
- // MitigatedCorruptions is used to report data corruption that is internally
- // mitigated by ignoring the corrupt item. For example, when OpenDir() finds
- // a corrupt filename, we still return the other valid filenames.
- // The corruption is logged to syslog to inform the user, and in addition,
- // the corrupt filename is logged to this channel via
- // reportMitigatedCorruption().
- // "gocryptfs -fsck" reads from the channel to also catch these transparently-
- // mitigated corruptions.
- MitigatedCorruptions chan string
- // IsIdle flag is set to zero each time fs.isFiltered() is called
- // (uint32 so that it can be reset with CompareAndSwapUint32).
- // When -idle was used when mounting, idleMonitor() sets it to 1
- // periodically.
- IsIdle uint32
-
- // inoMap translates inode numbers from different devices to unique inode
- // numbers.
- inoMap *inomap.InoMap
-}
-
-func NewRootNode(args Args, c *contentenc.ContentEnc, n nametransform.NameTransformer) *RootNode {
- // TODO
- return &RootNode{
- args: args,
- nameTransform: n,
- contentEnc: c,
- inoMap: inomap.New(),
- }
-}
-
// path returns the relative plaintext path of this node
func (n *Node) path() string {
return n.Path(n.Root())
diff --git a/internal/fusefrontend/root_node.go b/internal/fusefrontend/root_node.go
index 94fd021..1116a41 100644
--- a/internal/fusefrontend/root_node.go
+++ b/internal/fusefrontend/root_node.go
@@ -3,9 +3,50 @@ package fusefrontend
import (
"time"
+ "github.com/rfjakob/gocryptfs/internal/contentenc"
+ "github.com/rfjakob/gocryptfs/internal/inomap"
+ "github.com/rfjakob/gocryptfs/internal/nametransform"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
+// RootNode is the root of the filesystem tree of Nodes.
+type RootNode struct {
+ Node
+ // args stores configuration arguments
+ args Args
+ // Filename encryption helper
+ nameTransform nametransform.NameTransformer
+ // Content encryption helper
+ contentEnc *contentenc.ContentEnc
+ // MitigatedCorruptions is used to report data corruption that is internally
+ // mitigated by ignoring the corrupt item. For example, when OpenDir() finds
+ // a corrupt filename, we still return the other valid filenames.
+ // The corruption is logged to syslog to inform the user, and in addition,
+ // the corrupt filename is logged to this channel via
+ // reportMitigatedCorruption().
+ // "gocryptfs -fsck" reads from the channel to also catch these transparently-
+ // mitigated corruptions.
+ MitigatedCorruptions chan string
+ // IsIdle flag is set to zero each time fs.isFiltered() is called
+ // (uint32 so that it can be reset with CompareAndSwapUint32).
+ // When -idle was used when mounting, idleMonitor() sets it to 1
+ // periodically.
+ IsIdle uint32
+ // inoMap translates inode numbers from different devices to unique inode
+ // numbers.
+ inoMap *inomap.InoMap
+}
+
+func NewRootNode(args Args, c *contentenc.ContentEnc, n nametransform.NameTransformer) *RootNode {
+ // TODO
+ return &RootNode{
+ args: args,
+ nameTransform: n,
+ contentEnc: c,
+ inoMap: inomap.New(),
+ }
+}
+
// 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).