mirror of https://github.com/ceph/go-ceph
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 (
|
||||
"fmt"
|
||||
"math"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ceph/go-ceph/errutil"
|
||||
)
|
||||
|
||||
type cephError int
|
||||
|
||||
func (e cephError) Error() string {
|
||||
if e == 0 {
|
||||
return fmt.Sprintf("cephfs: no error given")
|
||||
errno, s := errutil.FormatErrno(int(e))
|
||||
if s == "" {
|
||||
return fmt.Sprintf("cephfs: ret=%d", errno)
|
||||
}
|
||||
err := syscall.Errno(uint(math.Abs(float64(e))))
|
||||
return fmt.Sprintf("cephfs: ret=(%d) %v", e, err)
|
||||
return fmt.Sprintf("cephfs: ret=%d, %s", errno, s)
|
||||
}
|
||||
|
||||
// MountInfo exports ceph's ceph_mount_info from libcephfs.cc
|
||||
|
|
Loading…
Reference in New Issue