diff mbox series

[nfs-utils,RFC,v3,6/8] nfsdcld: add /etc/nfs.conf support

Message ID 20190326220730.3763-7-smayhew@redhat.com (mailing list archive)
State New, archived
Headers show
Series restore nfsdcld | expand

Commit Message

Scott Mayhew March 26, 2019, 10:07 p.m. UTC
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 nfs.conf                  |  4 ++++
 utils/nfsdcld/nfsdcld.c   | 13 +++++++++++++
 utils/nfsdcld/nfsdcld.man | 15 +++++++++++++++
 3 files changed, 32 insertions(+)

Comments

Yongcheng Yang April 2, 2020, 3:23 a.m. UTC | #1
Hi Scott,

Sorry for jumping back into this thread after one year.

Maybe one another man page nfs.conf(5) (i.e. systemd/nfs.conf.man)
also needs an update (just as nfsdcltrack does).

Thanks,
Yongcheng

On Tue, Mar 26, 2019 at 06:07:28PM -0400, Scott Mayhew wrote:
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> ---
>  nfs.conf                  |  4 ++++
>  utils/nfsdcld/nfsdcld.c   | 13 +++++++++++++
>  utils/nfsdcld/nfsdcld.man | 15 +++++++++++++++
>  3 files changed, 32 insertions(+)
> 
> diff --git a/nfs.conf b/nfs.conf
> index 796bee4..aabf300 100644
> --- a/nfs.conf
> +++ b/nfs.conf
> @@ -34,6 +34,10 @@
>  # state-directory-path=/var/lib/nfs
>  # ha-callout=
>  #
> +[nfsdcld]
> +# debug=0
> +# storagedir=/var/lib/nfs/nfsdcld
> +#
>  [nfsdcltrack]
>  # debug=0
>  # storagedir=/var/lib/nfs/nfsdcltrack
> diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c
> index 272c7c5..313c68f 100644
> --- a/utils/nfsdcld/nfsdcld.c
> +++ b/utils/nfsdcld/nfsdcld.c
> @@ -45,6 +45,7 @@
>  #include "cld-internal.h"
>  #include "sqlite.h"
>  #include "../mount/version.h"
> +#include "conffile.h"
>  
>  #ifndef DEFAULT_PIPEFS_DIR
>  #define DEFAULT_PIPEFS_DIR NFS_STATEDIR "/rpc_pipefs"
> @@ -640,6 +641,7 @@ main(int argc, char **argv)
>  	char *progname;
>  	char *storagedir = CLD_DEFAULT_STORAGEDIR;
>  	struct cld_client clnt;
> +	char *s;
>  
>  	memset(&clnt, 0, sizeof(clnt));
>  
> @@ -653,6 +655,17 @@ main(int argc, char **argv)
>  	xlog_syslog(0);
>  	xlog_stderr(1);
>  
> +	conf_init_file(NFS_CONFFILE);
> +	s = conf_get_str("general", "pipefs-directory");
> +	if (s)
> +		strlcpy(pipefs_dir, s, sizeof(pipefs_dir));
> +	s = conf_get_str("nfsdcld", "storagedir");
> +	if (s)
> +		storagedir = s;
> +	rc = conf_get_num("nfsdcld", "debug", 0);
> +	if (rc > 0)
> +		xlog_config(D_ALL, 1);
> +
>  	/* process command-line options */
>  	while ((arg = getopt_long(argc, argv, "hdFp:s:", longopts,
>  				  NULL)) != EOF) {
> diff --git a/utils/nfsdcld/nfsdcld.man b/utils/nfsdcld/nfsdcld.man
> index b607ba6..c271d14 100644
> --- a/utils/nfsdcld/nfsdcld.man
> +++ b/utils/nfsdcld/nfsdcld.man
> @@ -163,6 +163,21 @@ Location of the rpc_pipefs filesystem. The default value is
>  .IX Item "-s storagedir, --storagedir=storage_dir"
>  Directory where stable storage information should be kept. The default
>  value is \fI/var/lib/nfs/nfsdcld\fR.
> +.SH "CONFIGURATION FILE"
> +.IX Header "CONFIGURATION FILE"
> +The following values are recognized in the \fB[nfsdcld]\fR section
> +of the \fI/etc/nfs.conf\fR configuration file:
> +.IP "\fBstoragedir\fR" 4
> +.IX Item "storagedir"
> +Equivalent to \fB\-s\fR/\fB\-\-storagedir\fR.
> +.IP "\fBdebug\fR" 4
> +.IX Item "debug"
> +Setting "debug = 1" is equivalent to \fB\-d\fR/\fB\-\-debug\fR.
> +.LP
> +In addition, the following value is recognized from the \fB[general]\fR section:
> +.IP "\fBpipefs\-directory\fR" 4
> +.IX Item "pipefs-directory"
> +Equivalent to \fB\-p\fR/\fB\-\-pipefsdir\fR.
>  .SH "NOTES"
>  .IX Header "NOTES"
>  The Linux kernel NFSv4 server has historically tracked this information
> -- 
> 2.17.2
>
diff mbox series

Patch

diff --git a/nfs.conf b/nfs.conf
index 796bee4..aabf300 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -34,6 +34,10 @@ 
 # state-directory-path=/var/lib/nfs
 # ha-callout=
 #
+[nfsdcld]
+# debug=0
+# storagedir=/var/lib/nfs/nfsdcld
+#
 [nfsdcltrack]
 # debug=0
 # storagedir=/var/lib/nfs/nfsdcltrack
diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c
index 272c7c5..313c68f 100644
--- a/utils/nfsdcld/nfsdcld.c
+++ b/utils/nfsdcld/nfsdcld.c
@@ -45,6 +45,7 @@ 
 #include "cld-internal.h"
 #include "sqlite.h"
 #include "../mount/version.h"
+#include "conffile.h"
 
 #ifndef DEFAULT_PIPEFS_DIR
 #define DEFAULT_PIPEFS_DIR NFS_STATEDIR "/rpc_pipefs"
@@ -640,6 +641,7 @@  main(int argc, char **argv)
 	char *progname;
 	char *storagedir = CLD_DEFAULT_STORAGEDIR;
 	struct cld_client clnt;
+	char *s;
 
 	memset(&clnt, 0, sizeof(clnt));
 
@@ -653,6 +655,17 @@  main(int argc, char **argv)
 	xlog_syslog(0);
 	xlog_stderr(1);
 
+	conf_init_file(NFS_CONFFILE);
+	s = conf_get_str("general", "pipefs-directory");
+	if (s)
+		strlcpy(pipefs_dir, s, sizeof(pipefs_dir));
+	s = conf_get_str("nfsdcld", "storagedir");
+	if (s)
+		storagedir = s;
+	rc = conf_get_num("nfsdcld", "debug", 0);
+	if (rc > 0)
+		xlog_config(D_ALL, 1);
+
 	/* process command-line options */
 	while ((arg = getopt_long(argc, argv, "hdFp:s:", longopts,
 				  NULL)) != EOF) {
diff --git a/utils/nfsdcld/nfsdcld.man b/utils/nfsdcld/nfsdcld.man
index b607ba6..c271d14 100644
--- a/utils/nfsdcld/nfsdcld.man
+++ b/utils/nfsdcld/nfsdcld.man
@@ -163,6 +163,21 @@  Location of the rpc_pipefs filesystem. The default value is
 .IX Item "-s storagedir, --storagedir=storage_dir"
 Directory where stable storage information should be kept. The default
 value is \fI/var/lib/nfs/nfsdcld\fR.
+.SH "CONFIGURATION FILE"
+.IX Header "CONFIGURATION FILE"
+The following values are recognized in the \fB[nfsdcld]\fR section
+of the \fI/etc/nfs.conf\fR configuration file:
+.IP "\fBstoragedir\fR" 4
+.IX Item "storagedir"
+Equivalent to \fB\-s\fR/\fB\-\-storagedir\fR.
+.IP "\fBdebug\fR" 4
+.IX Item "debug"
+Setting "debug = 1" is equivalent to \fB\-d\fR/\fB\-\-debug\fR.
+.LP
+In addition, the following value is recognized from the \fB[general]\fR section:
+.IP "\fBpipefs\-directory\fR" 4
+.IX Item "pipefs-directory"
+Equivalent to \fB\-p\fR/\fB\-\-pipefsdir\fR.
 .SH "NOTES"
 .IX Header "NOTES"
 The Linux kernel NFSv4 server has historically tracked this information