diff options
author | NeilBrown <neilb@suse.com> | 2016-12-06 12:57:19 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2016-12-20 13:29:04 -0500 |
commit | 36b268c6f3bc807ecf4f59ff64eea663146fba4b (patch) | |
tree | 2d1843a589672c48ba4254b41c27eb0ef69c2516 /utils/mountd/mountd.c | |
parent | d5aa458f11847bfa9a53df120485aa84cde357cd (diff) | |
download | nfs-utils-36b268c6f3bc807ecf4f59ff64eea663146fba4b.tar.gz nfs-utils-36b268c6f3bc807ecf4f59ff64eea663146fba4b.tar.xz nfs-utils-36b268c6f3bc807ecf4f59ff64eea663146fba4b.zip |
Add /etc/nfs.conf support for mountd.
Some values are taken from the [nfsd] section
to ensure consistency.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd/mountd.c')
-rw-r--r-- | utils/mountd/mountd.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index d6cebbb..2048fce 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -22,6 +22,8 @@ #include <fcntl.h> #include <sys/resource.h> #include <sys/wait.h> + +#include "conffile.h" #include "xmalloc.h" #include "misc.h" #include "mountd.h" @@ -38,6 +40,8 @@ int reverse_resolve = 0; int manage_gids; int use_ipaddr = -1; +char *conf_path = NFS_CONFFILE; + /* 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 */ @@ -654,6 +658,7 @@ main(int argc, char **argv) { char *state_dir = NFS_STATEDIR; char *progname; + char *s; unsigned int listeners = 0; int foreground = 0; int port = 0; @@ -669,6 +674,37 @@ main(int argc, char **argv) else progname = argv[0]; + conf_init(); + manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids); + descriptors = conf_get_num("mountd", "descriptors", descriptors); + port = conf_get_num("mountd", "port", port); + num_threads = conf_get_num("mountd", "threads", num_threads); + reverse_resolve = conf_get_bool("mountd", "reverse-lookup", reverse_resolve); + ha_callout_prog = conf_get_str("mountd", "ha-callout"); + + s = conf_get_str("mountd", "state-directory-path"); + if (s) + state_dir = s; + + /* NOTE: following uses "nfsd" section of nfs.conf !!!! */ + if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(_rpcprotobits))) + NFSCTL_UDPSET(_rpcprotobits); + else + NFSCTL_UDPUNSET(_rpcprotobits); + if (conf_get_bool("nfsd", "tcp", NFSCTL_TCPISSET(_rpcprotobits))) + NFSCTL_TCPSET(_rpcprotobits); + else + NFSCTL_TCPUNSET(_rpcprotobits); + for (vers = 2; vers <= 4; vers++) { + char tag[10]; + sprintf(tag, "vers%d", vers); + if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(nfs_version, vers))) + NFSCTL_VERSET(nfs_version, vers); + else + NFSCTL_VERUNSET(nfs_version, vers); + } + + /* Parse the command line options and arguments. */ opterr = 0; while ((c = getopt_long(argc, argv, "o:nFd:p:P:hH:N:V:vurs:t:g", longopts, NULL)) != EOF) |