Motr  M0
version.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #include "motr/version.h"
24 #include "xcode/protocol_checksum.h"
25 #ifdef __KERNEL__
26 # include <linux/kernel.h> /* KERN_INFO */
27 #endif
28 #include "lib/trace.h" /* m0_console_printf */
29 
30 #ifdef __KERNEL__
31 # define BI_PREFIX KERN_INFO "motr: "
32 #else
33 # define BI_PREFIX
34 #endif
35 
36 static const struct m0_build_info build_info = {
38  .bi_version_string = M0_VERSION_STRING,
39  .bi_git_rev_id = M0_VERSION_GIT_REV_ID,
40  .bi_git_describe = M0_VERSION_GIT_DESCRIBE,
41  .bi_git_branch = M0_VERSION_GIT_BRANCH,
42  .bi_host = M0_VERSION_BUILD_HOST,
43  .bi_user = M0_VERSION_BUILD_USER,
44  .bi_time = M0_VERSION_BUILD_TIME,
45  .bi_toolchain = M0_VERSION_BUILD_GCC,
46  .bi_kernel = M0_VERSION_BUILD_KERNEL,
47  .bi_cflags = M0_VERSION_BUILD_CFLAGS,
48  .bi_kcflags = M0_VERSION_BUILD_KCFLAGS,
49  .bi_ldflags = M0_VERSION_BUILD_LDFLAGS,
50  .bi_configure_opts = M0_VERSION_BUILD_CONFIGURE_OPTS,
51  .bi_build_dir = M0_VERSION_BUILD_DIR,
52  .bi_lustre_src = M0_VERSION_LUSTRE_SRC,
53  .bi_lustre_version = M0_VERSION_LUSTRE_VER,
54 
55  .bi_xcode_protocol_checksum = M0_XCODE_PROTOCOL_CHECKSUM_MD5,
56  .bi_xcode_protocol_be_checksum = M0_XCODE_PROTOCOL_BE_CHECKSUM_MD5,
57  .bi_xcode_protocol_conf_checksum = M0_XCODE_PROTOCOL_CONF_CHECKSUM_MD5,
58  .bi_xcode_protocol_rpc_checksum = M0_XCODE_PROTOCOL_RPC_CHECKSUM_MD5,
59 };
60 
61 const struct m0_build_info *m0_build_info_get(void)
62 {
63  return &build_info;
64 }
65 
67 {
68  const struct m0_build_info *bi = m0_build_info_get();
69 
71  "Motr %s built on %s by %s@%s at %s for %s kernel\n",
73  bi->bi_time,
74  bi->bi_user, bi->bi_host, bi->bi_build_dir,
75  bi->bi_kernel);
76 
78 
79  m0_console_printf(BI_PREFIX "Git branch : %s\n", bi->bi_git_branch);
80  m0_console_printf(BI_PREFIX "Git describe : %s\n", bi->bi_git_describe);
81  m0_console_printf(BI_PREFIX "Git revision : %s\n", bi->bi_git_rev_id);
82 
84 
85  m0_console_printf(BI_PREFIX "xcode protocol checksum: %s\n",
87  m0_console_printf(BI_PREFIX "xcode BE protocol checksum: %s\n",
89  m0_console_printf(BI_PREFIX "xcode CONF protocol checksum: %s\n",
91  m0_console_printf(BI_PREFIX "xcode RPC protocol checksum: %s\n",
93 
95 
97  "Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates\n");
98 
100 
101  m0_console_printf(BI_PREFIX "toolchain: %s\n", bi->bi_toolchain);
102  m0_console_printf(BI_PREFIX "CONFIGURE OPTS: %s\n", bi->bi_configure_opts);
103 #ifdef __KERNEL__
104  m0_console_printf(BI_PREFIX "KCFLAGS: %s\n", bi->bi_kcflags);
105 #else
106  m0_console_printf(BI_PREFIX "CFLAGS: %s\n", bi->bi_cflags);
107  m0_console_printf(BI_PREFIX "LDFLAGS: %s\n", bi->bi_ldflags);
108 #endif
109 
111 
112  m0_console_printf(BI_PREFIX "Lustre: %s\n", bi->bi_lustre_src);
113  m0_console_printf(BI_PREFIX "Lustre version: %s\n", bi->bi_lustre_version);
114 }
115 
116 /*
117  * Local variables:
118  * c-indentation-style: "K&R"
119  * c-basic-offset: 8
120  * tab-width: 8
121  * fill-column: 80
122  * scroll-step: 1
123  * End:
124  */
125 /*
126  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
127  */
const char * bi_git_branch
Definition: version.h:36
#define M0_VERSION_BUILD_TIME
#define M0_VERSION_GIT_REV_ID
const char * bi_host
Definition: version.h:41
#define M0_VERSION_BUILD_DIR
void m0_console_printf(const char *fmt,...)
Definition: trace.c:801
const char * bi_xcode_protocol_be_checksum
Definition: version.h:38
#define M0_VERSION_CODE
#define M0_VERSION_BUILD_CFLAGS
#define M0_VERSION_STRING
const char * bi_cflags
Definition: version.h:46
void m0_build_info_print(void)
Definition: version.c:66
const char * bi_configure_opts
Definition: version.h:49
const char * bi_kernel
Definition: version.h:45
const struct m0_build_info * m0_build_info_get(void)
Definition: version.c:61
const char * bi_xcode_protocol_rpc_checksum
Definition: version.h:40
#define M0_VERSION_BUILD_KERNEL
const char * bi_git_describe
Definition: version.h:35
uint32_t bi_version
Definition: version.h:32
const char * bi_git_rev_id
Definition: version.h:34
#define M0_VERSION_GIT_DESCRIBE
static const struct m0_build_info build_info
Definition: version.c:36
#define M0_VERSION_BUILD_USER
#define M0_VERSION_LUSTRE_SRC
const char * bi_kcflags
Definition: version.h:47
#define BI_PREFIX
Definition: version.c:33
const char * bi_lustre_src
Definition: version.h:51
const char * bi_build_dir
Definition: version.h:50
#define M0_VERSION_BUILD_KCFLAGS
#define M0_VERSION_BUILD_GCC
const char * bi_lustre_version
Definition: version.h:52
#define M0_VERSION_LUSTRE_VER
const char * bi_ldflags
Definition: version.h:48
const char * bi_user
Definition: version.h:42
const char * bi_time
Definition: version.h:43
const char * bi_xcode_protocol_conf_checksum
Definition: version.h:39
#define M0_VERSION_GIT_BRANCH
const char * bi_xcode_protocol_checksum
Definition: version.h:37
const char * bi_toolchain
Definition: version.h:44
#define M0_VERSION_BUILD_HOST
#define M0_VERSION_BUILD_LDFLAGS
const char * bi_version_string
Definition: version.h:33
#define M0_VERSION_BUILD_CONFIGURE_OPTS