Added FUSE support #55

Merged
Elara6331 merged 65 commits from yannickulrich/itd:fuse into master 2023-03-25 22:23:52 +00:00
1 changed files with 10 additions and 3 deletions
Showing only changes of commit dc53ead339 - Show all commits

View File

@ -298,9 +298,6 @@ 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
}
yannickulrich marked this conversation as resolved Outdated
- log.Info("Progress").Int("bytes", int(sent)).Int("of", len(fh.content)).Send()
+ log.Info("FUSE Write Progress").Int("bytes", int(sent)).Int("total", len(fh.content)).Send()
```diff - log.Info("Progress").Int("bytes", int(sent)).Int("of", len(fh.content)).Send() + log.Info("FUSE Write Progress").Int("bytes", int(sent)).Int("total", len(fh.content)).Send()

Done in b5328ec

Done in b5328ec
log.Debug("FUSE Attempting flush").Str("path", fh.path).Send()
yannickulrich marked this conversation as resolved Outdated

This is not correct. If no content has been written, you should still create the file because the user might want to create an empty file using a command like touch.

This is not correct. If no content has been written, you should still create the file because the user might want to create an empty file using a command like `touch`.

Oh, good point, thank you. Should be fixed now.

Oh, good point, thank you. Should be fixed now.
fp, err := myfs.Create(fh.path, uint32(len(fh.content)))
@ -309,6 +306,16 @@ func (fh *bytesFileWriteHandle) Flush(ctx context.Context) (errno syscall.Errno)
return syscallErr(err)
}
if len(fh.content) == 0 {
log.Debug("FUSE Flush no data to write").Str("path", fh.path).Send()
err = fp.Close()
if err != nil {
log.Error("FUSE Flush failed during close").Str("path", fh.path).Err(err).Send()
return syscallErr(err)
}
return 0
}
go func() {
// For every progress event
for sent := range fp.Progress() {