From: Ulrich Weigand Date: Mon, 2 Sep 2019 19:25:12 +0000 (+0200) Subject: msg: Fix incorrect use of __le16/32/64 X-Git-Tag: v14.2.5~173^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0fb4d226d989d4ce3e623d098a517c12cb7c373a;p=ceph.git msg: Fix incorrect use of __le16/32/64 Use ceph_le16/32/64 instead of __le16/32/64 (which are no-op outside of kernel code). Fixes (partially): https://tracker.ceph.com/issues/41605 Signed-off-by: Ulrich Weigand (cherry picked from commit ede1e851604bb55db4cc29f56ae9520c5d1ec727) Changes from cherry-picked commit: - Additional changes in src/msg/xio/XioMsg.h were necessary (the file was deleted in mainline). Signed-off-by: Ulrich Weigand --- diff --git a/src/msg/async/frames_v2.h b/src/msg/async/frames_v2.h index 9975b74aa9fc..b08943c5e5cc 100644 --- a/src/msg/async/frames_v2.h +++ b/src/msg/async/frames_v2.h @@ -62,8 +62,8 @@ struct segment_t { static constexpr __le16 DEFAULT_ALIGNMENT = sizeof(void *); - __le32 length; - __le16 alignment; + ceph_le32 length; + ceph_le16 alignment; } __attribute__((packed)); struct SegmentIndex { @@ -102,7 +102,7 @@ struct preamble_block_t { __u8 _reserved[2]; // CRC32 for this single preamble block. - __le32 crc; + ceph_le32 crc; } __attribute__((packed)); static_assert(sizeof(preamble_block_t) % CRYPTO_BLOCK_SIZE == 0); static_assert(std::is_standard_layout::value); @@ -128,7 +128,7 @@ static_assert(std::is_standard_layout::value); // frame abortion facility. struct epilogue_plain_block_t { __u8 late_flags; - std::array<__le32, MAX_NUM_SEGMENTS> crc_values; + std::array crc_values; } __attribute__((packed)); static_assert(std::is_standard_layout::value); diff --git a/src/msg/msg_types.h b/src/msg/msg_types.h index 070532e7d58e..74d5ee30f594 100644 --- a/src/msg/msg_types.h +++ b/src/msg/msg_types.h @@ -154,8 +154,8 @@ namespace std { // define a wire format for sockaddr that matches Linux's. struct ceph_sockaddr_storage { - __le16 ss_family; - __u8 __ss_padding[128 - sizeof(__le16)]; + ceph_le16 ss_family; + __u8 __ss_padding[128 - sizeof(ceph_le16)]; void encode(bufferlist& bl) const { struct ceph_sockaddr_storage ss = *this; diff --git a/src/msg/xio/XioMsg.h b/src/msg/xio/XioMsg.h index 99968fd9fb89..2f0c84902b66 100644 --- a/src/msg/xio/XioMsg.h +++ b/src/msg/xio/XioMsg.h @@ -33,7 +33,7 @@ class XioMessenger; class XioMsgCnt { public: - __le32 msg_cnt; + ceph_le32 msg_cnt; buffer::list bl; public: explicit XioMsgCnt(buffer::ptr p) @@ -48,8 +48,8 @@ class XioMsgHdr { public: char tag; - __le32 msg_cnt; - __le32 peer_type; + ceph_le32 msg_cnt; + ceph_le32 peer_type; entity_addr_t addr; /* XXX hack! */ ceph_msg_header* hdr; ceph_msg_footer* ftr; @@ -57,7 +57,7 @@ public: buffer::list bl; public: XioMsgHdr(ceph_msg_header& _hdr, ceph_msg_footer& _ftr, uint64_t _features) - : tag(CEPH_MSGR_TAG_MSG), msg_cnt(0), hdr(&_hdr), ftr(&_ftr), + : tag(CEPH_MSGR_TAG_MSG), msg_cnt(init_le32(0)), hdr(&_hdr), ftr(&_ftr), features(_features) { }