aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2020-02-07 11:05:03 -0500
committerSteve Dickson <steved@redhat.com>2020-02-07 11:05:51 -0500
commit1eafe05616b4660fb15d106e06f0b3e18983708c (patch)
tree7377b8b834f3eed98f9973973c233871c02adf8e
parentb5381c96298d75ba66625a007e2390e2b501850d (diff)
downloadnfs-utils-1eafe05616b4660fb15d106e06f0b3e18983708c.tar.gz
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>
-rw-r--r--utils/mountd/v4root.c2
-rw-r--r--utils/nfsdcld/cld-internal.h10
-rw-r--r--utils/nfsdcld/nfsdcld.c6
-rw-r--r--utils/statd/statd.c1
-rw-r--r--utils/statd/statd.h2
5 files changed, 13 insertions, 8 deletions
diff --git a/utils/mountd/v4root.c b/utils/mountd/v4root.c
index d735dbfe..dd9828eb 100644
--- a/utils/mountd/v4root.c
+++ b/utils/mountd/v4root.c
@@ -28,8 +28,6 @@
#include "v4root.h"
#include "pseudoflavors.h"
-int v4root_needed;
-
static nfs_export pseudo_root = {
.m_next = NULL,
.m_client = NULL,
diff --git a/utils/nfsdcld/cld-internal.h b/utils/nfsdcld/cld-internal.h
index 05f01be2..cc283dae 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 2ad10019..be655626 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' },
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 8eef2ff2..e4a1df43 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -67,6 +67,7 @@ static struct option longopts[] =
};
extern void sm_prog_1 (struct svc_req *, register SVCXPRT *);
+stat_chge SM_stat_chge;
#ifdef SIMULATIONS
extern void simulator (int, char **);
diff --git a/utils/statd/statd.h b/utils/statd/statd.h
index 231ac7e0..bb1fecbb 100644
--- a/utils/statd/statd.h
+++ b/utils/statd/statd.h
@@ -41,7 +41,7 @@ extern void load_state(void);
/*
* Host status structure and macros.
*/
-stat_chge SM_stat_chge;
+extern stat_chge SM_stat_chge;
#define MY_NAME SM_stat_chge.mon_name
#define MY_STATE SM_stat_chge.state