Skip to content

Commit

Permalink
cgofuse: more consistent (un)mount error format
Browse files Browse the repository at this point in the history
  • Loading branch information
djdv committed May 19, 2023
1 parent b566107 commit 69e6a04
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions internal/filesystem/cgofuse/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const (
idOptionBody = `id=`
optionDelimiter = ','
delimiterSize = len(string(optionDelimiter))

syscallFailedFmt = "%s returned `false` for \"%s\"" +
" - system log may have more information"
)

func (close closer) Close() error { return close() }
Expand Down Expand Up @@ -161,8 +164,10 @@ func (mh *Host) Mount(fsys fs.FS) (io.Closer, error) {
if fuseHost.Unmount() {
return nil
}
return fmt.Errorf(`unmounting "%s" failed`+
" - system log may have more information", mountPoint)
return fmt.Errorf(
syscallFailedFmt,
"unmount", mountPoint,
)
}), nil
}

Expand Down Expand Up @@ -191,8 +196,10 @@ func safeMount(fuseSys *fuse.FileSystemHost, target string, args []string) error
close(errs)
}()
if !fuseSys.Mount(target, args) {
err := fmt.Errorf(`failed to mount "%s" for an unknown reason`+
"- system log may have more information", target)
err := fmt.Errorf(
syscallFailedFmt,
"mount", target,
)
errs <- err
}
}()
Expand Down

0 comments on commit 69e6a04

Please sign in to comment.