From fc4343860198adfb3e6b6a347b3234f2ad4e56e7 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Fri, 17 Jun 2011 10:51:45 -0700 Subject: [PATCH] Create global_context.cc to house g_ceph_context Signed-off-by: Colin McCabe --- src/Makefile.am | 2 ++ src/common/ceph_context.cc | 6 ------ src/common/dout.h | 2 +- src/global/global_context.cc | 23 +++++++++++++++++++++++ src/global/global_context.h | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 src/global/global_context.cc create mode 100644 src/global/global_context.h diff --git a/src/Makefile.am b/src/Makefile.am index ac67ac6790d..e3e196c9339 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -644,6 +644,7 @@ libcommon_files = \ mds/MDSMap.cc \ common/common_init.cc \ global/global_init.cc \ + global/global_context.cc \ common/ceph_argparse.cc \ common/ceph_context.cc \ common/buffer.cc \ @@ -818,6 +819,7 @@ noinst_HEADERS = \ common/arch.h\ common/armor.h\ global/global_init.h \ + global/global_context.h \ common/common_init.h\ common/code_environment.h \ common/signal.h\ diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 8fbcdf7f290..c46bd4c8dcc 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -23,12 +23,6 @@ #include #include -// FIXME -// These variables are here temporarily to make the transition easier. -CephContext g_ceph_context __attribute__((init_priority(103))) (0); -md_config_t *g_conf(g_ceph_context._conf); -DoutStreambuf ::traits_type> *_doss(g_ceph_context._doss); - class CephContextServiceThread : public Thread { public: diff --git a/src/common/dout.h b/src/common/dout.h index 4b3e0e2d2bb..d45e0bf06b7 100644 --- a/src/common/dout.h +++ b/src/common/dout.h @@ -16,7 +16,7 @@ #ifndef CEPH_DOUT_H #define CEPH_DOUT_H -#include "common/ceph_context.h" +#include "global/global_context.h" #include "common/DoutStreambuf.h" #include "common/likely.h" #include "common/config.h" // need for g_conf diff --git a/src/global/global_context.cc b/src/global/global_context.cc new file mode 100644 index 00000000000..651999b91eb --- /dev/null +++ b/src/global/global_context.cc @@ -0,0 +1,23 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2011 New Dream Network + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#include "common/ceph_context.h" +#include "global/global_context.h" + +/* + * Global variables for use from process context. + */ +CephContext g_ceph_context __attribute__((init_priority(103))) (0); +md_config_t *g_conf(g_ceph_context._conf); +DoutStreambuf ::traits_type> *_doss(g_ceph_context._doss); diff --git a/src/global/global_context.h b/src/global/global_context.h new file mode 100644 index 00000000000..248b9415dac --- /dev/null +++ b/src/global/global_context.h @@ -0,0 +1,33 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2011 New Dream Network + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#ifndef CEPH_GLOBAL_CONTEXT_H +#define CEPH_GLOBAL_CONTEXT_H + +#include "common/ceph_context.h" + +#include +#include + +/* Forward declarations */ +template +class DoutStreambuf; + +class md_config_t; + +extern CephContext g_ceph_context; +extern md_config_t *g_conf; +extern DoutStreambuf ::traits_type> *_doss; + +#endif