From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 19 18:32:38 2008 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F241216A46D for ; Tue, 19 Feb 2008 18:32:38 +0000 (UTC) (envelope-from kamikaze@bsdforen.de) Received: from mail.bsdforen.de (bsdforen.de [212.204.60.79]) by mx1.freebsd.org (Postfix) with ESMTP id 830E313C4EF for ; Tue, 19 Feb 2008 18:32:38 +0000 (UTC) (envelope-from kamikaze@bsdforen.de) Received: from mobileKamikaze.norad (nat-wh-1.rz.uni-karlsruhe.de [129.13.72.169]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bsdforen.de (Postfix) with ESMTP id 78ABB405486; Tue, 19 Feb 2008 19:10:39 +0100 (CET) Message-ID: <47BB1B9E.2060901@bsdforen.de> Date: Tue, 19 Feb 2008 19:10:38 +0100 From: Dominic Fandrey User-Agent: Thunderbird 2.0.0.9 (X11/20080205) MIME-Version: 1.0 To: remko@elvandar.org References: <200802191650.m1JGo2Hk005394@freefall.freebsd.org> <51591.195.64.94.120.1203440608.squirrel@galain.elvandar.org> In-Reply-To: <51591.195.64.94.120.1203440608.squirrel@galain.elvandar.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-bugs@freebsd.org Subject: Re: bin/120784: [patch] mount(8): allow mount from fstab with 3rd party tools like ntfs-3g X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 18:32:39 -0000 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); }