Subject: Re: vnconfig is broken
To: Chris Ross <cross+netbsd@distal.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: current-users
Date: 05/11/2005 17:24:03
--huq684BweRXVnRxX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 10, 2005 at 03:18:38PM -0400, Chris Ross wrote:
> Denis Lagno wrote:
> >On Tue, May 10, 2005 at 08:50:51PM +0200, Manuel Bouyer scribed:
> >
> >>Make sure you don't have a file called vnd0 or vnd0d in the current=20
> >>directory.
> >
> >bingo!:)
> >
> >I'm going to use cgd atop vnd, and vnd0d in the current directory is fil=
e=20
> >with cgd parameters..
>=20
>   Now to ask the next question.  Is it sensible for vnconfig
> to look for a device in the cwd?  Why would one ever *want*
> this behavior?

Yes.

vndconfig uses opendisk(3). This is a standard (for NetBSD) routine, so
that each utility that does something with disks doesn't have to know
about how we create partition names. The first thing that routine tries is
open(2) on the supplied file name. That covers the case of "/dev/vnd0c".=20
If that open(2) fails, opendisk(3) then tries different variations on the=
=20
supplied name.

While opendisk(3)'s behavior surprises you in this context, it is far less=
=20
surprising than the alternative, which would be to start cooking the path=
=20
before trying to see if the given path works. Thus we could end up using a=
=20
variation on the given name even when the given name works.

Take care,

Bill

--huq684BweRXVnRxX
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFCgqIjWz+3JHUci9cRAjFKAJwMU1bm3BdnEj1NuBZLS1wudlld5QCcD+5D
4/gs3FJL7/KKFvizxjiOOqQ=
=gPUU
-----END PGP SIGNATURE-----

--huq684BweRXVnRxX--