]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
core: make the conversion from wire error to host OS work 15780/head
authorWillem Jan Withagen <wjw@digiware.nl>
Tue, 20 Jun 2017 13:52:06 +0000 (15:52 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Wed, 5 Jul 2017 09:39:50 +0000 (11:39 +0200)
 - The key change is the type of rval,
   that will call the conversion when en/decoded
 - Remainder is fixes for the type change and promotions

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/common/freebsd_errno.cc
src/include/types.h
src/osd/osd_types.h

index 77f6df91e9b921c5027a30856dbd2ff4ddb564be..259ce7be796ff1b423541c749dbfc4ca7210be0c 100644 (file)
@@ -201,7 +201,7 @@ __s32 ceph_to_hostos_errno(__s32 r)
 {
   int sign = (r < 0 ? -1 : 1);
   int err = std::abs(r);
-  if (err < 256 && hostos_to_ceph_conv[err] !=0 ) {
+  if (err < 256 && ceph_to_hostos_conv[err] !=0 ) {
     err = ceph_to_hostos_conv[err];
   }
   return err * sign;
index deb794cbdfd703ed2e0d2b5fbd3a49fdf12f5c23..371f884f82e85183b04b1771e0a6d1bbb3ad1833 100644 (file)
@@ -489,10 +489,13 @@ struct errorcode32_t {
   // cppcheck-suppress noExplicitConstructor
   errorcode32_t(int32_t i) : code(i) {}
 
-  operator int() const { return code; }
-  int operator==(int i) {
-    return code==i;
-  }
+  operator int() const  { return code; }
+  int* operator&()      { return &code; }
+  int operator==(int i) { return code == i; }
+  int operator>(int i)  { return code > i; }
+  int operator>=(int i) { return code >= i; }
+  int operator<(int i)  { return code < i; }
+  int operator<=(int i) { return code <= i; }
 
   void encode(bufferlist &bl) const {
     __s32 newcode = hostos_to_ceph_errno(code);
index 182a01bdb3133f5687410c3add3f765b2f530027..a17d72372d58aa06a3ddb949e71e4fa281dd494d 100644 (file)
@@ -4797,7 +4797,7 @@ struct OSDOp {
   sobject_t soid;
 
   bufferlist indata, outdata;
-  int32_t rval;
+  errorcode32_t rval;
 
   OSDOp() : rval(0) {
     memset(&op, 0, sizeof(ceph_osd_op));