FreeBSD Bugzilla – Attachment 107164 Details for
Bug 147881
[zfs] [patch] ZFS "sharenfs" doesn't allow different "exports" options for different hosts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.53 KB, created by
Richard S. Conto
on 2010-06-15 17:00:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Richard S. Conto
Created:
2010-06-15 17:00:01 UTC
Size:
3.53 KB
patch
obsolete
>Index: ./src/cddl/compat/opensolaris/misc/fsshare.c >=================================================================== >RCS file: /shares/Home/cvsupin/FreeBSD/FreeBSD-all/src/cddl/compat/opensolaris/misc/fsshare.c,v >retrieving revision 1.3.4.1 >diff -c -b -w -r1.3.4.1 fsshare.c >*** ./src/cddl/compat/opensolaris/misc/fsshare.c 3 Aug 2009 08:13:06 -0000 1.3.4.1 >--- ./src/cddl/compat/opensolaris/misc/fsshare.c 13 Jun 2010 18:11:53 -0000 >*************** >*** 32,37 **** >--- 32,38 ---- > #include <unistd.h> > #include <fcntl.h> > #include <string.h> >+ #include <strings.h> > #include <errno.h> > #include <libutil.h> > #include <assert.h> >*************** >*** 149,157 **** > int share) > { > char tmpfile[PATH_MAX]; > char *line; > FILE *newfd, *oldfd; >! int fd, error; > > newfd = oldfd = NULL; > error = 0; >--- 150,160 ---- > int share) > { > char tmpfile[PATH_MAX]; >+ char each[OPTSSIZE]; /* Multiple export options per filesystem. */ > char *line; >+ char *cur, *next; /* Next set of mountopts/hosts */ > FILE *newfd, *oldfd; >! int fd, error, count; > > newfd = oldfd = NULL; > error = 0; >*************** >*** 209,217 **** >--- 212,287 ---- > goto out; > } > if (share) { >+ /* >+ * if 'shareopts' has ';' separators, then put out multiple >+ * exports points with (with presumeably different mountoptions and >+ * hosts.) >+ * >+ * If the mount options begin with a '#', treat as a comment and IGNORE >+ * (to allow ZFS administrators to leave configurations in place but disabled.) >+ */ >+ >+ if ((next = index(shareopts, ';')) == (char *) NULL) { >+ /* Original FreeBSD implementation - compatibility? >+ * Note: This DOESN'T check for '#' comment configurations! >+ */ > fprintf(newfd, "%s\t%s\n", mountpoint, > translate_opts(shareopts)); >+ } else { >+ /* This code doesn't need to be guarded - except for the >+ * extra noise comments it puts into the exports file. */ >+ count = 0; >+ strncpy (each, shareopts, sizeof(each)-1); /* Local copy to edit. */ >+ >+ fprintf(newfd, "#\n#%s\t%s\n", mountpoint, shareopts); /* verbose: show originale */ >+ >+ for (cur=each, next = index (each, ';'); next != (char *) NULL; >+ next = index(next+1, ';')) { >+ /* If we blow up writing the new exports file, don't use it! */ >+ if (ferror(newfd)) { >+ error = ferror(newfd); >+ goto out; >+ } >+ >+ *next = '\0'; /* Clobber the ';' */ >+ >+ /* Skip leading whitespace. */ >+ while (*cur && isspace(*cur)) { >+ cur ++; >+ } >+ /* If there is anything left, use it - if it isn't a comment. */ >+ if (*cur && (*cur != '#')) { >+ fprintf(newfd, "%s\t%s\n", mountpoint, >+ translate_opts(cur)); >+ count ++; /* Count only mountpoints */ >+ } >+ >+ cur = next + 1; /* Point past the ';' we found. */ >+ } >+ >+ /* If anything is left, run it out too. */ >+ if (*cur) { >+ /* Skip leading whitespace. */ >+ while (*cur && isspace(*cur)) { >+ cur ++; >+ } >+ if (*cur && (*cur != '#')) { >+ fprintf(newfd, "%s\t%s\n", mountpoint, >+ translate_opts(cur)); >+ count ++; >+ } >+ } >+ >+ fprintf(newfd, "# %d exports of \"%s\"\n", mountpoint); >+ >+ } /* multi-valued ';' stuff (with '#'s too.) */ >+ >+ /* If we blew up writing the new exports file, don't use it! */ >+ if (ferror(newfd)) { >+ error = ferror(newfd); >+ goto out; > } >+ } /* if (share) */ > > out: > if (error != 0)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 147881
: 107164 |
107165