aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-09-05 20:36:26 +0200
committerJakob Unterwurzacher2015-09-05 20:36:26 +0200
commitd0524ded993f870c2dd8a559efed0d612e85d588 (patch)
treed6bd42b690eb5642378b7cf3404b6889541fe183 /frontend
parent11fb037e7e7d84405b3bed9de2aa500e49d9502d (diff)
Use Debug object instead of fmt
Diffstat (limited to 'frontend')
-rw-r--r--frontend/fe_dir.go16
-rw-r--r--frontend/fe_file.go10
-rw-r--r--frontend/fe_fs.go3
3 files changed, 13 insertions, 16 deletions
diff --git a/frontend/fe_dir.go b/frontend/fe_dir.go
index 75b665b..9849968 100644
--- a/frontend/fe_dir.go
+++ b/frontend/fe_dir.go
@@ -27,7 +27,7 @@ type Dir struct {
}
func NewDir(parent string, name string, fs *FS) *Dir {
- fmt.Printf("NewDir parent=%s name=%s\n", parent, name)
+ cryptfs.Debug.Printf("NewDir parent=%s name=%s\n", parent, name)
return &Dir {
Dir: cluefs.NewDir(parent, name, fs.ClueFS),
crfs: fs.CryptFS,
@@ -35,7 +35,7 @@ func NewDir(parent string, name string, fs *FS) *Dir {
}
func (d *Dir) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fusefs.Handle, error) {
- fmt.Printf("Open\n")
+ cryptfs.Debug.Printf("Open\n")
h, err := d.Dir.Open(ctx, req, resp)
if err != nil {
return nil, err
@@ -49,7 +49,7 @@ func (d *Dir) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenRe
}
func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fusefs.Node, error) {
- fmt.Printf("Lookup %s\n", req.Name)
+ cryptfs.Debug.Printf("Lookup %s\n", req.Name)
req.Name = d.crfs.EncryptPath(req.Name)
node, err := d.Dir.Lookup(ctx, req, resp)
if err != nil {
@@ -72,7 +72,7 @@ func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.Lo
}
func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
- fmt.Printf("ReadDirAll\n")
+ cryptfs.Debug.Printf("ReadDirAll\n")
entries, err := d.Dir.ReadDirAll(ctx)
if err != nil {
return nil, err
@@ -95,7 +95,7 @@ func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
}
func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fusefs.Node, error) {
- fmt.Printf("Mkdir %s\n", req.Name)
+ cryptfs.Debug.Printf("Mkdir %s\n", req.Name)
req.Name = d.crfs.EncryptPath(req.Name)
n, err := d.Dir.Mkdir(ctx, req)
if err != nil {
@@ -109,16 +109,14 @@ func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fusefs.Node, e
}
func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
- fmt.Printf("Remove\n")
+ cryptfs.Debug.Printf("Remove\n")
req.Name = d.crfs.EncryptPath(req.Name)
return d.Dir.Remove(ctx, req)
}
func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fusefs.Node, fusefs.Handle, error) {
- fmt.Printf("Create\n")
-
+ cryptfs.Debug.Printf("Create\n")
req.Flags, _ = fixFlags(req.Flags)
-
req.Name = d.crfs.EncryptPath(req.Name)
n, _, err := d.Dir.Create(ctx, req, resp)
if err != nil {
diff --git a/frontend/fe_file.go b/frontend/fe_file.go
index 4bd623f..7cc23ad 100644
--- a/frontend/fe_file.go
+++ b/frontend/fe_file.go
@@ -22,7 +22,7 @@ import (
)
func fixFlags(flags fuse.OpenFlags) (fuse.OpenFlags, bool) {
- fmt.Printf("fixFlags: Before: %s\n", flags.String())
+ cryptfs.Debug.Printf("fixFlags: Before: %s\n", flags.String())
var writeOnly bool
// We always need read access to do read-modify-write cycles
if flags & fuse.OpenWriteOnly > 0 {
@@ -32,7 +32,7 @@ func fixFlags(flags fuse.OpenFlags) (fuse.OpenFlags, bool) {
}
// We also cannot open the file in append mode, we need to seek back for RMW
flags = flags &^ fuse.OpenAppend
- fmt.Printf("fixFlags: After: %s\n", flags.String())
+ cryptfs.Debug.Printf("fixFlags: After: %s\n", flags.String())
return flags, writeOnly
}
@@ -51,7 +51,7 @@ type File struct {
}
func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fusefs.Handle, error) {
- fmt.Printf("File.Open\n")
+ cryptfs.Debug.Printf("File.Open\n")
req.Flags, f.writeOnly = fixFlags(req.Flags)
@@ -91,7 +91,7 @@ func (f *File) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadR
}
func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error {
- fmt.Printf("File.Write\n")
+ cryptfs.Debug.Printf("File.Write\n")
resp.Size = 0
iblocks := f.crfs.SplitRange(uint64(req.Offset), uint64(len(req.Data)))
var blockData []byte
@@ -134,7 +134,7 @@ func (f *File) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.Wri
}
func (f *File) Attr(ctx context.Context, attr *fuse.Attr) error {
- fmt.Printf("Attr\n")
+ cryptfs.Debug.Printf("Attr\n")
err := f.File.Node.Attr(ctx, attr)
if err != nil {
return err
diff --git a/frontend/fe_fs.go b/frontend/fe_fs.go
index 470095f..012d7f0 100644
--- a/frontend/fe_fs.go
+++ b/frontend/fe_fs.go
@@ -12,7 +12,6 @@ package frontend
// 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"
@@ -42,6 +41,6 @@ func NewFS(key [16]byte, backing string) *FS {
}
func (fs *FS) Root() (fusefs.Node, error) {
- fmt.Printf("Root\n")
+ cryptfs.Debug.Printf("Root\n")
return NewDir("", fs.backing, fs), nil
}