From 11fb037e7e7d84405b3bed9de2aa500e49d9502d Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 5 Sep 2015 20:30:20 +0200 Subject: Cleanup and rename files --- frontend/fe_fs.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 frontend/fe_fs.go (limited to 'frontend/fe_fs.go') diff --git a/frontend/fe_fs.go b/frontend/fe_fs.go new file mode 100644 index 0000000..470095f --- /dev/null +++ b/frontend/fe_fs.go @@ -0,0 +1,47 @@ +package frontend + +// frontend sits between FUSE and ClueFS +// and uses cryptfs for all crypto operations +// +// cryptfs +// ^ +// | +// v +// FUSE <-> frontend <-> ClueFS +// +// This file handles just the root directory + +import ( + "fmt" + "github.com/rfjakob/gocryptfs/cryptfs" + "github.com/rfjakob/cluefs/lib/cluefs" + fusefs "bazil.org/fuse/fs" +) + +type FS struct { + *cryptfs.CryptFS + *cluefs.ClueFS + backing string +} + +type nullTracer struct {} + +func (nullTracer) Trace(op cluefs.FsOperTracer) {} + +func NewFS(key [16]byte, backing string) *FS { + var nt nullTracer + clfs, err := cluefs.NewClueFS(backing, nt) + if err != nil { + panic(err) + } + return &FS { + CryptFS: cryptfs.NewCryptFS(key), + ClueFS: clfs, + backing: backing, + } +} + +func (fs *FS) Root() (fusefs.Node, error) { + fmt.Printf("Root\n") + return NewDir("", fs.backing, fs), nil +} -- cgit v1.2.3