template<typename T>
struct ceph_le {
+private:
T v;
+public:
ceph_le<T>& operator=(T nv) {
v = mswab(nv);
return *this;
}
operator T() const { return mswab(v); }
+ friend inline bool operator==(ceph_le a, ceph_le b) {
+ return a.v == b.v;
+ }
} __attribute__ ((packed));
-template<typename T>
-inline bool operator==(ceph_le<T> a, ceph_le<T> b) {
- return a.v == b.v;
-}
-
using ceph_le64 = ceph_le<__u64>;
using ceph_le32 = ceph_le<__u32>;
using ceph_le16 = ceph_le<__u16>;
copy_from_legacy_head(struct ceph_mds_request_head *head,
struct ceph_mds_request_head_legacy *legacy)
{
- memcpy(&(head->oldest_client_tid), legacy, sizeof(*legacy));
+ struct ceph_mds_request_head_legacy *embedded_legacy =
+ (struct ceph_mds_request_head_legacy *)&head->oldest_client_tid;
+ *embedded_legacy = *legacy;
}
static inline void
copy_to_legacy_head(struct ceph_mds_request_head_legacy *legacy,
struct ceph_mds_request_head *head)
{
- memcpy(legacy, &(head->oldest_client_tid), sizeof(*legacy));
+ struct ceph_mds_request_head_legacy *embedded_legacy =
+ (struct ceph_mds_request_head_legacy *)&head->oldest_client_tid;
+ *legacy = *embedded_legacy;
}
/* client reply */
struct ceph_timespec mtime, atime, ctime;
struct ceph_file_layout layout;
__le32 time_warp_seq;
- };
+ } __attribute__ ((packed));
/* export message */
struct ceph_mds_cap_peer peer;
- };
+ } __attribute__ ((packed));
} __attribute__ ((packed));
/* cap release msg head */
__le32 chunk_size;
__u8 type; /* CEPH_OSD_CHECKSUM_OP_TYPE_* */
} __attribute__ ((packed)) checksum;
- };
+ } __attribute__ ((packed));
__le32 payload_len;
} __attribute__ ((packed));
// third to #segments - MAX_NUM_SEGMENTS and so on.
__u8 num_segments;
- std::array<segment_t, MAX_NUM_SEGMENTS> segments;
+ segment_t segments[MAX_NUM_SEGMENTS];
__u8 _reserved[2];
// CRC32 for this single preamble block.
// frame abortion facility.
struct epilogue_plain_block_t {
__u8 late_flags;
- std::array<ceph_le32, MAX_NUM_SEGMENTS> crc_values;
+ ceph_le32 crc_values[MAX_NUM_SEGMENTS];
} __attribute__((packed));
static_assert(std::is_standard_layout<epilogue_plain_block_t>::value);
};
ceph::bufferlist::contiguous_filler preamble_filler;
- __u8 calc_num_segments(
- const std::array<segment_t, MAX_NUM_SEGMENTS>& segments)
+ __u8 calc_num_segments(const segment_t segments[])
{
for (__u8 num = SegmentsNumV; num > 0; num--) {
if (segments[num-1].length) {
// implementation detail: the first bufferlist of Frame::segments carries
// space for preamble. This glueing isn't a part of the onwire format but
// just our private detail.
- main_preamble.segments.front().length =
- segments.front().length() - FRAME_PREAMBLE_SIZE;
- main_preamble.segments.front().alignment = alignments.front();
+ main_preamble.segments[0].length =
+ segments[0].length() - FRAME_PREAMBLE_SIZE;
+ main_preamble.segments[0].alignment = alignments[0];
// there is no business in issuing frame without at least one segment
// filled.
union {
struct {
ceph_le32 hint_type; //OP_COLL_HINT
- };
+ } __attribute__ ((packed));
struct {
ceph_le32 alloc_hint_flags; //OP_SETALLOCHINT
- };
- };
+ } __attribute__ ((packed));
+ } __attribute__ ((packed));
ceph_le64 expected_object_size; //OP_SETALLOCHINT
ceph_le64 expected_write_size; //OP_SETALLOCHINT
ceph_le32 split_bits; //OP_SPLIT_COLLECTION2,OP_COLL_SET_BITS,