Re: [PATCH nfs-utils 2/2] Move declaration of etab and rmtab into libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 5/20/21 9:41 PM, NeilBrown wrote:
> 
> 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@xxxxxxx>
Committed... (tag: nfs-utils-2-5-4-rc4)

Nice work!! Thanks again!!!

steved.
> ---
>  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.
>   */
> 




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux