bc9fd4
commit 5394f939b591e65fec37a6bee826c13620d3f39b
bc9fd4
Author: Justin Mitchell <jumitche@redhat.com>
bc9fd4
Date:   Mon Mar 4 11:53:09 2019 -0500
bc9fd4
bc9fd4
    Add nfs.conf equivalent for the statd --no-notify cmdline option
bc9fd4
    
bc9fd4
    Also cleaned up how nfs.conf is read.
bc9fd4
    
bc9fd4
    Signed-off-by: Justin Mitchell <jumitche@redhat.com>
bc9fd4
    Signed-off-by: Steve Dickson <steved@redhat.com>
bc9fd4
bc9fd4
diff --git a/nfs.conf b/nfs.conf
bc9fd4
index f1ebfdb..d332375 100644
bc9fd4
--- a/nfs.conf
bc9fd4
+++ b/nfs.conf
bc9fd4
@@ -62,6 +62,7 @@
bc9fd4
 # name=
bc9fd4
 # state-directory-path=/var/lib/nfs/statd
bc9fd4
 # ha-callout=
bc9fd4
+# no-notify=0
bc9fd4
 #
bc9fd4
 [sm-notify]
bc9fd4
 # debug=0
bc9fd4
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
bc9fd4
index 2cc6cf3..1467380 100644
bc9fd4
--- a/utils/statd/statd.c
bc9fd4
+++ b/utils/statd/statd.c
bc9fd4
@@ -238,6 +238,39 @@ static void set_nlm_port(char *type, int port)
bc9fd4
 		fprintf(stderr, "%s: failed to open %s: %s\n", 
bc9fd4
 			name_p, pathbuf, strerror(errno));
bc9fd4
 }
bc9fd4
+int port = 0, out_port = 0;
bc9fd4
+int nlm_udp = 0, nlm_tcp = 0;
bc9fd4
+
bc9fd4
+inline static void 
bc9fd4
+read_nfsconf(char **argv)
bc9fd4
+{
bc9fd4
+	char *s;
bc9fd4
+
bc9fd4
+	conf_init_file(NFS_CONFFILE);
bc9fd4
+	xlog_from_conffile("statd");
bc9fd4
+
bc9fd4
+	out_port = conf_get_num("statd", "outgoing-port", out_port);
bc9fd4
+	port = conf_get_num("statd", "port", port);
bc9fd4
+
bc9fd4
+	MY_NAME = conf_get_str("statd", "name");
bc9fd4
+	if (MY_NAME)
bc9fd4
+		run_mode |= STATIC_HOSTNAME;
bc9fd4
+
bc9fd4
+	s = conf_get_str("statd", "state-directory-path");
bc9fd4
+	if (s && !nsm_setup_pathnames(argv[0], s))
bc9fd4
+		exit(1);
bc9fd4
+
bc9fd4
+	s = conf_get_str("statd", "ha-callout");
bc9fd4
+	if (s)
bc9fd4
+		ha_callout_prog = s;
bc9fd4
+
bc9fd4
+	nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
bc9fd4
+	/* udp defaults to the same as tcp ! */
bc9fd4
+	nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
bc9fd4
+
bc9fd4
+	if (conf_get_bool("statd", "no-notify", false))
bc9fd4
+		run_mode |= MODE_NO_NOTIFY;
bc9fd4
+}
bc9fd4
 
bc9fd4
 /*
bc9fd4
  * Entry routine/main loop.
bc9fd4
@@ -245,11 +278,8 @@ static void set_nlm_port(char *type, int port)
bc9fd4
 int main (int argc, char **argv)
bc9fd4
 {
bc9fd4
 	extern char *optarg;
bc9fd4
-	char *s;
bc9fd4
 	int pid;
bc9fd4
 	int arg;
bc9fd4
-	int port = 0, out_port = 0;
bc9fd4
-	int nlm_udp = 0, nlm_tcp = 0;
bc9fd4
 	struct rlimit rlim;
bc9fd4
 	int notify_sockfd;
bc9fd4
 	char *env;
bc9fd4
@@ -275,23 +305,8 @@ int main (int argc, char **argv)
bc9fd4
 	/* Set hostname */
bc9fd4
 	MY_NAME = NULL;
bc9fd4
 
bc9fd4
-	conf_init_file(NFS_CONFFILE);
bc9fd4
-	xlog_from_conffile("statd");
bc9fd4
-	out_port = conf_get_num("statd", "outgoing-port", out_port);
bc9fd4
-	port = conf_get_num("statd", "port", port);
bc9fd4
-	MY_NAME = conf_get_str("statd", "name");
bc9fd4
-	if (MY_NAME)
bc9fd4
-		run_mode |= STATIC_HOSTNAME;
bc9fd4
-	s = conf_get_str("statd", "state-directory-path");
bc9fd4
-	if (s && !nsm_setup_pathnames(argv[0], s))
bc9fd4
-		exit(1);
bc9fd4
-	s = conf_get_str("statd", "ha-callout");
bc9fd4
-	if (s)
bc9fd4
-		ha_callout_prog = s;
bc9fd4
-
bc9fd4
-	nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
bc9fd4
-	/* udp defaults to the same as tcp ! */
bc9fd4
-	nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
bc9fd4
+	/* Read nfs.conf */
bc9fd4
+	read_nfsconf(argv);
bc9fd4
 
bc9fd4
 	/* Process command line switches */
bc9fd4
 	while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:LT:U:", longopts, NULL)) != EOF) {