summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-04-01 15:49:53 +0200
committerJakob Unterwurzacher2017-04-01 15:49:53 +0200
commitacb73ca4363a8fbf3e0be1907a9b26689d879d73 (patch)
tree40ff06220daf3fc0fffac966bf800aa49621b9cb
parentc87439b4e691f55f79241bc7d9c2bf64a67abe14 (diff)
fusefrontend_reverse: convert fmt.Printf calls to tlog
The fmt.Printfs output would end up in the paniclog.
-rw-r--r--internal/fusefrontend_reverse/ctlsock_interface.go1
-rw-r--r--internal/fusefrontend_reverse/rfile.go5
-rw-r--r--internal/fusefrontend_reverse/rfs.go10
-rw-r--r--internal/fusefrontend_reverse/rpath_cache.go5
-rw-r--r--internal/fusefrontend_reverse/virtualfile.go5
5 files changed, 13 insertions, 13 deletions
diff --git a/internal/fusefrontend_reverse/ctlsock_interface.go b/internal/fusefrontend_reverse/ctlsock_interface.go
index 4b3ffe6..4d9a446 100644
--- a/internal/fusefrontend_reverse/ctlsock_interface.go
+++ b/internal/fusefrontend_reverse/ctlsock_interface.go
@@ -33,6 +33,5 @@ func (rfs *ReverseFS) EncryptPath(plainPath string) (string, error) {
// DecryptPath implements ctlsock.Backend
func (rfs *ReverseFS) DecryptPath(cipherPath string) (string, error) {
p, err := rfs.decryptPath(cipherPath)
- //fmt.Printf("rfs DecryptPath: %q -> %q %v\n", cipherPath, p, err)
return p, err
}
diff --git a/internal/fusefrontend_reverse/rfile.go b/internal/fusefrontend_reverse/rfile.go
index c5ca991..71d35a1 100644
--- a/internal/fusefrontend_reverse/rfile.go
+++ b/internal/fusefrontend_reverse/rfile.go
@@ -3,7 +3,6 @@ package fusefrontend_reverse
import (
"bytes"
"encoding/binary"
- "fmt"
"io"
"os"
@@ -51,8 +50,10 @@ func (rfs *ReverseFS) newFile(relPath string, flags uint32) (nodefs.File, fuse.S
}
// GetAttr - FUSE call
+// Triggered by fstat() from userspace
func (rf *reverseFile) GetAttr(*fuse.Attr) fuse.Status {
- fmt.Printf("reverseFile.GetAttr fd=%d\n", rf.fd.Fd())
+ tlog.Debug.Printf("reverseFile.GetAttr fd=%d\n", rf.fd.Fd())
+ // The kernel should fall back to stat()
return fuse.ENOSYS
}
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index 9dc2572..4dba91a 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -89,23 +89,23 @@ func (rfs *ReverseFS) dirIVAttr(relPath string, context *fuse.Context) (*fuse.At
cDir := relDir(relPath)
dir, err := rfs.decryptPath(cDir)
if err != nil {
- fmt.Printf("decrypt err %q\n", cDir)
+ tlog.Warn.Printf("dirIVAttr: decrypt err %q\n", cDir)
return nil, fuse.ToStatus(err)
}
// Does the parent dir exist?
a, status := rfs.loopbackfs.GetAttr(dir, context)
if !status.Ok() {
- fmt.Printf("missing parent\n")
+ tlog.Warn.Printf("dirIVAttr: missing parent\n")
return nil, status
}
// Is it a dir at all?
if !a.IsDir() {
- fmt.Printf("not isdir\n")
+ tlog.Warn.Printf("dirIVAttr: not isdir\n")
return nil, fuse.ENOTDIR
}
// Does the user have execute permissions?
if a.Mode&syscall.S_IXUSR == 0 {
- fmt.Printf("not exec")
+ tlog.Warn.Printf("dirIVAttr: not exec")
return nil, fuse.EPERM
}
// All good. Let's fake the file. We use the timestamps from the parent dir.
@@ -203,7 +203,7 @@ func (rfs *ReverseFS) GetAttr(relPath string, context *fuse.Context) (*fuse.Attr
}
if virtual {
if !status.Ok() {
- fmt.Printf("GetAttr %q: newXFile failed: %v\n", relPath, status)
+ tlog.Warn.Printf("GetAttr %q: newXFile failed: %v\n", relPath, status)
return nil, status
}
var a fuse.Attr
diff --git a/internal/fusefrontend_reverse/rpath_cache.go b/internal/fusefrontend_reverse/rpath_cache.go
index 81e945b..f90b357 100644
--- a/internal/fusefrontend_reverse/rpath_cache.go
+++ b/internal/fusefrontend_reverse/rpath_cache.go
@@ -21,16 +21,15 @@ func (c *rPathCacheContainer) lookup(cPath string) ([]byte, string) {
c.Lock()
defer c.Unlock()
if cPath == c.cPath {
- //fmt.Printf("HIT %q\n", cPath)
+ // hit
return c.dirIV, c.pPath
}
- //fmt.Printf("MISS %q\n", cPath)
+ // miss
return nil, ""
}
// store - write entry for "cPath" into the cache
func (c *rPathCacheContainer) store(cPath string, dirIV []byte, pPath string) {
- //fmt.Printf("STORE %q\n", cPath)
c.Lock()
defer c.Unlock()
c.cPath = cPath
diff --git a/internal/fusefrontend_reverse/virtualfile.go b/internal/fusefrontend_reverse/virtualfile.go
index d5c4491..2bd9e88 100644
--- a/internal/fusefrontend_reverse/virtualfile.go
+++ b/internal/fusefrontend_reverse/virtualfile.go
@@ -1,11 +1,12 @@
package fusefrontend_reverse
import (
- "fmt"
"syscall"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
+
+ "github.com/rfjakob/gocryptfs/internal/tlog"
)
func (rfs *ReverseFS) newDirIVFile(cRelPath string) (nodefs.File, fuse.Status) {
@@ -58,7 +59,7 @@ func (f *virtualFile) GetAttr(a *fuse.Attr) fuse.Status {
var st syscall.Stat_t
err := syscall.Lstat(f.parentFile, &st)
if err != nil {
- fmt.Printf("Lstat %q: %v\n", f.parentFile, err)
+ tlog.Debug.Printf("GetAttr: Lstat %q: %v\n", f.parentFile, err)
return fuse.ToStatus(err)
}
st.Ino = f.ino