Permalink
Browse files

some fixes on x86

  • Loading branch information...
1 parent f2d52d3 commit 4699935a273fbb2b5d43d619ad417ac2f551d09c @liewegas liewegas committed Feb 1, 2008
Showing with 16 additions and 12 deletions.
  1. +10 −10 src/msg/Message.h
  2. +2 −2 src/msg/SimpleMessenger.cc
  3. +4 −0 src/msg/msg_types.h
View
@@ -154,20 +154,20 @@ class Message {
void set_seq(unsigned s) { env.seq = cpu_to_le64(s); }
// source/dest
- entity_inst_t& get_dest_inst() { return *(entity_inst_t*)&env.dst; }
- void set_dest_inst(entity_inst_t& inst) { env.dst = *(ceph_entity_inst*)&inst; }
+ entity_inst_t get_dest_inst() { return entity_inst_t(env.dst); }
+ void set_dest_inst(entity_inst_t& inst) { env.dst = inst; }
- entity_inst_t& get_source_inst() { return *(entity_inst_t*)&env.src; }
- void set_source_inst(entity_inst_t& inst) { env.src = *(ceph_entity_inst*)&inst; }
+ entity_inst_t get_source_inst() { return entity_inst_t(env.src); }
+ void set_source_inst(entity_inst_t& inst) { env.src = inst; }
- entity_name_t& get_dest() { return *(entity_name_t*)&env.dst.name; }
- void set_dest(entity_name_t a) { env.dst.name = *(ceph_entity_name*)&a; }
+ entity_name_t get_dest() { return entity_name_t(env.dst.name); }
+ void set_dest(entity_name_t a) { env.dst.name = a; }
- entity_name_t& get_source() { return *(entity_name_t*)&env.src.name; }
- void set_source(entity_name_t a) { env.src.name = *(ceph_entity_name*)&a; }
+ entity_name_t get_source() { return entity_name_t(env.src.name); }
+ void set_source(entity_name_t a) { env.src.name = a; }
- entity_addr_t& get_source_addr() { return *(entity_addr_t*)&env.src.addr; }
- void set_source_addr(const entity_addr_t &i) { env.src.addr = *(ceph_entity_addr*)&i; }
+ entity_addr_t get_source_addr() { return entity_addr_t(env.src.addr); }
+ void set_source_addr(const entity_addr_t &i) { env.src.addr = i; }
// virtual bits
virtual void decode_payload() = 0;
@@ -1447,8 +1447,8 @@ Message *Rank::Pipe::read_message()
// read data
bufferlist data;
- int data_len = le32_to_cpu(env.data_len);
- int data_off = le32_to_cpu(env.data_off);
+ unsigned data_len = le32_to_cpu(env.data_len);
+ unsigned data_off = le32_to_cpu(env.data_off);
if (data_len) {
int left = data_len;
if (data_off & ~PAGE_MASK) {
View
@@ -185,6 +185,10 @@ struct entity_inst_t {
entity_inst_t(entity_name_t n, const entity_addr_t& a) : name(n), addr(a) {}
entity_inst_t(const ceph_entity_inst& i) : name(i.name), addr(i.addr) { }
entity_inst_t(const ceph_entity_name& n, const ceph_entity_addr &a) : name(n), addr(a) {}
+ operator ceph_entity_inst() {
+ ceph_entity_inst i = {name, addr};
+ return i;
+ }
};

0 comments on commit 4699935

Please sign in to comment.