diff options
author | Steve Dickson <steved@redhat.com> | 2014-02-13 12:44:06 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2014-02-13 12:44:06 -0500 |
commit | 327e24b8678c350b70f83f8b58790309a7c94c7b (patch) | |
tree | bcdd02c758eb8721ea4cf993b3c27d5f86e01e00 /utils/nfsd/nfssvc.c | |
parent | 2f682f25c642fcfe7c511d04bc9d67e732282348 (diff) | |
download | nfs-utils-327e24b8678c350b70f83f8b58790309a7c94c7b.tar.gz nfs-utils-327e24b8678c350b70f83f8b58790309a7c94c7b.tar.xz nfs-utils-327e24b8678c350b70f83f8b58790309a7c94c7b.zip |
nfsd: support NFS4_MAXMINOR up to the number an unsigned int can keep
This implementation allows specifying NFS4 minor version numbers up
to the number of bits available in int data type (typically 32 on
Linux)
This is based on an idea mentioned by
J. Bruce Fields <bfields@fieldses.org> mentioned on the linux-nfs mailing list.
I changed the data type back from an array to two bit fields, one for
storing whether the minor version was specified on the command line
and the second one for storing whether it was set or unset. This
change was done to prevent blowing up the allocated stack space in an
unnecessary fashion.
Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/nfsd/nfssvc.c')
-rw-r--r-- | utils/nfsd/nfssvc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c index 1b50aba..1a52cca 100644 --- a/utils/nfsd/nfssvc.c +++ b/utils/nfsd/nfssvc.c @@ -269,7 +269,7 @@ nfssvc_set_sockets(const int family, const unsigned int protobits, } void -nfssvc_setvers(unsigned int ctlbits, int minorvers[]) +nfssvc_setvers(unsigned int ctlbits, unsigned int minorvers, unsigned int minorversset) { int fd, n, off; char *ptr; @@ -281,10 +281,12 @@ nfssvc_setvers(unsigned int ctlbits, int minorvers[]) return; for (n = NFS4_MINMINOR; n <= NFS4_MAXMINOR; n++) { - if (minorvers[n] == 1) - off += snprintf(ptr+off, sizeof(buf) - off, "+4.%d ", n); - else if (minorvers[n] == -1) - off += snprintf(ptr+off, sizeof(buf) - off, "-4.%d ", n); + if (NFSCTL_VERISSET(minorversset, n)) { + if (NFSCTL_VERISSET(minorvers, n)) + off += snprintf(ptr+off, sizeof(buf) - off, "+4.%d ", n); + else + off += snprintf(ptr+off, sizeof(buf) - off, "-4.%d ", n); + } } for (n = NFSD_MINVERS; n <= NFSD_MAXVERS; n++) { if (NFSCTL_VERISSET(ctlbits, n)) |