[ RFC PATCH 5/4 ] Add wsync export option to nfs-utils

bpm
2010-02-03T23:47:24Z

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]

[-- Attachment #2: out --]
[-- Type: text/plain, Size: 1971 bytes --]

commit 0eacb0dffa603b6fa2dded1d99e9e1d2be73c5da
Author: Ben Myers <bpm@sgi.com>
Date: Wed Feb 3 16:05:22 2010 -0600

diff --git a/support/include/nfs/export.h b/support/include/nfs/export.h
index 1547a87..8119b9a 100644
--- a/support/include/nfs/export.h
+++ b/support/include/nfs/export.h
@@ -17,7 +17,8 @@
#define NFSEXP_ALLSQUASH 0x0008
#define NFSEXP_ASYNC 0x0010
#define NFSEXP_GATHERED_WRITES 0x0020
-/* 40, 80, 100 unused */
+#define NFSEXP_WSYNC 0x0040
+/* 80, 100 unused */
#define NFSEXP_NOHIDE 0x0200
#define NFSEXP_NOSUBTREECHECK 0x0400
#define NFSEXP_NOAUTHNLM 0x0800
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index a93941c..51b94d8 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -223,6 +223,7 @@ putexportent(struct exportent *ep)
FILE *fp;
int *id, i;
char *esc=ep->e_path;
+ char *syncchar;

if (!efp)
return;
@@ -236,7 +237,14 @@ putexportent(struct exportent *ep)

fprintf(fp, "\t%s(", ep->e_hostname);
fprintf(fp, "%s,", (ep->e_flags & NFSEXP_READONLY)? "ro" : "rw");
- fprintf(fp, "%ssync,", (ep->e_flags & NFSEXP_ASYNC)? "a" : "");
+ if (ep->e_flags & NFSEXP_ASYNC) {
+ syncchar = "a";
+ } else if (ep->e_flags & NFSEXP_WSYNC) {
+ syncchar = "w";
+ } else {
+ syncchar = "";
+ }
+ fprintf(fp, "%ssync,", syncchar);
fprintf(fp, "%swdelay,", (ep->e_flags & NFSEXP_GATHERED_WRITES)?
"" : "no_");
fprintf(fp, "%shide,", (ep->e_flags & NFSEXP_NOHIDE)?
@@ -519,7 +527,10 @@ parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
clearflags(NFSEXP_ASYNC, active, ep);
else if (!strcmp(opt, "async"))
setflags(NFSEXP_ASYNC, active, ep);
- else if (!strcmp(opt, "nohide"))
+ else if (!strcmp(opt, "wsync")) {
+ clearflags(NFSEXP_ASYNC, active, ep);
+ setflags(NFSEXP_WSYNC, active, ep);
+ } else if (!strcmp(opt, "nohide"))
setflags(NFSEXP_NOHIDE, active, ep);
else if (!strcmp(opt, "hide"))
clearflags(NFSEXP_NOHIDE, active, ep);