mirror of
https://github.com/ceph/go-ceph
synced 2024-12-22 06:10:09 +00:00
ab45bcd33a
There are backports created for fallocate API changes[1] that got merged recently. Considering the time taken for these backports to get in to release branches and finally as a released version we create a separate test file to have more fine grained control over various pre-release CI jobs with the help of corresponding build tags. Modification of build tags should go hand-in-hand with the version detection logic used in file_test.go once a backport is available in released version. [1] https://github.com/ceph/ceph/pull/59725 Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package cephfs
|
|
|
|
/*
|
|
#include <errno.h>
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/ceph/go-ceph/internal/errutil"
|
|
)
|
|
|
|
func getError(e C.int) error {
|
|
return errutil.GetError("cephfs", int(e))
|
|
}
|
|
|
|
// getErrorIfNegative converts a ceph return code to error if negative.
|
|
// This is useful for functions that return a usable positive value on
|
|
// success but a negative error number on error.
|
|
func getErrorIfNegative(ret C.int) error {
|
|
if ret >= 0 {
|
|
return nil
|
|
}
|
|
return getError(ret)
|
|
}
|
|
|
|
// Public go errors:
|
|
|
|
var (
|
|
// ErrEmptyArgument may be returned if a function argument is passed
|
|
// a zero-length slice or map.
|
|
ErrEmptyArgument = errors.New("Argument must contain at least one item")
|
|
|
|
// ErrNotConnected may be returned when client is not connected
|
|
// to a cluster.
|
|
ErrNotConnected = getError(-C.ENOTCONN)
|
|
// ErrNotExist indicates a non-specific missing resource.
|
|
ErrNotExist = getError(-C.ENOENT)
|
|
// ErrOpNotSupported is returned in general for operations that are not
|
|
// supported.
|
|
ErrOpNotSupported = getError(-C.EOPNOTSUPP)
|
|
|
|
// Private errors:
|
|
|
|
errInvalid = getError(-C.EINVAL)
|
|
errNameTooLong = getError(-C.ENAMETOOLONG)
|
|
errRange = getError(-C.ERANGE)
|
|
)
|