// FIXME
// These variables are here temporarily to make the transition easier.
-CephContext g_ceph_context __attribute__((init_priority(103)));
+CephContext g_ceph_context __attribute__((init_priority(103))) (0);
md_config_t *g_conf(g_ceph_context._conf);
std::ostream *_dout(&g_ceph_context._dout);
DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss(g_ceph_context._doss);
};
CephContext::
-CephContext()
+CephContext(uint32_t module_type_)
: _doss(new DoutStreambuf <char, std::basic_string<char>::traits_type>()),
_dout(_doss),
- module_type(0),
+ module_type(module_type_),
_prof_logger_conf_obs(new ProfLoggerConfObs()),
_service_thread(NULL)
{
thread->join();
delete thread;
}
+
+uint32_t CephContext::
+get_module_type() const
+{
+ return module_type;
+}
+
+void CephContext::
+set_module_type(uint32_t module_type_)
+{
+ module_type = module_type_;
+}
#define CEPH_CEPHCONTEXT_H
#include <iostream>
+#include <stdint.h>
/* Forward declarations */
template <typename T, typename U>
*/
class CephContext {
public:
- CephContext();
+ CephContext(uint32_t module_type_);
~CephContext();
md_config_t *_conf;
DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
std::ostream _dout;
- unsigned module_type;
-
/* Start the Ceph Context's service thread */
void start_service_thread();
/* Try to lock the dout lock. */
void dout_trylock(DoutLocker *locker);
+ /* Get the module type (client, mon, osd, mds, etc.) */
+ uint32_t get_module_type() const;
+
+ /* Set module type (TODO: remove) */
+ void set_module_type(uint32_t module_type_);
+
private:
/* Stop and join the Ceph Context's service thread */
void join_service_thread();
+ uint32_t module_type;
+
md_config_obs_t *_prof_logger_conf_obs;
/* libcommon service thread.
conf->set_val_or_die("daemonize", "false");
break;
}
- cct->module_type = iparams.module_type;
+ cct->set_module_type(iparams.module_type);
return cct;
}
derr << "MonClient::init(): Failed to create keyring" << dendl;
return -EDOM;
}
- rotating_secrets = new RotatingKeyRing(cct->module_type, keyring);
+ rotating_secrets = new RotatingKeyRing(cct->get_module_type(), keyring);
entity_name = g_conf->name;