switch (m->get_type()) {
// mounting and mds sessions
case CEPH_MSG_MDS_MAP:
- handle_mds_map(MMDSMap::msgref_cast(m));
+ handle_mds_map(ref_cast<MMDSMap>(m));
break;
case CEPH_MSG_FS_MAP:
- handle_fs_map(MFSMap::msgref_cast(m));
+ handle_fs_map(ref_cast<MFSMap>(m));
break;
case CEPH_MSG_FS_MAP_USER:
- handle_fs_map_user(MFSMapUser::msgref_cast(m));
+ handle_fs_map_user(ref_cast<MFSMapUser>(m));
break;
case CEPH_MSG_CLIENT_SESSION:
- handle_client_session(MClientSession::msgref_cast(m));
+ handle_client_session(ref_cast<MClientSession>(m));
break;
case CEPH_MSG_OSD_MAP:
- handle_osd_map(MOSDMap::msgref_cast(m));
+ handle_osd_map(ref_cast<MOSDMap>(m));
break;
// requests
case CEPH_MSG_CLIENT_REQUEST_FORWARD:
- handle_client_request_forward(MClientRequestForward::msgref_cast(m));
+ handle_client_request_forward(ref_cast<MClientRequestForward>(m));
break;
case CEPH_MSG_CLIENT_REPLY:
- handle_client_reply(MClientReply::msgref_cast(m));
+ handle_client_reply(ref_cast<MClientReply>(m));
break;
// reclaim reply
case CEPH_MSG_CLIENT_RECLAIM_REPLY:
- handle_client_reclaim_reply(MClientReclaimReply::msgref_cast(m));
+ handle_client_reclaim_reply(ref_cast<MClientReclaimReply>(m));
break;
case CEPH_MSG_CLIENT_SNAP:
- handle_snap(MClientSnap::msgref_cast(m));
+ handle_snap(ref_cast<MClientSnap>(m));
break;
case CEPH_MSG_CLIENT_CAPS:
- handle_caps(MClientCaps::msgref_cast(m));
+ handle_caps(ref_cast<MClientCaps>(m));
break;
case CEPH_MSG_CLIENT_LEASE:
- handle_lease(MClientLease::msgref_cast(m));
+ handle_lease(ref_cast<MClientLease>(m));
break;
case MSG_COMMAND_REPLY:
if (m->get_source().type() == CEPH_ENTITY_TYPE_MDS) {
- handle_command_reply(MCommandReply::msgref_cast(m));
+ handle_command_reply(ref_cast<MCommandReply>(m));
} else {
return false;
}
break;
case CEPH_MSG_CLIENT_QUOTA:
- handle_quota(MClientQuota::msgref_cast(m));
+ handle_quota(ref_cast<MClientQuota>(m));
break;
default:
{
if (m->get_type() == MSG_MDS_BEACON) {
if (m->get_connection()->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
- handle_mds_beacon(MMDSBeacon::msgref_cast(m));
+ handle_mds_beacon(ref_cast<MMDSBeacon>(m));
}
return true;
}
switch (m->get_type()) {
// inter-mds locking
case MSG_MDS_LOCK:
- handle_lock(MLock::msgref_cast(m));
+ handle_lock(ref_cast<MLock>(m));
break;
// inter-mds caps
case MSG_MDS_INODEFILECAPS:
- handle_inode_file_caps(MInodeFileCaps::msgref_cast(m));
+ handle_inode_file_caps(ref_cast<MInodeFileCaps>(m));
break;
// client sync
case CEPH_MSG_CLIENT_CAPS:
- handle_client_caps(MClientCaps::msgref_cast(m));
+ handle_client_caps(ref_cast<MClientCaps>(m));
break;
case CEPH_MSG_CLIENT_CAPRELEASE:
- handle_client_cap_release(MClientCapRelease::msgref_cast(m));
+ handle_client_cap_release(ref_cast<MClientCapRelease>(m));
break;
case CEPH_MSG_CLIENT_LEASE:
- handle_client_lease(MClientLease::msgref_cast(m));
+ handle_client_lease(ref_cast<MClientLease>(m));
break;
default:
derr << "locker unknown message " << m->get_type() << dendl;
switch (m->get_type()) {
case MSG_MDS_HEARTBEAT:
- handle_heartbeat(MHeartbeat::msgref_cast(m));
+ handle_heartbeat(ref_cast<MHeartbeat>(m));
break;
default:
// RESOLVE
case MSG_MDS_RESOLVE:
- handle_resolve(MMDSResolve::msgref_cast(m));
+ handle_resolve(ref_cast<MMDSResolve>(m));
break;
case MSG_MDS_RESOLVEACK:
- handle_resolve_ack(MMDSResolveAck::msgref_cast(m));
+ handle_resolve_ack(ref_cast<MMDSResolveAck>(m));
break;
// REJOIN
case MSG_MDS_CACHEREJOIN:
- handle_cache_rejoin(MMDSCacheRejoin::msgref_cast(m));
+ handle_cache_rejoin(ref_cast<MMDSCacheRejoin>(m));
break;
case MSG_MDS_DISCOVER:
- handle_discover(MDiscover::msgref_cast(m));
+ handle_discover(ref_cast<MDiscover>(m));
break;
case MSG_MDS_DISCOVERREPLY:
- handle_discover_reply(MDiscoverReply::msgref_cast(m));
+ handle_discover_reply(ref_cast<MDiscoverReply>(m));
break;
case MSG_MDS_DIRUPDATE:
- handle_dir_update(MDirUpdate::msgref_cast(m));
+ handle_dir_update(ref_cast<MDirUpdate>(m));
break;
case MSG_MDS_CACHEEXPIRE:
- handle_cache_expire(MCacheExpire::msgref_cast(m));
+ handle_cache_expire(ref_cast<MCacheExpire>(m));
break;
case MSG_MDS_DENTRYLINK:
- handle_dentry_link(MDentryLink::msgref_cast(m));
+ handle_dentry_link(ref_cast<MDentryLink>(m));
break;
case MSG_MDS_DENTRYUNLINK:
- handle_dentry_unlink(MDentryUnlink::msgref_cast(m));
+ handle_dentry_unlink(ref_cast<MDentryUnlink>(m));
break;
case MSG_MDS_FRAGMENTNOTIFY:
- handle_fragment_notify(MMDSFragmentNotify::msgref_cast(m));
+ handle_fragment_notify(ref_cast<MMDSFragmentNotify>(m));
break;
case MSG_MDS_FRAGMENTNOTIFYACK:
- handle_fragment_notify_ack(MMDSFragmentNotifyAck::msgref_cast(m));
+ handle_fragment_notify_ack(ref_cast<MMDSFragmentNotifyAck>(m));
break;
case MSG_MDS_FINDINO:
- handle_find_ino(MMDSFindIno::msgref_cast(m));
+ handle_find_ino(ref_cast<MMDSFindIno>(m));
break;
case MSG_MDS_FINDINOREPLY:
- handle_find_ino_reply(MMDSFindInoReply::msgref_cast(m));
+ handle_find_ino_reply(ref_cast<MMDSFindInoReply>(m));
break;
case MSG_MDS_OPENINO:
- handle_open_ino(MMDSOpenIno::msgref_cast(m));
+ handle_open_ino(ref_cast<MMDSOpenIno>(m));
break;
case MSG_MDS_OPENINOREPLY:
- handle_open_ino_reply(MMDSOpenInoReply::msgref_cast(m));
+ handle_open_ino_reply(ref_cast<MMDSOpenInoReply>(m));
break;
case MSG_MDS_SNAPUPDATE:
- handle_snap_update(MMDSSnapUpdate::msgref_cast(m));
+ handle_snap_update(ref_cast<MMDSSnapUpdate>(m));
break;
default:
// MDS
case CEPH_MSG_MDS_MAP:
ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_MDS);
- handle_mds_map(MMDSMap::msgref_cast(m));
+ handle_mds_map(ref_cast<MMDSMap>(m));
break;
// OSD
case MSG_COMMAND:
- handle_command(MCommand::msgref_cast(m));
+ handle_command(ref_cast<MCommand>(m));
break;
case CEPH_MSG_OSD_MAP:
ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_OSD);
case MSG_MDS_TABLE_REQUEST:
ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MDS);
{
- const cref_t<MMDSTableRequest> &req = MMDSTableRequest::msgref_cast(m);
+ const cref_t<MMDSTableRequest> &req = ref_cast<MMDSTableRequest>(m);
if (req->op < 0) {
MDSTableClient *client = get_table_client(req->table);
client->handle_request(req);
switch (m->get_type()) {
// import
case MSG_MDS_EXPORTDIRDISCOVER:
- handle_export_discover(MExportDirDiscover::msgref_cast(m));
+ handle_export_discover(ref_cast<MExportDirDiscover>(m));
break;
case MSG_MDS_EXPORTDIRPREP:
- handle_export_prep(MExportDirPrep::msgref_cast(m));
+ handle_export_prep(ref_cast<MExportDirPrep>(m));
break;
case MSG_MDS_EXPORTDIR:
if (unlikely(inject_session_race)) {
dout(0) << "waiting for inject_session_race" << dendl;
mds->wait_for_any_client_connection(new C_MDS_RetryMessage(mds, m));
} else {
- handle_export_dir(MExportDir::msgref_cast(m));
+ handle_export_dir(ref_cast<MExportDir>(m));
}
break;
case MSG_MDS_EXPORTDIRFINISH:
- handle_export_finish(MExportDirFinish::msgref_cast(m));
+ handle_export_finish(ref_cast<MExportDirFinish>(m));
break;
case MSG_MDS_EXPORTDIRCANCEL:
- handle_export_cancel(MExportDirCancel::msgref_cast(m));
+ handle_export_cancel(ref_cast<MExportDirCancel>(m));
break;
// export
case MSG_MDS_EXPORTDIRDISCOVERACK:
- handle_export_discover_ack(MExportDirDiscoverAck::msgref_cast(m));
+ handle_export_discover_ack(ref_cast<MExportDirDiscoverAck>(m));
break;
case MSG_MDS_EXPORTDIRPREPACK:
- handle_export_prep_ack(MExportDirPrepAck::msgref_cast(m));
+ handle_export_prep_ack(ref_cast<MExportDirPrepAck>(m));
break;
case MSG_MDS_EXPORTDIRACK:
- handle_export_ack(MExportDirAck::msgref_cast(m));
+ handle_export_ack(ref_cast<MExportDirAck>(m));
break;
case MSG_MDS_EXPORTDIRNOTIFYACK:
- handle_export_notify_ack(MExportDirNotifyAck::msgref_cast(m));
+ handle_export_notify_ack(ref_cast<MExportDirNotifyAck>(m));
break;
// export 3rd party (dir_auth adjustments)
case MSG_MDS_EXPORTDIRNOTIFY:
- handle_export_notify(MExportDirNotify::msgref_cast(m));
+ handle_export_notify(ref_cast<MExportDirNotify>(m));
break;
// caps
case MSG_MDS_EXPORTCAPS:
- handle_export_caps(MExportCaps::msgref_cast(m));
+ handle_export_caps(ref_cast<MExportCaps>(m));
break;
case MSG_MDS_EXPORTCAPSACK:
- handle_export_caps_ack(MExportCapsAck::msgref_cast(m));
+ handle_export_caps_ack(ref_cast<MExportCapsAck>(m));
break;
case MSG_MDS_GATHERCAPS:
- handle_gather_caps(MGatherCaps::msgref_cast(m));
+ handle_gather_caps(ref_cast<MGatherCaps>(m));
break;
default:
{
switch (m->get_type()) {
case CEPH_MSG_CLIENT_RECONNECT:
- handle_client_reconnect(MClientReconnect::msgref_cast(m));
+ handle_client_reconnect(ref_cast<MClientReconnect>(m));
return;
}
// active?
// handle_slave_request()/handle_client_session() will wait if necessary
if (m->get_type() == CEPH_MSG_CLIENT_REQUEST && !mds->is_active()) {
- const auto &req = MClientRequest::msgref_cast(m);
+ const auto &req = ref_cast<MClientRequest>(m);
if (mds->is_reconnect() || mds->get_want_state() == CEPH_MDS_STATE_RECONNECT) {
Session *session = mds->get_session(req);
if (!session || session->is_closed()) {
switch (m->get_type()) {
case CEPH_MSG_CLIENT_SESSION:
- handle_client_session(MClientSession::msgref_cast(m));
+ handle_client_session(ref_cast<MClientSession>(m));
return;
case CEPH_MSG_CLIENT_REQUEST:
- handle_client_request(MClientRequest::msgref_cast(m));
+ handle_client_request(ref_cast<MClientRequest>(m));
return;
case CEPH_MSG_CLIENT_RECLAIM:
- handle_client_reclaim(MClientReclaim::msgref_cast(m));
+ handle_client_reclaim(ref_cast<MClientReclaim>(m));
return;
case MSG_MDS_SLAVE_REQUEST:
- handle_slave_request(MMDSSlaveRequest::msgref_cast(m));
+ handle_slave_request(ref_cast<MMDSSlaveRequest>(m));
return;
default:
derr << "server unknown message " << m->get_type() << dendl;
ss << "decoded type " << n->get_type() << " instead of expected " << m_object->get_type();
throw std::runtime_error(ss.str());
}
- m_object = boost::static_pointer_cast<typename T::ref::element_type, std::remove_reference<decltype(n)>::type::element_type>(n);
+ m_object = ref_cast<T>(n);
}
catch (buffer::error& e) {
return e.what();