[nfs-utils PATCH RFC v3 5/8] nfsdcld: the -p option should specify the rpc_pipefs mountpoint

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

 



Change the -p option to specify the rpc_pipefs mountpoint rather than
the full path to the cld pipe file.  This is consistent with other
daemons that use the rpc_pipefs filesystem.

Signed-off-by: Scott Mayhew <smayhew@xxxxxxxxxx>
---
 utils/nfsdcld/nfsdcld.c   | 17 ++++++++++-------
 utils/nfsdcld/nfsdcld.man |  9 ++++-----
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c
index 9b1ad98..272c7c5 100644
--- a/utils/nfsdcld/nfsdcld.c
+++ b/utils/nfsdcld/nfsdcld.c
@@ -46,11 +46,11 @@
 #include "sqlite.h"
 #include "../mount/version.h"
 
-#ifndef PIPEFS_DIR
-#define PIPEFS_DIR NFS_STATEDIR "/rpc_pipefs"
+#ifndef DEFAULT_PIPEFS_DIR
+#define DEFAULT_PIPEFS_DIR NFS_STATEDIR "/rpc_pipefs"
 #endif
 
-#define DEFAULT_CLD_PATH	PIPEFS_DIR "/nfsd/cld"
+#define DEFAULT_CLD_PATH	"/nfsd/cld"
 
 #ifndef CLD_DEFAULT_STORAGEDIR
 #define CLD_DEFAULT_STORAGEDIR NFS_STATEDIR "/nfsdcld"
@@ -63,7 +63,8 @@
 /* private data structures */
 
 /* global variables */
-static char *pipepath = DEFAULT_CLD_PATH;
+static char pipefs_dir[PATH_MAX] = DEFAULT_PIPEFS_DIR;
+static char pipepath[PATH_MAX];
 static int 		inotify_fd = -1;
 static struct event	pipedir_event;
 static bool old_kernel = false;
@@ -73,7 +74,7 @@ static struct option longopts[] =
 	{ "help", 0, NULL, 'h' },
 	{ "foreground", 0, NULL, 'F' },
 	{ "debug", 0, NULL, 'd' },
-	{ "pipe", 1, NULL, 'p' },
+	{ "pipefsdir", 1, NULL, 'p' },
 	{ "storagedir", 1, NULL, 's' },
 	{ NULL, 0, 0, 0 },
 };
@@ -84,7 +85,7 @@ static void cldcb(int UNUSED(fd), short which, void *data);
 static void
 usage(char *progname)
 {
-	printf("%s [ -hFd ] [ -p pipe ] [ -s dir ]\n", progname);
+	printf("%s [ -hFd ] [ -p pipefsdir ] [ -s storagedir ]\n", progname);
 }
 
 static int
@@ -663,7 +664,7 @@ main(int argc, char **argv)
 			foreground = true;
 			break;
 		case 'p':
-			pipepath = optarg;
+			strlcpy(pipefs_dir, optarg, sizeof(pipefs_dir));
 			break;
 		case 's':
 			storagedir = optarg;
@@ -674,6 +675,8 @@ main(int argc, char **argv)
 		}
 	}
 
+	strlcpy(pipepath, pipefs_dir, sizeof(pipepath));
+	strlcat(pipepath, DEFAULT_CLD_PATH, sizeof(pipepath));
 
 	xlog_open(progname);
 	if (!foreground) {
diff --git a/utils/nfsdcld/nfsdcld.man b/utils/nfsdcld/nfsdcld.man
index 9ddaf64..b607ba6 100644
--- a/utils/nfsdcld/nfsdcld.man
+++ b/utils/nfsdcld/nfsdcld.man
@@ -155,11 +155,10 @@ Enable debug level logging.
 .IP "\fB\-F\fR, \fB\-\-foreground\fR" 4
 .IX Item "-F, --foreground"
 Runs the daemon in the foreground and prints all output to stderr
-.IP "\fB\-p\fR \fIpipe\fR, \fB\-\-pipe\fR=\fIpipe\fR" 4
-.IX Item "-p pipe, --pipe=pipe"
-Location of the \*(L"cld\*(R" upcall pipe. The default value is
-\&\fI/var/lib/nfs/rpc_pipefs/nfsd/cld\fR. If the pipe does not exist when the
-daemon starts then it will wait for it to be created.
+.IP "\fB\-p\fR \fIpath\fR, \fB\-\-pipefsdir\fR=\fIpath\fR" 4
+.IX Item "-p path, --pipefsdir=path"
+Location of the rpc_pipefs filesystem. The default value is
+\&\fI/var/lib/nfs/rpc_pipefs\fR.
 .IP "\fB\-s\fR \fIstorage_dir\fR, \fB\-\-storagedir\fR=\fIstorage_dir\fR" 4
 .IX Item "-s storagedir, --storagedir=storage_dir"
 Directory where stable storage information should be kept. The default
-- 
2.17.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