[RFC] Teaching mount(8) to use nmount()

Craig Rodrigues rodrigc at crodrigues.org
Sun Oct 9 09:12:26 PDT 2005


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 at crodrigues.org


More information about the freebsd-arch mailing list