]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
core: introduce (and fix) code to pass errno to other OSes
authorWillem Jan Withagen <wjw@digiware.nl>
Mon, 5 Jun 2017 18:24:58 +0000 (20:24 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Fri, 9 Jun 2017 08:14:45 +0000 (10:14 +0200)
 - Some of the errno conversions were lost in the conversion
   to Cmake config
 - rename ceph_to_host_errno to _ceph_to_hostos_errno
   to indicate that the errnos are define per OS.

This is the second part, creating the basics.
Next it needs to be glued into communication with the peers.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/CMakeLists.txt
src/common/aix_errno.cc
src/common/darwin_errno.cc
src/common/solaris_errno.cc
src/include/types.h
src/messages/MClientReply.h
src/osdc/Objecter.cc

index 3582ad30a9b313aadf131796991b815068519640..03a976e1a7d0565029e9ac3f242ee55b7593c329 100644 (file)
@@ -537,6 +537,16 @@ set(libcommon_files
   ${auth_files}
   ${mds_files})
 
+if(FREEBSD)
+  list(APPEND libcommon_files common/freebsd_errno.cc)
+elseif(DARWIN)
+  list(APPEND libcommon_files common/darwin_errno.cc)
+elseif(SUN)
+  list(APPEND libcommon_files common/solaris_errno.cc)
+elseif(AIX)
+  list(APPEND libcommon_files common/aix_errno.cc)
+endif()
+
 if(HAVE_ARM)
   list(APPEND libcommon_files arch/arm.c)
 elseif(HAVE_INTEL)
index 48ef72826e161ba2c8c5a27dcc53021f0e234a82..7be7d1f3d3b62c5528223c82bca6a7198e4307cd 100644 (file)
@@ -17,7 +17,7 @@
 
 
 // converts from linux errno values to host values
-__s32 ceph_to_host_errno(__s32 r) 
+__s32 ceph_to_hostos_errno(__s32 r) 
 {
   if (r < -34) {
     switch (r) {
index 48372d0903598589c467c0071903a38d133c7a33..39c69c2a7eddcd9d4f301812d5056e82832ac343 100644 (file)
@@ -18,7 +18,7 @@
 
 
 // converts from linux errno values to host values
-__s32 ceph_to_host_errno(__s32 r)
+__s32 ceph_to_hostos_errno(__s32 r)
 {
   if (r < -34) {
     switch (r) {
index 9f899a32ff5bb0da5279928a4f0f50240b18aec2..6ee60921fe74a769222ca09d97635dcfcbb2bb31 100644 (file)
@@ -16,7 +16,7 @@
 
 
 // converts from linux errno values to host values
-__s32 ceph_to_host_errno(__s32 r) 
+__s32 ceph_to_hostos_errno(__s32 r) 
 {
   if (r < -34) {
     switch (r) {
index ee097718d94491d72e08a3275fcdc601a2f31510..deb794cbdfd703ed2e0d2b5fbd3a49fdf12f5c23 100644 (file)
@@ -474,12 +474,12 @@ WRITE_EQ_OPERATORS_1(shard_id_t, id)
 WRITE_CMP_OPERATORS_1(shard_id_t, id)
 ostream &operator<<(ostream &lhs, const shard_id_t &rhs);
 
-#if defined(__sun) || defined(_AIX) || defined(DARWIN)
-__s32  ceph_to_host_errno(__s32 e);
-__s32  host_to_ceph_errno(__s32 e);
+#if defined(__sun) || defined(_AIX) || defined(DARWIN) || defined(__FreeBSD__)
+__s32  ceph_to_hostos_errno(__s32 e);
+__s32  hostos_to_ceph_errno(__s32 e);
 #else
-#define  ceph_to_host_errno(e) (e)
-#define  host_to_ceph_errno(e) (e)
+#define  ceph_to_hostos_errno(e) (e)
+#define  hostos_to_ceph_errno(e) (e)
 #endif
 
 struct errorcode32_t {
@@ -495,12 +495,12 @@ struct errorcode32_t {
   }
 
   void encode(bufferlist &bl) const {
-    __s32 newcode = host_to_ceph_errno(code);
+    __s32 newcode = hostos_to_ceph_errno(code);
     ::encode(newcode, bl);
   }
   void decode(bufferlist::iterator &bl) {
     ::decode(code, bl);
-    code = ceph_to_host_errno(code);
+    code = ceph_to_hostos_errno(code);
   }
 };
 WRITE_CLASS_ENCODER(errorcode32_t)
index dc7e7e342b77eb5c72baf79dc6934858d3a194d8..228db2f9daf687d96983ab225b6d64a5ce14272a 100644 (file)
@@ -214,7 +214,7 @@ public:
   epoch_t get_mdsmap_epoch() const { return head.mdsmap_epoch; }
 
   int get_result() const {
-    return ceph_to_host_errno((__s32)(__u32)head.result);
+    return ceph_to_hostos_errno((__s32)(__u32)head.result);
   }
 
   void set_result(int r) { head.result = r; }
index 6582aec99e4c8c71b612200e57aa2eeaffe2ac56..fc302432b678b395db124658e2f67d59380a7bd9 100644 (file)
@@ -3465,10 +3465,10 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
     // set rval before running handlers so that handlers
     // can change it if e.g. decoding fails
     if (*pr)
-      **pr = ceph_to_host_errno(p->rval);
+      **pr = ceph_to_hostos_errno(p->rval);
     if (*ph) {
       ldout(cct, 10) << " op " << i << " handler " << *ph << dendl;
-      (*ph)->complete(ceph_to_host_errno(p->rval));
+      (*ph)->complete(ceph_to_hostos_errno(p->rval));
       *ph = NULL;
     }
   }