aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2021-05-22 11:12:11 -0400
committerSteve Dickson <steved@redhat.com>2021-05-22 11:18:56 -0400
commite4ce810a9a2374e34a76ba78d1565382d47af3c8 (patch)
tree8b90b406744cbf3e485708a94101a067e520bb01
parent7a4e2d1de904a65496db051dbc9d4c7e510a5fd8 (diff)
downloadnfs-utils-e4ce810a9a2374e34a76ba78d1565382d47af3c8.tar.gz
Move declaration of etab and rmtab into libraries
There are two global "struct stat_paths" structures: etab and rmtab. They are currently needed by some library code so any program which is linked with that library code needs to declare the structures even if it doesn't use the functionality. This is clumsy and error-prone. Instead: have the library declare the structure and put the definition in a header file. Now programs only need to know about these structures if they use the functionality. 'rmtab' is now declared in libnfs.a (rmtab.c). 'etab' is declared in export.a (xtab.c). Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--support/export/auth.c2
-rw-r--r--support/export/xtab.c2
-rw-r--r--support/include/exportfs.h1
-rw-r--r--support/include/nfslib.h1
-rw-r--r--support/nfs/rmtab.c2
-rw-r--r--utils/exportd/exportd.c2
-rw-r--r--utils/exportfs/exportfs.c2
-rw-r--r--utils/mountd/mountd.c3
-rw-r--r--utils/mountd/rmtab.c2
9 files changed, 4 insertions, 13 deletions
diff --git a/support/export/auth.c b/support/export/auth.c
index 17bdfc83..03ce4b8a 100644
--- a/support/export/auth.c
+++ b/support/export/auth.c
@@ -41,8 +41,6 @@ static nfs_client my_client;
extern int use_ipaddr;
-extern struct state_paths etab;
-
/*
void
auth_init(void)
diff --git a/support/export/xtab.c b/support/export/xtab.c
index 00b25eaa..c888a80a 100644
--- a/support/export/xtab.c
+++ b/support/export/xtab.c
@@ -27,7 +27,7 @@
#include "misc.h"
static char state_base_dirname[PATH_MAX] = NFS_STATEDIR;
-extern struct state_paths etab;
+struct state_paths etab;
int v4root_needed;
static void cond_rename(char *newfile, char *oldfile);
diff --git a/support/include/exportfs.h b/support/include/exportfs.h
index 7c1b7453..9edf0d04 100644
--- a/support/include/exportfs.h
+++ b/support/include/exportfs.h
@@ -145,6 +145,7 @@ nfs_export * export_create(struct exportent *, int canonical);
void exportent_release(struct exportent *);
void export_freeall(void);
+extern struct state_paths etab;
int xtab_export_read(void);
int xtab_export_write(void);
diff --git a/support/include/nfslib.h b/support/include/nfslib.h
index 58eeb338..6faba71b 100644
--- a/support/include/nfslib.h
+++ b/support/include/nfslib.h
@@ -106,6 +106,7 @@ void dupexportent(struct exportent *dst,
struct exportent *src);
int updateexportent(struct exportent *eep, char *options);
+extern struct state_paths rmtab;
int setrmtabent(char *type);
struct rmtabent * getrmtabent(int log, long *pos);
void putrmtabent(struct rmtabent *xep, long *pos);
diff --git a/support/nfs/rmtab.c b/support/nfs/rmtab.c
index 9f03167d..154b26fa 100644
--- a/support/nfs/rmtab.c
+++ b/support/nfs/rmtab.c
@@ -33,7 +33,7 @@
static FILE *rmfp = NULL;
-extern struct state_paths rmtab;
+struct state_paths rmtab;
int
setrmtabent(char *type)
diff --git a/utils/exportd/exportd.c b/utils/exportd/exportd.c
index f36f51d2..2dd12cb6 100644
--- a/utils/exportd/exportd.c
+++ b/utils/exportd/exportd.c
@@ -25,8 +25,6 @@
extern void my_svc_run(void);
-struct state_paths etab;
-
/* Number of mountd threads to start. Default is 1 and
* that's probably enough unless you need hundreds of
* clients to be able to mount at once. */
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index d5862967..6ba615d1 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -52,8 +52,6 @@ static void release_lockfile(void);
static const char *lockfile = EXP_LOCKFILE;
static int _lockfd = -1;
-struct state_paths etab;
-
/*
* If we aren't careful, changes made by exportfs can be lost
* when multiple exports process run at once:
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 39e85fd5..bcf749fa 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -43,9 +43,6 @@ int reverse_resolve = 0;
int manage_gids;
int use_ipaddr = -1;
-struct state_paths etab;
-struct state_paths rmtab;
-
/* PRC: a high-availability callout program can be specified with -H
* When this is done, the program will receive callouts whenever clients
* send mount or unmount requests -- the callout is not needed for 2.6 kernel */
diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c
index c8962439..2da97615 100644
--- a/utils/mountd/rmtab.c
+++ b/utils/mountd/rmtab.c
@@ -28,8 +28,6 @@
extern int reverse_resolve;
-extern struct state_paths rmtab;
-
/* If new path is a link do not destroy it but place the
* file where the link points.
*/