Skip to contentSkip to conversation

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

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

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

PATCH 21/24 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 |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
utils/mount/stropts.c +12 -5
index e5be243..d2d7e9f 100644
@@ -554,8 +554,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)
@@ -568,14 +566,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))
@@ -587,9 +584,19 @@ int nfsmount_s(const char *spec, const char *node, int flags,
 	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