From c0339327bee545c368314d278e9e4cd5918c70aa Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 20 Oct 2024 12:34:54 +0100 Subject: [PATCH] vfs: add ELOOP error --- cmd/cmount/fs.go | 2 ++ cmd/mount/fs.go | 2 ++ cmd/mount2/fs.go | 2 ++ vfs/errors.go | 4 +++- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.go index c9dd2cb16..2424e360e 100644 --- a/cmd/cmount/fs.go +++ b/cmd/cmount/fs.go @@ -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 diff --git a/cmd/mount/fs.go b/cmd/mount/fs.go index 66029bff0..9872a99e2 100644 --- a/cmd/mount/fs.go +++ b/cmd/mount/fs.go @@ -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 diff --git a/cmd/mount2/fs.go b/cmd/mount2/fs.go index 4aa9afcd0..03f907ee8 100644 --- a/cmd/mount2/fs.go +++ b/cmd/mount2/fs.go @@ -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 diff --git a/vfs/errors.go b/vfs/errors.go index f5775af10..c54b4dd91 100644 --- a/vfs/errors.go +++ b/vfs/errors.go @@ -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 ( @@ -20,6 +20,7 @@ const ( EBADF EROFS ENOSYS + ELOOP ) // Errors which have exact counterparts in os @@ -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