From: Danny Al-Gaaf Date: Fri, 1 Mar 2013 15:54:26 +0000 (+0100) Subject: osd/OSD.cc: use static_cast instead of C-Style cast X-Git-Tag: v0.59~54^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=054424bade412360c164cc6a8a0195548034a628;p=ceph.git osd/OSD.cc: use static_cast instead of C-Style cast Signed-off-by: Danny Al-Gaaf --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 8a4ea0350814..a2d4915a9279 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2282,7 +2282,7 @@ void OSD::heartbeat() bool OSD::heartbeat_reset(Connection *con) { - HeartbeatSession *s = (HeartbeatSession*)con->get_priv(); + HeartbeatSession *s = static_cast(con->get_priv()); if (s) { heartbeat_lock.Lock(); map::iterator p = heartbeat_peers.find(s->peer); @@ -2925,7 +2925,7 @@ void OSD::handle_command(MMonCommand *m) void OSD::handle_command(MCommand *m) { Connection *con = m->get_connection(); - Session *session = (Session *)con->get_priv(); + Session *session = static_cast(con->get_priv()); if (!session) { client_messenger->send_message(new MCommandReply(m, -EPERM), con); m->put(); @@ -3276,7 +3276,7 @@ bool OSD::heartbeat_dispatch(Message *m) break; case MSG_OSD_PING: - handle_osd_ping((MOSDPing*)m); + handle_osd_ping(static_cast(m)); break; case CEPH_MSG_OSD_MAP: @@ -3370,7 +3370,7 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type, authorizer_data, authorizer_reply, name, global_id, caps_info, session_key, &auid); if (isvalid) { - Session *s = (Session *)con->get_priv(); + Session *s = static_cast(con->get_priv()); if (!s) { s = new Session; con->set_priv(s->get()); @@ -3500,12 +3500,12 @@ void OSD::_dispatch(Message *m) // map and replication case CEPH_MSG_OSD_MAP: - handle_osd_map((MOSDMap*)m); + handle_osd_map(static_cast(m)); break; // osd case CEPH_MSG_SHUTDOWN: - session = (Session *)m->get_connection()->get_priv(); + session = static_cast(m->get_connection()->get_priv()); if (!session || session->entity_name.is_mon() || session->entity_name.is_osd()) @@ -3518,22 +3518,22 @@ void OSD::_dispatch(Message *m) break; case MSG_PGSTATSACK: - handle_pg_stats_ack((MPGStatsAck*)m); + handle_pg_stats_ack(static_cast(m)); break; case MSG_MON_COMMAND: - handle_command((MMonCommand*) m); + handle_command(static_cast(m)); break; case MSG_COMMAND: - handle_command((MCommand*) m); + handle_command(static_cast(m)); break; case MSG_OSD_SCRUB: - handle_scrub((MOSDScrub*)m); + handle_scrub(static_cast(m)); break; case MSG_OSD_REP_SCRUB: - handle_rep_scrub((MOSDRepScrub*)m); + handle_rep_scrub(static_cast(m)); break; // -- need OSDMap -- @@ -3819,7 +3819,7 @@ void OSD::handle_osd_map(MOSDMap *m) return; } - Session *session = (Session *)m->get_connection()->get_priv(); + Session *session = static_cast(m->get_connection()->get_priv()); if (session && !(session->entity_name.is_mon() || session->entity_name.is_osd())) { //not enough perms! m->put(); @@ -5205,7 +5205,7 @@ void OSD::handle_pg_log(OpRequestRef op) void OSD::handle_pg_info(OpRequestRef op) { - MOSDPGInfo *m = (MOSDPGInfo *)op->request; + MOSDPGInfo *m = static_cast(op->request); assert(m->get_header().type == MSG_OSD_PG_INFO); dout(7) << "handle_pg_info " << *m << " from " << m->get_source() << dendl; @@ -5300,7 +5300,7 @@ void OSD::handle_pg_trim(OpRequestRef op) void OSD::handle_pg_scan(OpRequestRef op) { - MOSDPGScan *m = (MOSDPGScan*)op->request; + MOSDPGScan *m = static_cast(op->request); assert(m->get_header().type == MSG_OSD_PG_SCAN); dout(10) << "handle_pg_scan " << *m << " from " << m->get_source() << dendl; @@ -5328,7 +5328,7 @@ void OSD::handle_pg_scan(OpRequestRef op) void OSD::handle_pg_backfill(OpRequestRef op) { - MOSDPGBackfill *m = (MOSDPGBackfill*)op->request; + MOSDPGBackfill *m = static_cast(op->request); assert(m->get_header().type == MSG_OSD_PG_BACKFILL); dout(10) << "handle_pg_backfill " << *m << " from " << m->get_source() << dendl; @@ -5838,7 +5838,7 @@ void OSDService::reply_op_error(OpRequestRef op, int err) void OSDService::reply_op_error(OpRequestRef op, int err, eversion_t v) { - MOSDOp *m = (MOSDOp*)op->request; + MOSDOp *m = static_cast(op->request); assert(m->get_header().type == CEPH_MSG_OSD_OP); int flags; flags = m->get_flags() & (CEPH_OSD_FLAG_ACK|CEPH_OSD_FLAG_ONDISK); @@ -5853,7 +5853,7 @@ void OSDService::reply_op_error(OpRequestRef op, int err, eversion_t v) void OSDService::handle_misdirected_op(PG *pg, OpRequestRef op) { - MOSDOp *m = (MOSDOp*)op->request; + MOSDOp *m = static_cast(op->request); assert(m->get_header().type == CEPH_MSG_OSD_OP); if (m->get_map_epoch() < pg->info.history.same_primary_since) { @@ -5872,7 +5872,7 @@ void OSDService::handle_misdirected_op(PG *pg, OpRequestRef op) void OSD::handle_op(OpRequestRef op) { - MOSDOp *m = (MOSDOp*)op->request; + MOSDOp *m = static_cast(op->request); assert(m->get_header().type == CEPH_MSG_OSD_OP); if (op_is_discardable(m)) { dout(10) << " discardable " << *m << dendl; @@ -5902,7 +5902,7 @@ void OSD::handle_op(OpRequestRef op) } // share our map with sender, if they're old _share_map_incoming(m->get_source(), m->get_connection(), m->get_map_epoch(), - (Session *)m->get_connection()->get_priv()); + static_cast(m->get_connection()->get_priv())); if (op->rmw_flags == 0) { int r = init_op_flags(op); @@ -6005,7 +6005,7 @@ void OSD::handle_op(OpRequestRef op) void OSD::handle_sub_op(OpRequestRef op) { - MOSDSubOp *m = (MOSDSubOp*)op->request; + MOSDSubOp *m = static_cast(op->request); assert(m->get_header().type == MSG_OSD_SUBOP); dout(10) << "handle_sub_op " << *m << " epoch " << m->map_epoch << dendl; @@ -6029,7 +6029,7 @@ void OSD::handle_sub_op(OpRequestRef op) // share our map with sender, if they're old _share_map_incoming(m->get_source(), m->get_connection(), m->map_epoch, - (Session*)m->get_connection()->get_priv()); + static_cast(m->get_connection()->get_priv())); if (service.splitting(pgid)) { waiting_for_pg[pgid].push_back(op); @@ -6045,7 +6045,7 @@ void OSD::handle_sub_op(OpRequestRef op) void OSD::handle_sub_op_reply(OpRequestRef op) { - MOSDSubOpReply *m = (MOSDSubOpReply*)op->request; + MOSDSubOpReply *m = static_cast(op->request); assert(m->get_header().type == MSG_OSD_SUBOPREPLY); if (m->get_map_epoch() < up_epoch) { dout(3) << "replica op reply from before up" << dendl; @@ -6066,7 +6066,7 @@ void OSD::handle_sub_op_reply(OpRequestRef op) // share our map with sender, if they're old _share_map_incoming(m->get_source(), m->get_connection(), m->get_map_epoch(), - (Session*)m->get_connection()->get_priv()); + static_cast(m->get_connection()->get_priv())); PG *pg = _have_pg(pgid) ? _lookup_pg(pgid) : NULL; if (!pg) { @@ -6302,7 +6302,7 @@ void OSD::handle_conf_change(const struct md_config_t *conf, int OSD::init_op_flags(OpRequestRef op) { - MOSDOp *m = (MOSDOp*)op->request; + MOSDOp *m = static_cast(op->request); vector::iterator iter; // client flags have no bearing on whether an op is a read, write, etc.