diff options
author | mux <mux@FreeBSD.org> | 2002-05-16 17:09:41 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-05-16 17:09:41 +0000 |
commit | 84d9baf797fd0cb8bf24b083c62619d68490b6f3 (patch) | |
tree | 7cb5866f5614d933293ee7c32544027c016b86be | |
parent | e68ba0faa3db6041396bc9d3ab83d8db9e561fd9 (diff) | |
download | FreeBSD-src-84d9baf797fd0cb8bf24b083c62619d68490b6f3.zip FreeBSD-src-84d9baf797fd0cb8bf24b083c62619d68490b6f3.tar.gz |
o Fix vfs_copyopt(), the first argument to bcopy() is the source,
not the destination.
o Remove some code from vfs_getopt() which was making the interface
more complicated to use for a very slight gain.
-rw-r--r-- | sys/kern/vfs_subr.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8ec7885..bb92a8c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -491,16 +491,10 @@ vfs_timestamp(tsp) /* * Get a mount option by its name. * - * Return 0 if the option was found. - * Return ENOENT if the option wasn't found. - * If len is a non-NULL pointer and *len - * a integer different from 0, then the size - * of the option will be compared with *len and - * if they doesn't match, EINVAL is returned. - * If len is non-NULL and *len == 0, it will - * be filled with the length of the option. - * Finally, if buf is non-NULL, it will be - * filled with the address of the option. + * Return 0 if the option was found, ENOENT otherwise. + * If len is non-NULL it will be filled with the length + * of the option. If buf is non-NULL, it will be filled + * with the address of the option. */ int vfs_getopt(opts, name, buf, len) @@ -516,11 +510,8 @@ vfs_getopt(opts, name, buf, len) opt = opts->opt; while (i++ < opts->optcnt) { if (strcmp(name, opt->name) == 0) { - if (len != NULL) { - if ((*len != 0) && (*len != opt->len)) - return (EINVAL); + if (len != NULL) *len = opt->len; - } if (buf != NULL) *buf = opt->value; return (0); @@ -555,7 +546,7 @@ vfs_copyopt(opts, name, dest, len, done) if (strcmp(name, opt->name) == 0) { if (len < opt->len) return (EINVAL); - bcopy(dest, opt->value, opt->len); + bcopy(opt->value, dest, opt->len); if (done != NULL) *done = opt->len; return (0); |