]> git.proxmox.com Git - ceph.git/blame - ceph/src/common/version.cc
import ceph quincy 17.2.4
[ceph.git] / ceph / src / common / version.cc
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2011 New Dream Network
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
7c673cae
FG
15#include "common/version.h"
16
f67539c2 17#include <stdlib.h>
7c673cae 18#include <sstream>
7c673cae 19
9f95a23c
TL
20#include "ceph_ver.h"
21#include "common/ceph_strings.h"
22
7c673cae
FG
23#define _STR(x) #x
24#define STRINGIFY(x) _STR(x)
25
f67539c2 26const char *ceph_version_to_str()
7c673cae 27{
f67539c2
TL
28 char* debug_version_for_testing = getenv("ceph_debug_version_for_testing");
29 if (debug_version_for_testing) {
30 return debug_version_for_testing;
31 } else {
32 return CEPH_GIT_NICE_VER;
33 }
7c673cae
FG
34}
35
11fdf7f2
TL
36const char *ceph_release_to_str(void)
37{
38 return ceph_release_name(CEPH_RELEASE);
39}
40
7c673cae
FG
41const char *git_version_to_str(void)
42{
43 return STRINGIFY(CEPH_GIT_VER);
44}
45
46std::string const pretty_version_to_str(void)
47{
48 std::ostringstream oss;
31f18b77
FG
49 oss << "ceph version " << CEPH_GIT_NICE_VER
50 << " (" << STRINGIFY(CEPH_GIT_VER) << ") "
51 << ceph_release_name(CEPH_RELEASE)
52 << " (" << CEPH_RELEASE_TYPE << ")";
7c673cae
FG
53 return oss.str();
54}
31f18b77 55
31f18b77
FG
56const char *ceph_release_type(void)
57{
58 return CEPH_RELEASE_TYPE;
59}