diff mbox series

[1/2] mountd: Cleanup how config options are read in

Message ID 20210201230147.45593-1-steved@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/2] mountd: Cleanup how config options are read in | expand

Commit Message

Steve Dickson Feb. 1, 2021, 11:01 p.m. UTC
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mountd/mountd.c | 49 +++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 20 deletions(-)

Comments

Steve Dickson Feb. 2, 2021, 5:02 p.m. UTC | #1
On 2/1/21 6:01 PM, Steve Dickson wrote:
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed... (tag: nfs-utils-2-5-3-rc5)

steved.
> ---
>  utils/mountd/mountd.c | 49 +++++++++++++++++++++++++------------------
>  1 file changed, 29 insertions(+), 20 deletions(-)
> 
> diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
> index 07bcdc5a..988e51c5 100644
> --- a/utils/mountd/mountd.c
> +++ b/utils/mountd/mountd.c
> @@ -661,30 +661,17 @@ get_exportlist(void)
>  	return elist;
>  }
>  
> -int
> -main(int argc, char **argv)
> +int	vers;
> +int	port = 0;
> +int	descriptors = 0;
> +
> +inline static void 
> +read_mount_conf(char **argv)
>  {
> -	char	*progname;
>  	char	*s;
> -	unsigned int listeners = 0;
> -	int	foreground = 0;
> -	int	port = 0;
> -	int	descriptors = 0;
> -	int	c;
> -	int	vers;
> -	struct sigaction sa;
> -	struct rlimit rlim;
> -
> -	/* Set the basename */
> -	if ((progname = strrchr(argv[0], '/')) != NULL)
> -		progname++;
> -	else
> -		progname = argv[0];
> -
> -	/* Initialize logging. */
> -	xlog_open(progname);
>  
>  	conf_init_file(NFS_CONFFILE);
> +
>  	xlog_from_conffile("mountd");
>  	manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
>  	descriptors = conf_get_num("mountd", "descriptors", descriptors);
> @@ -714,7 +701,29 @@ main(int argc, char **argv)
>  		else
>  			NFSCTL_VERUNSET(nfs_version, vers);
>  	}
> +}
> +
> +int
> +main(int argc, char **argv)
> +{
> +	char	*progname;
> +	unsigned int listeners = 0;
> +	int	foreground = 0;
> +	int	c;
> +	struct sigaction sa;
> +	struct rlimit rlim;
> +
> +	/* Set the basename */
> +	if ((progname = strrchr(argv[0], '/')) != NULL)
> +		progname++;
> +	else
> +		progname = argv[0];
> +
> +	/* Initialize logging. */
> +	xlog_open(progname);
>  
> +	/* Read in config setting */
> +	read_mount_conf(argv);
>  
>  	/* Parse the command line options and arguments. */
>  	opterr = 0;
>
diff mbox series

Patch

diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 07bcdc5a..988e51c5 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -661,30 +661,17 @@  get_exportlist(void)
 	return elist;
 }
 
-int
-main(int argc, char **argv)
+int	vers;
+int	port = 0;
+int	descriptors = 0;
+
+inline static void 
+read_mount_conf(char **argv)
 {
-	char	*progname;
 	char	*s;
-	unsigned int listeners = 0;
-	int	foreground = 0;
-	int	port = 0;
-	int	descriptors = 0;
-	int	c;
-	int	vers;
-	struct sigaction sa;
-	struct rlimit rlim;
-
-	/* Set the basename */
-	if ((progname = strrchr(argv[0], '/')) != NULL)
-		progname++;
-	else
-		progname = argv[0];
-
-	/* Initialize logging. */
-	xlog_open(progname);
 
 	conf_init_file(NFS_CONFFILE);
+
 	xlog_from_conffile("mountd");
 	manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
 	descriptors = conf_get_num("mountd", "descriptors", descriptors);
@@ -714,7 +701,29 @@  main(int argc, char **argv)
 		else
 			NFSCTL_VERUNSET(nfs_version, vers);
 	}
+}
+
+int
+main(int argc, char **argv)
+{
+	char	*progname;
+	unsigned int listeners = 0;
+	int	foreground = 0;
+	int	c;
+	struct sigaction sa;
+	struct rlimit rlim;
+
+	/* Set the basename */
+	if ((progname = strrchr(argv[0], '/')) != NULL)
+		progname++;
+	else
+		progname = argv[0];
+
+	/* Initialize logging. */
+	xlog_open(progname);
 
+	/* Read in config setting */
+	read_mount_conf(argv);
 
 	/* Parse the command line options and arguments. */
 	opterr = 0;