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

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

 



Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 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;
-- 
2.29.2




[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