From owner-freebsd-arch@FreeBSD.ORG Sun Oct 9 16:12:26 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 1D69F16A41F; Sun, 9 Oct 2005 16:12:26 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [216.148.227.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC3E243D45; Sun, 9 Oct 2005 16:12:25 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from c-66-30-112-178.hsd1.ma.comcast.net ([66.30.112.178]) by comcast.net (rwcrmhc11) with ESMTP id <2005100916122501300jp1nee>; Sun, 9 Oct 2005 16:12:25 +0000 Received: from c-66-30-112-178.hsd1.ma.comcast.net (localhost.127.in-addr.arpa [127.0.0.1]) by c-66-30-112-178.hsd1.ma.comcast.net (8.13.4/8.13.1) with ESMTP id j99GCOQA007616; Sun, 9 Oct 2005 12:12:24 -0400 (EDT) (envelope-from rodrigc@c-66-30-112-178.hsd1.ma.comcast.net) Received: (from rodrigc@localhost) by c-66-30-112-178.hsd1.ma.comcast.net (8.13.4/8.13.1/Submit) id j99GCOkW007615; Sun, 9 Oct 2005 12:12:24 -0400 (EDT) (envelope-from rodrigc) Date: Sun, 9 Oct 2005 12:12:24 -0400 From: Craig Rodrigues To: Pawel Jakub Dawidek Message-ID: <20051009161224.GA7541@crodrigues.org> References: <20051008024620.GA29824@crodrigues.org> <20051009064053.GA7261@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051009064053.GA7261@garage.freebsd.pl> User-Agent: Mutt/1.4.2.1i 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 16:12:26 -0000 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