cephfs: made ENOENT a public error

this commit renames ErrNoEntry of cephfs
to ErrNotExist and making it public allowing
other projects to access this.

Signed-off-by: Riya Singhal <rsinghal@redhat.com>
This commit is contained in:
Riya Singhal 2023-11-09 13:35:12 +05:30 committed by mergify[bot]
parent 51b8287148
commit 2852a13c88
2 changed files with 4 additions and 3 deletions

View File

@ -54,6 +54,8 @@ const (
// ErrNotConnected may be returned when client is not connected // ErrNotConnected may be returned when client is not connected
// to a cluster. // to a cluster.
ErrNotConnected = cephFSError(-C.ENOTCONN) ErrNotConnected = cephFSError(-C.ENOTCONN)
// ErrNotExist indicates a non-specific missing resource.
ErrNotExist = cephFSError(-C.ENOENT)
) )
// Private errors: // Private errors:
@ -61,6 +63,5 @@ const (
const ( const (
errInvalid = cephFSError(-C.EINVAL) errInvalid = cephFSError(-C.EINVAL)
errNameTooLong = cephFSError(-C.ENAMETOOLONG) errNameTooLong = cephFSError(-C.ENAMETOOLONG)
errNoEntry = cephFSError(-C.ENOENT)
errRange = cephFSError(-C.ERANGE) errRange = cephFSError(-C.ERANGE)
) )

View File

@ -53,7 +53,7 @@ func TestRemoveDir(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
_, err = mount.Statx(dirname, StatxBasicStats, 0) _, err = mount.Statx(dirname, StatxBasicStats, 0)
assert.Equal(t, err, errNoEntry) assert.Equal(t, err, ErrNotExist)
} }
func TestLink(t *testing.T) { func TestLink(t *testing.T) {
@ -367,7 +367,7 @@ func TestStatx(t *testing.T) {
st, err = mount.Statx(dirname, StatxBasicStats, 0) st, err = mount.Statx(dirname, StatxBasicStats, 0)
assert.Error(t, err) assert.Error(t, err)
assert.Nil(t, st) assert.Nil(t, st)
assert.Equal(t, errNoEntry, err) assert.Equal(t, ErrNotExist, err)
}) })
t.Run("invalidMount", func(t *testing.T) { t.Run("invalidMount", func(t *testing.T) {