Skip to contentSkip to conversation

text-based mount.nfs: add parser init and destroy calls

PATCH In review Chuck Lever 1 participant 1 message Sep 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/7 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.

---

 utils/mount/stropts.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
utils/mount/stropts.c +26 -0
index 4dbd19e..bdc8f2c 100644
@@ -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;
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs