From ef0e07d993365061c8f0bae81d4b99ad3aceaef0 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Fri, 18 Feb 2011 13:04:51 -0800 Subject: [PATCH] debug.h: move Ceph version stuff into version.h Signed-off-by: Colin McCabe --- src/Makefile.am | 4 +++- src/common/debug.cc | 16 ---------------- src/common/debug.h | 4 ---- src/common/version.cc | 37 +++++++++++++++++++++++++++++++++++++ src/common/version.h | 24 ++++++++++++++++++++++++ src/config.cc | 1 + 6 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 src/common/version.cc create mode 100644 src/common/version.h diff --git a/src/Makefile.am b/src/Makefile.am index ab3ac6ebaa12..38346380360e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -534,7 +534,8 @@ libcommon_files = \ common/page.cc \ common/lockdep.cc \ common/DoutStreambuf.cc \ - common/debug.cc + common/debug.cc \ + common/version.cc libcrush_a_SOURCES = \ crush/builder.c \ @@ -653,6 +654,7 @@ noinst_HEADERS = \ common/LogEntry.h\ common/WorkQueue.h\ common/debug.h\ + common/version.h\ common/errno.h\ common/likely.h\ common/lockdep.h\ diff --git a/src/common/debug.cc b/src/common/debug.cc index 0f433a7ea399..7bf1049f94bd 100644 --- a/src/common/debug.cc +++ b/src/common/debug.cc @@ -19,22 +19,6 @@ bool _dout_need_open = true; */ pthread_mutex_t _dout_lock = PTHREAD_MUTEX_INITIALIZER; -#define _STR(x) #x -#define STRINGIFY(x) _STR(x) - -std::string ceph_version_to_string(void) -{ - std::ostringstream oss; - oss << "ceph version " << VERSION << " (commit:" - << STRINGIFY(CEPH_GIT_VER) << ")"; - return oss.str(); -} - -void dout_output_ceph_version(void) -{ - generic_dout(-1) << ceph_version_to_string() << dendl; -} - void _dout_open_log() { // should hold _dout_lock here diff --git a/src/common/debug.h b/src/common/debug.h index d0a981326ef8..f7a2c0ba3eaf 100644 --- a/src/common/debug.h +++ b/src/common/debug.h @@ -29,10 +29,6 @@ extern DoutStreambuf *_doss; extern bool _dout_need_open; extern pthread_mutex_t _dout_lock; -extern std::string ceph_version_to_string(void); - -extern void dout_output_ceph_version(void); - extern void _dout_open_log(); extern int dout_handle_daemonize(); diff --git a/src/common/version.cc b/src/common/version.cc new file mode 100644 index 000000000000..8d0c5d524d8e --- /dev/null +++ b/src/common/version.cc @@ -0,0 +1,37 @@ +// -*- 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 "config.h" +#include "ceph_ver.h" +#include "common/debug.h" +#include "common/version.h" + +#include +#include + +#define _STR(x) #x +#define STRINGIFY(x) _STR(x) + +std::string ceph_version_to_string(void) +{ + std::ostringstream oss; + oss << "ceph version " << VERSION << " (commit:" + << STRINGIFY(CEPH_GIT_VER) << ")"; + return oss.str(); +} + +void dout_output_ceph_version(void) +{ + generic_dout(-1) << ceph_version_to_string() << dendl; +} diff --git a/src/common/version.h b/src/common/version.h new file mode 100644 index 000000000000..e98e7cccb8a6 --- /dev/null +++ b/src/common/version.h @@ -0,0 +1,24 @@ +// -*- 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_COMMON_VERSION_H +#define CEPH_COMMON_VERSION_H + +// Return a string describing the Ceph version +std::string ceph_version_to_string(void); + +// Output Ceph version to dout with prio -1 +void dout_output_ceph_version(void); + +#endif diff --git a/src/config.cc b/src/config.cc index ca802911b11f..3c7b3c96a580 100644 --- a/src/config.cc +++ b/src/config.cc @@ -20,6 +20,7 @@ #include "common/ProfLogger.h" #include "common/common_init.h" #include "common/dyn_snprintf.h" +#include "common/version.h" #include "config.h" #include "include/atomic.h" #include "include/str_list.h" -- 2.47.3