fusefrontend_reverse: convert fmt.Printf calls to tlog

The fmt.Printfs output would end up in the paniclog.
This commit is contained in:
Jakob Unterwurzacher 2017-04-01 15:49:53 +02:00
parent c87439b4e6
commit acb73ca436
5 changed files with 13 additions and 13 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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