From 1ca4fc89aac5482f1294b1ffabc1912c2fb99a82 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 8 Sep 2015 22:03:27 +0200 Subject: More debug logging, improve main_test.go (do not use all-zero content) --- pathfs_frontend/file.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pathfs_frontend') diff --git a/pathfs_frontend/file.go b/pathfs_frontend/file.go index 0ce4257..d94fe1b 100644 --- a/pathfs_frontend/file.go +++ b/pathfs_frontend/file.go @@ -59,11 +59,11 @@ func (f *file) doRead(off uint64, length uint64) ([]byte, fuse.Status) { ciphertext := make([]byte, int(alignedLength)) n, err := f.fd.ReadAt(ciphertext, int64(alignedOffset)) ciphertext = ciphertext[0:n] - cryptfs.Debug.Printf("ReadAt length=%d offset=%d -> n=%d len=%d\n", alignedLength, alignedOffset, n, len(ciphertext)) if err != nil && err != io.EOF { cryptfs.Warn.Printf("read: ReadAt: %s\n", err.Error()) return nil, fuse.ToStatus(err) } + cryptfs.Debug.Printf("ReadAt length=%d offset=%d -> n=%d len=%d\n", alignedLength, alignedOffset, n, len(ciphertext)) // Decrypt it plaintext, err := f.cfs.DecryptBlocks(ciphertext) @@ -107,6 +107,8 @@ func (f *file) Read(buf []byte, off int64) (resultData fuse.ReadResult, code fus // Write - FUSE call func (f *file) Write(data []byte, off int64) (uint32, fuse.Status) { + cryptfs.Debug.Printf("Write: offset=%d length=%d\n", off, len(data)) + var written uint32 var status fuse.Status dataBuf := bytes.NewBuffer(data) @@ -126,10 +128,12 @@ func (f *file) Write(data []byte, off int64) (uint32, fuse.Status) { } // Modify blockData = f.cfs.MergeBlocks(oldData, blockData, int(b.Offset)) + cryptfs.Debug.Printf("oldData=%d blockData=%d\n", len(oldData), len(blockData)) } // Write blockOffset, _ := b.CiphertextRange() blockData = f.cfs.EncryptBlock(blockData) + cryptfs.Debug.Printf("WriteAt offset=%d length=%d\n", blockOffset, len(blockData)) _, err := f.fd.WriteAt(blockData, int64(blockOffset)) if err != nil { -- cgit v1.2.3