1 Star 0 Fork 2

zhongling.h/lifsea-nfs-utils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1002-Allow-compilation-to-succeed-with-fno-common.patch 1.98 KB
一键复制 编辑 原始数据 按行查看 历史
From 1eafe05616b4660fb15d106e06f0b3e18983708c Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Fri, 7 Feb 2020 11:05:03 -0500
Subject: [PATCH] Allow compilation to succeed with -fno-common
When compiled with -fno-common, global variables that are declared
multple times cause an error. With -fcommon (the default), they are
merged.
Declaring such variable multiple times is probably not a good idea, and
is definitely not necessary.
This patch changes all the global variables defined in include files to
be explicitly "extern", and where necessary, adds the variable
declaration to a suitable .c file.
To test, run
CFLAGS=-fno-common ./configure
make
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mountd/v4root.c | 2 --
utils/nfsdcld/cld-internal.h | 10 +++++-----
utils/nfsdcld/nfsdcld.c | 6 ++++++
utils/statd/statd.c | 1 +
utils/statd/statd.h | 2 +-
5 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/utils/nfsdcld/cld-internal.h b/utils/nfsdcld/cld-internal.h
index 05f01be..cc283da 100644
--- a/utils/nfsdcld/cld-internal.h
+++ b/utils/nfsdcld/cld-internal.h
@@ -35,10 +35,10 @@ struct cld_client {
} cl_u;
};
-uint64_t current_epoch;
-uint64_t recovery_epoch;
-int first_time;
-int num_cltrack_records;
-int num_legacy_records;
+extern uint64_t current_epoch;
+extern uint64_t recovery_epoch;
+extern int first_time;
+extern int num_cltrack_records;
+extern int num_legacy_records;
#endif /* _CLD_INTERNAL_H_ */
diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c
index 2ad1001..be65562 100644
--- a/utils/nfsdcld/nfsdcld.c
+++ b/utils/nfsdcld/nfsdcld.c
@@ -69,6 +69,12 @@ static int inotify_fd = -1;
static struct event pipedir_event;
static bool old_kernel = false;
+uint64_t current_epoch;
+uint64_t recovery_epoch;
+int first_time;
+int num_cltrack_records;
+int num_legacy_records;
+
static struct option longopts[] =
{
{ "help", 0, NULL, 'h' },
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhonglingh/lifsea-nfs-utils.git
git@gitee.com:zhonglingh/lifsea-nfs-utils.git
zhonglingh
lifsea-nfs-utils
lifsea-nfs-utils
lifsea

搜索帮助