mirror of
https://github.com/ceph/go-ceph
synced 2025-02-18 11:46:52 +00:00
cephfs: use common error extraction function
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
887dec1c50
commit
72ea0669c2
@ -10,19 +10,19 @@ import "C"
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/ceph/go-ceph/errutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type cephError int
|
type cephError int
|
||||||
|
|
||||||
func (e cephError) Error() string {
|
func (e cephError) Error() string {
|
||||||
if e == 0 {
|
errno, s := errutil.FormatErrno(int(e))
|
||||||
return fmt.Sprintf("cephfs: no error given")
|
if s == "" {
|
||||||
|
return fmt.Sprintf("cephfs: ret=%d", errno)
|
||||||
}
|
}
|
||||||
err := syscall.Errno(uint(math.Abs(float64(e))))
|
return fmt.Sprintf("cephfs: ret=%d, %s", errno, s)
|
||||||
return fmt.Sprintf("cephfs: ret=(%d) %v", e, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MountInfo exports ceph's ceph_mount_info from libcephfs.cc
|
// MountInfo exports ceph's ceph_mount_info from libcephfs.cc
|
||||||
|
Loading…
Reference in New Issue
Block a user