Skip to content

Commit

Permalink
vfs: add ELOOP error
Browse files Browse the repository at this point in the history
  • Loading branch information
ncw committed Dec 13, 2024
1 parent 353bc31 commit c033932
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/cmount/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ func translateError(err error) (errc int) {
return -fuse.ENOSYS
case vfs.EINVAL:
return -fuse.EINVAL
case vfs.ELOOP:
return -fuse.ELOOP
}
fs.Errorf(nil, "IO error: %v", err)
return -fuse.EIO
Expand Down
2 changes: 2 additions & 0 deletions cmd/mount/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func translateError(err error) error {
return syscall.ENOSYS
case vfs.EINVAL:
return fuse.Errno(syscall.EINVAL)
case vfs.ELOOP:
return fuse.Errno(syscall.ELOOP)
}
fs.Errorf(nil, "IO error: %v", err)
return err
Expand Down
2 changes: 2 additions & 0 deletions cmd/mount2/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ func translateError(err error) syscall.Errno {
return syscall.ENOSYS
case vfs.EINVAL:
return syscall.EINVAL
case vfs.ELOOP:
return syscall.ELOOP
}
fs.Errorf(nil, "IO error: %v", err)
return syscall.EIO
Expand Down
4 changes: 3 additions & 1 deletion vfs/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// Error describes low level errors in a cross platform way.
type Error byte

// NB if changing errors translateError in cmd/mount/fs.go, cmd/cmount/fs.go
// NB if changing errors, update translateError in cmd/mount/fs.go, cmd/cmount/fs.go, cmd/mount2/fs.go

// Low level errors
const (
Expand All @@ -20,6 +20,7 @@ const (
EBADF
EROFS
ENOSYS
ELOOP
)

// Errors which have exact counterparts in os
Expand All @@ -38,6 +39,7 @@ var errorNames = []string{
EBADF: "Bad file descriptor",
EROFS: "Read only file system",
ENOSYS: "Function not implemented",
ELOOP: "Too many symbolic links",
}

// Error renders the error as a string
Expand Down

0 comments on commit c033932

Please sign in to comment.