Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2008 19:10:38 +0100
From:      Dominic Fandrey <kamikaze@bsdforen.de>
To:        remko@elvandar.org
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/120784: [patch] mount(8): allow mount from fstab with 3rd party tools like ntfs-3g
Message-ID:  <47BB1B9E.2060901@bsdforen.de>
In-Reply-To: <51591.195.64.94.120.1203440608.squirrel@galain.elvandar.org>
References:  <200802191650.m1JGo2Hk005394@freefall.freebsd.org> <51591.195.64.94.120.1203440608.squirrel@galain.elvandar.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Remko Lodder wrote:
> Guess not :-)
> 
> The diff was readable at least through the email I received, so at least
> we can get working on this ;)
> 

True. I just don't get Thunderbird to avoid the base64 encoding. It simply 
ignores my settings.

Anyway, I have an alternative patch, that gets rid of use_mountprog(). I 
think this is a cleaner way of handling this at the cost of not having the 
list of vfstypes that haven't been migrated to nmount in the source code any 
more.
An advantage is that no changes to a static list in mount.c have to be made 
once they are implemented. They will just start working.

Thank you for looking into this.


diff -Pur sbin/mount.orig/mount.c sbin/mount/mount.c
--- sbin/mount.orig/mount.c	2008-02-18 19:44:05.000000000 +0100
+++ sbin/mount/mount.c	2008-02-19 19:02:43.000000000 +0100
@@ -126,28 +126,6 @@
  static const char groupquotaeq[] = "groupquota=";

  static int
-use_mountprog(const char *vfstype)
-{
-	/* XXX: We need to get away from implementing external mount
-	 *      programs for every filesystem, and move towards having
-	 *	each filesystem properly implement the nmount() system call.
-	 */
-	unsigned int i;
-	const char *fs[] = {
-	"cd9660", "mfs", "msdosfs", "nfs", "nfs4", "ntfs",
-	"nwfs", "nullfs", "portalfs", "smbfs", "udf", "unionfs",
-	NULL
-	};
-
-	for (i = 0; fs[i] != NULL; ++i) {
-		if (strcmp(vfstype, fs[i]) == 0)
-			return (1);
-	}
-	
-	return (0);
-}
-
-static int
  exec_mountprog(const char *name, const char *execname, char *const argv[])
  {
  	pid_t pid;
@@ -547,20 +525,18 @@
  	argv[argc] = NULL;

  	if (debug) {
-		if (use_mountprog(vfstype))
-			printf("exec: mount_%s", vfstype);
-		else
-			printf("mount -t %s", vfstype);
+		printf("mount -t %s", vfstype);
  		for (i = 1; i < argc; i++)
  			(void)printf(" %s", argv[i]);
  		(void)printf("\n");
  		return (0);
  	}

-	if (use_mountprog(vfstype)) {
+	ret = mount_fs(vfstype, argc, argv);
+	if (ret < 0) {
+		if (verbose)
+			warn("falling back to old style mount");
  		ret = exec_mountprog(name, execname, argv);
-	} else {
-		ret = mount_fs(vfstype, argc, argv);
  	}

  	free(optbuf);
diff -Pur sbin/mount.orig/mount_fs.c sbin/mount/mount_fs.c
--- sbin/mount.orig/mount_fs.c	2008-02-18 19:44:05.000000000 +0100
+++ sbin/mount/mount_fs.c	2008-02-18 19:44:37.000000000 +0100
@@ -107,6 +107,11 @@
  				val = p + 1;
  			}
  			build_iovec(&iov, &iovlen, optarg, val, (size_t)-1);
+			// Repair arguments, in case they are required when
+			// falling back to the old style exec_mountprog.
+			if (p != NULL) {
+				*p = '=';
+			}
  			break;
  		case '?':
  		default:
@@ -131,8 +136,6 @@
  	build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
  	
  	ret = nmount(iov, iovlen, mntflags);
-	if (ret < 0)
-		err(1, "%s %s", dev, errmsg);

  	return (ret);
  }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47BB1B9E.2060901>