libgocryptfs/frontend/fs.go

37 lines
637 B
Go
Raw Normal View History

2015-09-03 19:09:23 +02:00
package frontend
import (
2015-09-05 11:49:05 +02:00
"fmt"
2015-09-03 19:09:23 +02:00
"github.com/rfjakob/gocryptfs/cryptfs"
"github.com/rfjakob/cluefs/lib/cluefs"
2015-09-05 11:49:05 +02:00
fusefs "bazil.org/fuse/fs"
2015-09-03 19:09:23 +02:00
)
type FS struct {
*cryptfs.CryptFS
*cluefs.ClueFS
2015-09-05 11:49:05 +02:00
backing string
2015-09-03 19:27:07 +02:00
}
type nullTracer struct {}
2015-09-03 19:27:07 +02:00
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,
2015-09-05 11:49:05 +02:00
backing: backing,
2015-09-03 23:54:12 +02:00
}
2015-09-03 19:09:23 +02:00
}
2015-09-05 11:49:05 +02:00
func (fs *FS) Root() (fusefs.Node, error) {
fmt.Printf("Root\n")
return NewDir("", fs.backing, fs), nil
}