|
|
@ -1,7 +1,9 @@ |
|
|
|
package mount |
|
|
|
|
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"context" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
|
|
|
|
"github.com/hanwen/go-fuse/v2/fuse" |
|
|
@ -50,6 +52,23 @@ func (wfs *WFS) Read(cancel <-chan struct{}, in *fuse.ReadIn, buff []byte) (fuse |
|
|
|
return nil, fuse.EIO |
|
|
|
} |
|
|
|
|
|
|
|
if IsDebug { |
|
|
|
// print(".")
|
|
|
|
mirrorData := make([]byte, totalRead) |
|
|
|
fh.mirrorFile.ReadAt(mirrorData, offset) |
|
|
|
if bytes.Compare(mirrorData, buff[:totalRead]) != 0 { |
|
|
|
|
|
|
|
againBuff := make([]byte, len(buff)) |
|
|
|
againRead, _ := readDataByFileHandle(buff, fh, offset) |
|
|
|
againCorrect := bytes.Compare(mirrorData, againBuff[:againRead]) == 0 |
|
|
|
againSame := bytes.Compare(buff[:totalRead], againBuff[:againRead]) == 0 |
|
|
|
|
|
|
|
fmt.Printf("\ncompare %v [%d,%d) size:%d againSame:%v againCorrect:%v\n", fh.mirrorFile.Name(), offset, offset+totalRead, totalRead, againSame, againCorrect) |
|
|
|
//fmt.Printf("read mirrow data: %v\n", mirrorData)
|
|
|
|
//fmt.Printf("read actual data: %v\n", buff[:totalRead])
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return fuse.ReadResultData(buff[:totalRead]), fuse.OK |
|
|
|
} |
|
|
|
|
|
|
|