Added FUSE support #55
9
fuse.go
9
fuse.go
@ -256,6 +256,10 @@ func (fh *bytesFileWriteHandle) Write(ctx context.Context, data []byte, off int6
|
||||
|
||||
var _ = (fs.FileFlusher)((*bytesFileWriteHandle)(nil))
|
||||
func (fh *bytesFileWriteHandle) Flush(ctx context.Context) (errno syscall.Errno) {
|
||||
if len(fh.content) == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
log.Info("Attempting flush").Str("path", fh.path).Send()
|
||||
fp, err := myfs.Create(fh.path, uint32(len(fh.content)))
|
||||
if err != nil {
|
||||
@ -268,6 +272,11 @@ func (fh *bytesFileWriteHandle) Flush(ctx context.Context) (errno syscall.Errno)
|
||||
fp.Close()
|
||||
return syscall.EROFS
|
||||
}
|
||||
if int(nread) != len(fh.content) {
|
||||
log.Error("Flush failed: write").Str("path", fh.path).Int("expect", len(fh.content)).Int("got", int(nread)).Send()
|
||||
fp.Close()
|
||||
return syscall.EROFS
|
||||
}
|
||||
err = fp.Close()
|
||||
if err != nil {
|
||||
log.Error("Flush failed: close").Str("path", fh.path).Err(err).Send()
|
||||
|
Loading…
Reference in New Issue
Block a user