From owner-freebsd-arch@FreeBSD.ORG Sun Oct 9 06:52:59 2005 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CFE416A41F for ; Sun, 9 Oct 2005 06:52:59 +0000 (GMT) (envelope-from pjd@garage.freebsd.pl) Received: from swift.wheel.pl (zoidberg.sec-force.net [80.55.205.180]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2D4D43D45 for ; Sun, 9 Oct 2005 06:52:58 +0000 (GMT) (envelope-from pjd@garage.freebsd.pl) Received: from localhost (bng128.neoplus.adsl.tpnet.pl [83.28.252.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by swift.wheel.pl (Postfix) with ESMTP id 3841E8BD25; Sun, 9 Oct 2005 08:46:20 +0200 (CEST) Date: Sun, 9 Oct 2005 08:52:38 +0200 From: Pawel Jakub Dawidek To: Craig Rodrigues Message-ID: <20051009064053.GA7261@garage.freebsd.pl> References: <20051008024620.GA29824@crodrigues.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8w3uRX/HFJGApMzv" Content-Disposition: inline In-Reply-To: <20051008024620.GA29824@crodrigues.org> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng devel (FreeBSD) Cc: freebsd-arch@freebsd.org Subject: Re: [RFC] Teaching mount(8) to use nmount() X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2005 06:52:59 -0000 --8w3uRX/HFJGApMzv Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 07, 2005 at 10:46:20PM -0400, Craig Rodrigues wrote: +> I would appreciate any comments on the attached patch.=20 I haven't has chance to run any tests, as I'm not at home, so I just reviewed the patch a bit. +> +static void +> +usage(void) +> +{ +> + (void)fprintf(stderr, +> + "usage: mount_xfs [-t fstype] [-o options] target_fs mount_point\n"); mount_xfs is probably a typo here:) +> + printf("argc is: %d\n", argc); for (i=3D0; i < argc; ++i) { printf("%d= : %s\n", argc, argv[i]); } You probably want to remove it before committing. +> + optind =3D optreset =3D 1; /* Reset for parse of new argv. */ +> + while ((ch =3D getopt(argc, argv, "o:")) !=3D -1) { +> + switch(ch) { +> + case 'o': +> + getmntopts(optarg, mopts, &mntflags, 0); +> + p =3D strchr(optarg, '=3D'); +> + val =3D ""; +> + if (p !=3D NULL) { +> + *p =3D '\0'; +> + val =3D p + 1; +> + } +> + build_iovec(&iov, &iovlen, optarg, val, -1); +> + break; Ok, as I suggested on IRC, this can handle only options given in form '-o opt1 -o opt2 -o opt3', but not '-o opt1,opt2,opt3'. +> + printf("argc is: %d\n", argc); Another debug printf. I think it is a step forward, so I'm not against committing it, but we need to design it better at the end. My suggestion (which I discusses with Craig on IRC a bit already) is as follows: - We create one mount(8) program. - When it is called with '-t ' switch, we look for /lib/mount/mount_.so and try to dlopen() it. - When there is no such .so, we just pass all option via nmount() to the kernel. - When there is .so, we decided based on things found there which options needs special treatment (like '-C' for mount_cd9660, etc.). Options which are not defined in .so we pass to the kernel without touching. The advantages: - No more external executables for every single file system. - mount(8) doesn't have to know about any specific FS, we can just add mount_.so if needed dinamically. - We need to create .so only for file systems for which some work has to be done in userland. - Passing options via nmount(2) as strings should allow to remove this annoying behaviour: # mount ... /dev/md0 on /mnt/tmp (ufs, local, noatime, noexec, read-only) # mount -u -o rw /mnt/tmp # mount ... /dev/md0 on /mnt/tmp (ufs, local) 'noexec' and 'noatime' are gone. I know that I can use 'current', but this doesn't seem to be intuitive for me (I think not only for me, but I can be wrong:)). Comments are welcome. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --8w3uRX/HFJGApMzv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFDSL42ForvXbEpPzQRAlrVAJwO+fS9forVg9JHwcHtnAELAlipOACg1QqV DDdEMN1od+ZzyOJAIlexyQc= =7Xhz -----END PGP SIGNATURE----- --8w3uRX/HFJGApMzv--