Skip site navigation (1)Skip section navigation (2)
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

--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 <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.

--=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--



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