All of lore.kernel.org
 help / color / mirror / Atom feed
From: "NeilBrown" <neilb@suse.de>
To: "Steve Dickson" <SteveD@RedHat.com>
Cc: "Petr Vorel" <pvorel@suse.cz>,
	"J . Bruce Fields" <bfields@fieldses.org>,
	linux-nfs@vger.kernel.org, "Chuck Lever" <chuck.lever@oracle.com>,
	"Alexey Kodanev" <alexey.kodanev@oracle.com>
Subject: [PATCH nfs-utils 2/2] Move declaration of etab and rmtab into libraries
Date: Fri, 21 May 2021 11:41:12 +1000	[thread overview]
Message-ID: <162156127225.19062.3275458295434454950@noble.neil.brown.name> (raw)
In-Reply-To: <162156122215.19062.11710239266795260824@noble.neil.brown.name>


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).

Signed-off-by: NeilBrown <neilb@suse.de>
---
 support/export/auth.c      | 2 --
 support/export/xtab.c      | 2 +-
 support/include/exportfs.h | 1 +
 support/include/nfslib.h   | 1 +
 support/nfs/rmtab.c        | 2 +-
 utils/exportd/exportd.c    | 2 --
 utils/exportfs/exportfs.c  | 2 --
 utils/mountd/mountd.c      | 3 ---
 utils/mountd/rmtab.c       | 2 --
 9 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/support/export/auth.c b/support/export/auth.c
index 17bdfc83748e..03ce4b8a0e1e 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 00b25eaac07d..c888a80aa741 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 7c1b74537186..9edf0d04732f 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 58eeb3382fcc..6faba71bf0cd 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 9f03167ddbe1..154b26fa3402 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 f36f51d215b5..2dd12cb6015b 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 d586296796a9..6ba615d1443d 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 39e85fd53a87..bcf749fabbb3 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 c8962439ddd2..2da97615ca0f 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.
  */
-- 
2.31.1


  reply	other threads:[~2021-05-21  1:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 19:18 [RFC PATCH 1/1] mount.nfs: Fix mounting on tmpfs Petr Vorel
2021-04-22 20:23 ` J . Bruce Fields
2021-04-23  2:17   ` Petr Vorel
2021-04-23 14:23     ` J . Bruce Fields
2021-04-23 17:04       ` Petr Vorel
2021-04-23 18:13         ` J . Bruce Fields
2021-04-23 20:37           ` Petr Vorel
2021-05-03  2:21           ` NeilBrown
2021-05-03  8:10             ` Petr Vorel
2021-05-03 14:15             ` J . Bruce Fields
2021-04-23 13:50   ` Petr Vorel
2021-05-07  1:48     ` [PATCH/RFC nfs-utils] Fix NFSv4 export of tmpfs filesystems NeilBrown
2021-05-07 10:06       ` Petr Vorel
2021-05-13  4:07         ` NeilBrown
2021-05-13 18:38           ` Petr Vorel
2021-05-13 18:51             ` Petr Vorel
2021-05-17  3:08               ` NeilBrown
2021-05-17 14:27                 ` Petr Vorel
2021-05-07 13:55       ` Chuck Lever III
2021-05-07 23:13         ` NeilBrown
2021-05-17  4:45       ` [PATCH/RFC v2 " NeilBrown
2021-05-17 15:00         ` Petr Vorel
2021-05-18 17:54         ` Petr Vorel
2021-05-20 17:37         ` Steve Dickson
2021-05-20 20:39           ` Petr Vorel
2021-05-21  1:38           ` NeilBrown
2021-05-21  1:40             ` [PATCH nfs-utils 1/2] Remove 'force' arg from cache_flush() NeilBrown
2021-05-21  1:41               ` NeilBrown [this message]
2021-05-21 13:57                 ` [PATCH nfs-utils 2/2] Move declaration of etab and rmtab into libraries Petr Vorel
2021-05-23 18:31                 ` Steve Dickson
2021-05-21 13:52               ` [PATCH nfs-utils 1/2] Remove 'force' arg from cache_flush() Petr Vorel
2021-05-23 18:30               ` Steve Dickson
2021-05-23 18:29         ` [PATCH/RFC v2 nfs-utils] Fix NFSv4 export of tmpfs filesystems Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=162156127225.19062.3275458295434454950@noble.neil.brown.name \
    --to=neilb@suse.de \
    --cc=SteveD@RedHat.com \
    --cc=alexey.kodanev@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.