bin/120784: [patch] mount(8): allow mount from fstab with 3rd
party tools like ntfs-3g
Dominic Fandrey
kamikaze at bsdforen.de
Tue Feb 19 18:32:39 UTC 2008
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);
}
More information about the freebsd-bugs
mailing list