Date: Sun, 9 Oct 2005 12:12:24 -0400 From: Craig Rodrigues <rodrigc@crodrigues.org> To: Pawel Jakub Dawidek <pjd@FreeBSD.org> Cc: freebsd-arch@FreeBSD.org Subject: Re: [RFC] Teaching mount(8) to use nmount() Message-ID: <20051009161224.GA7541@crodrigues.org> In-Reply-To: <20051009064053.GA7261@garage.freebsd.pl> References: <20051008024620.GA29824@crodrigues.org> <20051009064053.GA7261@garage.freebsd.pl>
index | next in thread | previous in thread | raw e-mail
On Sun, Oct 09, 2005 at 08:52:38AM +0200, Pawel Jakub Dawidek wrote:
> +> + 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'.
This is not an issue, because there is already existing behavior in
mount(8) to avoid this. The mangle() function
transforms argv so that:
-o foo,bar=something,baz=somethingelse
becomes:
-o foo -o bar=something -o baz=somethingelse
So this is not an issue by the time we go to build the iovec to pass to
nmount().
I verified this too with printf(),
% ./mount -t imaginary -o foo,bar=something,baz=somethingelse /dev/ad0s1 /mnt
mount_fs argv: 0 mount_imaginary
mount_fs argv: 1 -o
mount_fs argv: 2 foo
mount_fs argv: 3 -o
mount_fs argv: 4 bar=something
mount_fs argv: 5 -o
mount_fs argv: 6 baz=somethingelse
mount_fs argv: 7 /dev/ad0s1
mount_fs argv: 8 /mnt
--
Craig Rodrigues
rodrigc@crodrigues.org
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051009161224.GA7541>
