From patchwork Wed May 15 14:56:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 2573441 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D46CF3FC5A for ; Wed, 15 May 2013 14:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932340Ab3EOO5a (ORCPT ); Wed, 15 May 2013 10:57:30 -0400 Received: from m53-178.qiye.163.com ([123.58.178.53]:52623 "EHLO m53-178.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932197Ab3EOO5a (ORCPT ); Wed, 15 May 2013 10:57:30 -0400 Received: from localhost.localdomain (unknown [118.249.118.73]) by m53-178.qiye.163.com (HMail) with ESMTPA id 8507B13A80BB; Wed, 15 May 2013 22:57:24 +0800 (CST) From: Li Wang To: Cc: Sage Weil , Yehuda Sadeh , Li Wang , Yunchuan Wen Subject: [PATCH] Fix some little/big endian issues Date: Wed, 15 May 2013 22:56:04 +0800 Message-Id: <1368629764-10838-1-git-send-email-liwang@ubuntukylin.com> X-Mailer: git-send-email 1.7.9.5 X-HM-Spam-Status: e1koWUFPN1dZCBgUCR5ZQUpCVU5PQkJCQklITEtNS05PTFdZCQ4XHghZQVkoKz0kKzooKCQyNSQz Pjo*PilBS1VLQDYjJCI#KCQyNSQzPjo*PilBS1VLQCsvKSQ1NCQyNSQzPjo*PilBSVVLQDg0LjUv KSIkODVBS1VLQCk#PDI0NSQ6KDI6QUtVS0ArKTQtMjU4PiQzLjU6NUFLVUtAPyI1OjYyOCQyKyQi PigkMjUkMz46Pz4pQUlVS0ApPjo3JDIrJDI1JCk5NyQyNSQzPjo*PilBSklVS0A2LjcvMiQpOCsv JD8yPT0#KT41LyQyNSQzPjo*PilBSVVLQDIrJEokNjI1Li8#JDg1LyRLJEpLQUtVS0AyKyROJDYy NS4vPiQ4NS8kSyRKS0FLVUtAMiskSEskNjI1Li8#JDg1LyRLJE5LQUtVS0AyKyRKJDM0LikkODUv JEskSktLQUtVS0AyKyQvND86IiQ4NS8kSyRKS0tBS1VLQCguOSQ#QUpVTk5ZBg++ X-HM-Sender-Digest: e1kSHx4VD1lBWUc6MQg6Cjo4LDo4EDorKjhIOj4qOkMwCjFVSlVKSE1DTUlCQ09PQ05MVTMWGhIX VRcSDBoVHDsOGQ4VDw4QAhcSFVUYFBZFWVdZDB4ZWUEdGhcIHgY+ Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Ceph uses little endian, this patch fixes some endian issues while Ceph running on big endian machine. Signed-off-by: Yunchuan Wen Signed-off-by: Li Wang --- src/include/encoding.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/include/encoding.h b/src/include/encoding.h index eb445e3..67c9af5 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -88,11 +88,12 @@ inline void decode(bool &v, bufferlist::iterator& p) { #define WRITE_INTTYPE_ENCODER(type, etype) \ inline void encode(type v, bufferlist& bl, uint64_t features=0) { \ - __##etype e = init_##etype(v); \ + ceph_##etype e; \ + e = v; \ encode_raw(e, bl); \ } \ inline void decode(type &v, bufferlist::iterator& p) { \ - __##etype e; \ + ceph_##etype e; \ decode_raw(e, p); \ v = e; \ } @@ -338,7 +339,7 @@ inline void encode(const std::list& ls, bufferlist& bl) n++; encode(*p, bl); } - __le32 en; + ceph_le32 en; en = n; bl.copy_in(pos, sizeof(en), (char*)&en); } else { @@ -373,7 +374,7 @@ inline void encode(const std::list >& ls, bufferlist& bl n++; encode(**p, bl); } - __le32 en; + ceph_le32 en; en = n; bl.copy_in(pos, sizeof(en), (char*)&en); } else { @@ -696,7 +697,8 @@ inline void decode(std::deque& ls, bufferlist::iterator& p) __u8 struct_v = v, struct_compat = compat; \ ::encode(struct_v, bl); \ ::encode(struct_compat, bl); \ - __le32 struct_len = 0; \ + ceph_le32 struct_len; \ + struct_len = 0; \ ::encode(struct_len, bl); \ buffer::list::iterator struct_len_it = bl.end(); \ struct_len_it.advance(-4); \