aboutsummaryrefslogtreecommitdiff
path: root/pathfs_frontend
diff options
context:
space:
mode:
Diffstat (limited to 'pathfs_frontend')
-rw-r--r--pathfs_frontend/file.go1
-rw-r--r--pathfs_frontend/fs.go21
2 files changed, 18 insertions, 4 deletions
diff --git a/pathfs_frontend/file.go b/pathfs_frontend/file.go
index 493a223..8cf070c 100644
--- a/pathfs_frontend/file.go
+++ b/pathfs_frontend/file.go
@@ -210,6 +210,7 @@ func (f *file) Chown(uid uint32, gid uint32) fuse.Status {
}
func (f *file) GetAttr(a *fuse.Attr) fuse.Status {
+ cryptfs.Debug.Printf("file.GetAttr()\n")
st := syscall.Stat_t{}
f.lock.Lock()
err := syscall.Fstat(int(f.fd.Fd()), &st)
diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go
index 85fbbaf..bf93766 100644
--- a/pathfs_frontend/fs.go
+++ b/pathfs_frontend/fs.go
@@ -34,16 +34,24 @@ func (fs *FS) GetPath(relPath string) string {
}
func (fs *FS) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {
- a, status := fs.FileSystem.GetAttr(fs.EncryptPath(name), context)
+ cryptfs.Debug.Printf("FS.GetAttr('%s')\n", name)
+ cName := fs.EncryptPath(name)
+ a, status := fs.FileSystem.GetAttr(cName, context)
if a == nil {
+ cryptfs.Notice.Printf("FS.GetAttr failed: %s\n", status.String())
return a, status
}
-
- a.Size = fs.PlainSize(a.Size)
+ if a.IsRegular() {
+ a.Size = fs.PlainSize(a.Size)
+ } else if a.IsSymlink() {
+ target, _ := fs.Readlink(name, context)
+ a.Size = uint64(len(target))
+ }
return a, status
}
func (fs *FS) OpenDir(dirName string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status) {
+ cryptfs.Debug.Printf("OpenDir(%s)\n", dirName)
cipherEntries, status := fs.FileSystem.OpenDir(fs.EncryptPath(dirName), context);
var plain []fuse.DirEntry
if cipherEntries != nil {
@@ -137,7 +145,12 @@ func (fs *FS) Mkdir(path string, mode uint32, context *fuse.Context) (code fuse.
}
func (fs *FS) Unlink(name string, context *fuse.Context) (code fuse.Status) {
- return fs.FileSystem.Unlink(fs.EncryptPath(name), context)
+ cName := fs.EncryptPath(name)
+ code = fs.FileSystem.Unlink(cName, context)
+ if code != fuse.OK {
+ cryptfs.Notice.Printf("Unlink failed on %s [%s], code=%s\n", name, cName, code.String())
+ }
+ return code
}
func (fs *FS) Rmdir(name string, context *fuse.Context) (code fuse.Status) {