Skip to contentSkip to conversation

text-based mount.nfs: Plug "bg" processing into nfsmount_s()

PATCH New Chuck Lever 1 participant 1 message Sep 11, 2007

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

PATCH 17/19 text-based mount.nfs: Plug "bg" processing into nfsmount_s()

We have all the pre-requisites now, so add "bg" mount processing to nfsmount_s() to enable background mount processing for text-based NFSv2 and NFSv3 mounts.

---

 utils/mount/stropts.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
utils/mount/stropts.c +13 -6
index ba4486b..5b4cf83 100644
@@ -531,8 +531,6 @@ static int nfsmount_child(const char *spec, const char *node,
  *		(possibly also a return argument)
  * @fake:	flag indicating whether to carry out the whole operation
  * @child:	one if this is a backgrounded mount
- *
- * XXX: need to handle bg, fg, and retry options.
  */
 int nfsmount_s(const char *spec, const char *node, int flags,
 		char **extra_opts, int fake, int child)
@@ -545,14 +543,13 @@ int nfsmount_s(const char *spec, const char *node, int flags,
 	if (!parse_devname(spec, &hostname))
 		return retval;
 	err = fill_ipv4_sockaddr(hostname, &saddr);
-	free(hostname);
 	if (!err)
-		return retval;
+		goto fail;
 
 	options = po_split(*extra_opts);
 	if (!options) {
 		nfs_error(_("%s: internal option parsing error"), progname);
-		return retval;
+		goto fail;
 	}
 
 	if (!append_addr_option(&saddr, options, child))
@@ -561,12 +558,22 @@ int nfsmount_s(const char *spec, const char *node, int flags,
 	if (!fix_up_mounthost_opt(options))
 		goto out;
 
-	if (po_rightmost(options, "bg", "fg") == -1)
+	if (po_rightmost(options, "bg", "fg") > -1) {
 		retval =  nfsmount_fg(spec, node, flags, options,
 							fake, extra_opts);
+	} else {
+		if (!child)
+			retval = nfsmount_parent(spec, node, hostname, flags,
+						 options, fake, extra_opts);
+		else
+			retval = nfsmount_child(spec, node, hostname, flags,
+						options, fake, extra_opts);
+	}
 
 out:
 	po_destroy(options);
+fail:
+	free(hostname);
 	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