Date: Sun, 9 Oct 2005 08:52:38 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Craig Rodrigues <rodrigc@crodrigues.org> Cc: freebsd-arch@freebsd.org Subject: Re: [RFC] Teaching mount(8) to use nmount() Message-ID: <20051009064053.GA7261@garage.freebsd.pl> In-Reply-To: <20051008024620.GA29824@crodrigues.org> References: <20051008024620.GA29824@crodrigues.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Fri, Oct 07, 2005 at 10:46:20PM -0400, Craig Rodrigues wrote:
+> I would appreciate any comments on the attached patch.
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=0; i < argc; ++i) { printf("%d: %s\n", argc, argv[i]); }
You probably want to remove it before committing.
+> + optind = optreset = 1; /* Reset for parse of new argv. */
+> + while ((ch = getopt(argc, argv, "o:")) != -1) {
+> + switch(ch) {
+> + case 'o':
+> + getmntopts(optarg, mopts, &mntflags, 0);
+> + p = strchr(optarg, '=');
+> + val = "";
+> + if (p != NULL) {
+> + *p = '\0';
+> + val = 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 <fs>' switch, we look for
/lib/mount/mount_<fs>.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_<fs>.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.
--
Pawel Jakub Dawidek http://www.wheel.pl
pjd@FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)
iD8DBQFDSL42ForvXbEpPzQRAlrVAJwO+fS9forVg9JHwcHtnAELAlipOACg1QqV
DDdEMN1od+ZzyOJAIlexyQc=
=7Xhz
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051009064053.GA7261>
