diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-09-28 16:36:51 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-09-29 07:58:57 +1000 |
commit | d79455dbd3dfde28e41574786afd0f71a38df746 (patch) | |
tree | cff443487b2207aad6ec65076da982e48f63698b | |
parent | aed4aa1335326f4327bf9799ef63d2f05cfe5e36 (diff) | |
download | nfs-utils-d79455dbd3dfde28e41574786afd0f71a38df746.tar.gz nfs-utils-d79455dbd3dfde28e41574786afd0f71a38df746.tar.xz nfs-utils-d79455dbd3dfde28e41574786afd0f71a38df746.zip |
text-based mount.nfs: add parser init and destroy calls
Introduce parser init and destroy calls in the main text-based mount
handling routines. Don't actually use the parsed option object yet.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r-- | utils/mount/stropts.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 4dbd19e..bdc8f2c 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -305,6 +305,7 @@ static int append_clientaddr_option(struct sockaddr_in *saddr, int nfsmount_s(const char *spec, const char *node, int flags, char **extra_opts, int fake, int child) { + struct mount_options *options = NULL; struct sockaddr_in saddr; char *hostname; int err, retval = EX_FAIL; @@ -318,6 +319,12 @@ int nfsmount_s(const char *spec, const char *node, int flags, extract_interesting_options(*extra_opts); + options = po_split(*extra_opts); + if (!options) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (!child && addr_opt) { nfs_error(_("%s: Illegal option: 'addr='"), progname); goto out; @@ -326,6 +333,11 @@ int nfsmount_s(const char *spec, const char *node, int flags, if (!append_addr_opt(&saddr, extra_opts)) goto out; + if (po_join(options, extra_opts) == PO_FAILED) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (verbose) printf(_("%s: text-based options: '%s'\n"), progname, *extra_opts); @@ -341,6 +353,7 @@ int nfsmount_s(const char *spec, const char *node, int flags, retval = EX_SUCCESS; out: + po_destroy(options); return retval; } @@ -361,6 +374,7 @@ out: int nfs4mount_s(const char *spec, const char *node, int flags, char **extra_opts, int fake, int child) { + struct mount_options *options = NULL; struct sockaddr_in saddr; char *hostname; int err, retval = EX_FAIL; @@ -374,6 +388,12 @@ int nfs4mount_s(const char *spec, const char *node, int flags, extract_interesting_options(*extra_opts); + options = po_split(*extra_opts); + if (!options) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (addr_opt) { nfs_error(_("%s: Illegal option: 'addr='"), progname); goto out; @@ -385,6 +405,11 @@ int nfs4mount_s(const char *spec, const char *node, int flags, if (!ca_opt && !append_clientaddr_opt(&saddr, extra_opts)) goto out; + if (po_join(options, extra_opts) == PO_FAILED) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (verbose) printf(_("%s: text-based options: '%s'\n"), progname, *extra_opts); @@ -400,5 +425,6 @@ int nfs4mount_s(const char *spec, const char *node, int flags, retval = EX_SUCCESS; out: + po_destroy(options); return retval; } |