fusefrontend_reverse: convert fmt.Printf calls to tlog
The fmt.Printfs output would end up in the paniclog.
This commit is contained in:
parent
c87439b4e6
commit
acb73ca436
|
@ -33,6 +33,5 @@ func (rfs *ReverseFS) EncryptPath(plainPath string) (string, error) {
|
||||||
// DecryptPath implements ctlsock.Backend
|
// DecryptPath implements ctlsock.Backend
|
||||||
func (rfs *ReverseFS) DecryptPath(cipherPath string) (string, error) {
|
func (rfs *ReverseFS) DecryptPath(cipherPath string) (string, error) {
|
||||||
p, err := rfs.decryptPath(cipherPath)
|
p, err := rfs.decryptPath(cipherPath)
|
||||||
//fmt.Printf("rfs DecryptPath: %q -> %q %v\n", cipherPath, p, err)
|
|
||||||
return p, err
|
return p, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package fusefrontend_reverse
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
@ -51,8 +50,10 @@ func (rfs *ReverseFS) newFile(relPath string, flags uint32) (nodefs.File, fuse.S
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAttr - FUSE call
|
// GetAttr - FUSE call
|
||||||
|
// Triggered by fstat() from userspace
|
||||||
func (rf *reverseFile) GetAttr(*fuse.Attr) fuse.Status {
|
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
|
return fuse.ENOSYS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,23 +89,23 @@ func (rfs *ReverseFS) dirIVAttr(relPath string, context *fuse.Context) (*fuse.At
|
||||||
cDir := relDir(relPath)
|
cDir := relDir(relPath)
|
||||||
dir, err := rfs.decryptPath(cDir)
|
dir, err := rfs.decryptPath(cDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("decrypt err %q\n", cDir)
|
tlog.Warn.Printf("dirIVAttr: decrypt err %q\n", cDir)
|
||||||
return nil, fuse.ToStatus(err)
|
return nil, fuse.ToStatus(err)
|
||||||
}
|
}
|
||||||
// Does the parent dir exist?
|
// Does the parent dir exist?
|
||||||
a, status := rfs.loopbackfs.GetAttr(dir, context)
|
a, status := rfs.loopbackfs.GetAttr(dir, context)
|
||||||
if !status.Ok() {
|
if !status.Ok() {
|
||||||
fmt.Printf("missing parent\n")
|
tlog.Warn.Printf("dirIVAttr: missing parent\n")
|
||||||
return nil, status
|
return nil, status
|
||||||
}
|
}
|
||||||
// Is it a dir at all?
|
// Is it a dir at all?
|
||||||
if !a.IsDir() {
|
if !a.IsDir() {
|
||||||
fmt.Printf("not isdir\n")
|
tlog.Warn.Printf("dirIVAttr: not isdir\n")
|
||||||
return nil, fuse.ENOTDIR
|
return nil, fuse.ENOTDIR
|
||||||
}
|
}
|
||||||
// Does the user have execute permissions?
|
// Does the user have execute permissions?
|
||||||
if a.Mode&syscall.S_IXUSR == 0 {
|
if a.Mode&syscall.S_IXUSR == 0 {
|
||||||
fmt.Printf("not exec")
|
tlog.Warn.Printf("dirIVAttr: not exec")
|
||||||
return nil, fuse.EPERM
|
return nil, fuse.EPERM
|
||||||
}
|
}
|
||||||
// All good. Let's fake the file. We use the timestamps from the parent dir.
|
// 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 virtual {
|
||||||
if !status.Ok() {
|
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
|
return nil, status
|
||||||
}
|
}
|
||||||
var a fuse.Attr
|
var a fuse.Attr
|
||||||
|
|
|
@ -21,16 +21,15 @@ func (c *rPathCacheContainer) lookup(cPath string) ([]byte, string) {
|
||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
defer c.Unlock()
|
||||||
if cPath == c.cPath {
|
if cPath == c.cPath {
|
||||||
//fmt.Printf("HIT %q\n", cPath)
|
// hit
|
||||||
return c.dirIV, c.pPath
|
return c.dirIV, c.pPath
|
||||||
}
|
}
|
||||||
//fmt.Printf("MISS %q\n", cPath)
|
// miss
|
||||||
return nil, ""
|
return nil, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// store - write entry for "cPath" into the cache
|
// store - write entry for "cPath" into the cache
|
||||||
func (c *rPathCacheContainer) store(cPath string, dirIV []byte, pPath string) {
|
func (c *rPathCacheContainer) store(cPath string, dirIV []byte, pPath string) {
|
||||||
//fmt.Printf("STORE %q\n", cPath)
|
|
||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
defer c.Unlock()
|
||||||
c.cPath = cPath
|
c.cPath = cPath
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package fusefrontend_reverse
|
package fusefrontend_reverse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/hanwen/go-fuse/fuse"
|
"github.com/hanwen/go-fuse/fuse"
|
||||||
"github.com/hanwen/go-fuse/fuse/nodefs"
|
"github.com/hanwen/go-fuse/fuse/nodefs"
|
||||||
|
|
||||||
|
"github.com/rfjakob/gocryptfs/internal/tlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (rfs *ReverseFS) newDirIVFile(cRelPath string) (nodefs.File, fuse.Status) {
|
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
|
var st syscall.Stat_t
|
||||||
err := syscall.Lstat(f.parentFile, &st)
|
err := syscall.Lstat(f.parentFile, &st)
|
||||||
if err != nil {
|
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)
|
return fuse.ToStatus(err)
|
||||||
}
|
}
|
||||||
st.Ino = f.ino
|
st.Ino = f.ino
|
||||||
|
|
Loading…
Reference in New Issue