From owner-freebsd-arch@FreeBSD.ORG Tue May 27 16:59:15 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07C761065675 for ; Tue, 27 May 2008 16:59:15 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:610:652::211]) by mx1.freebsd.org (Postfix) with ESMTP id BF6B58FC15 for ; Tue, 27 May 2008 16:59:14 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id B8F131CC1A; Tue, 27 May 2008 18:57:53 +0200 (CEST) Date: Tue, 27 May 2008 18:57:53 +0200 From: Ed Schouten To: Kostik Belousov Message-ID: <20080527165753.GK64397@hoeg.nl> References: <20080527130615.GJ64397@hoeg.nl> <20080527150244.GN21317@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hdW7zL/qDS6RXdAL" Content-Disposition: inline In-Reply-To: <20080527150244.GN21317@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: arch@freebsd.org Subject: Re: Simplifying devfs: minor == unit 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: Tue, 27 May 2008 16:59:15 -0000 --hdW7zL/qDS6RXdAL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Kostik Belousov wrote: > > - I've seen most drivers only use the device cloner, because they need > > descriptor local storage. It turns out more drivers need this than I > > initially thought. kib@ has a patch for this, so I hope this gets > > committed one of these {days,weeks,months}. > The patch was committed ~ a week ago. Great. Looks like I wasn't paying attention back then. > > - After we've got file descriptor local storage, I think we can live > > without the cloner. This means we could consider removing the minor > > number argument from make_dev(), removing the unique unit number > > restriction we currently have inside devfs, which causes many drivers > > to use number pools for no obvious reason. > I think we cannot live without clones regardless of devfs_cdevpriv. > The model assumed for the pty, snp and probably several other devices > actually requires new cdev instead of the priv data. The pty driver does not use the clone_* interface. It only uses the eventhandler, which should indeed be left intact. The snp driver does use the clone_* interface, but not in a way that can't be done using the eventhandler, validating the device name and calling make_dev() directly. Please take a look at src/usr.sbin/watch/watch.c:open_snp(). We might as well turn snp(4) into a single /dev/snp, where the kernel space driver uses per-descriptor data to distinguish the instances. This provides some advantages: - No more silly open()-loops. - A system administrator can change the permissions on /dev/snp, which automatically sets a system wide policy, instead on one of the device nodes. - We don't fill up the system with a lot of unused nodes. for i in `seq 1000` do ls /dev/bpf$i > /dev/null done > > I was thinking about discussing this patch with my mentor + committing > > it somewhere in the nearby future. Any comments? >=20 > Making minor =3D=3D unit number looks to be not a bad idea, please, look = at > the saga of the tty_pty.c revs. 1.153, 156, 1.157. Making the devices use > si_drv0 directly probably is not so good since we remove the indirection > layer that is already present and allows for some (minor) freedom in the > devfs/kern_conf implementation. But why isn't this done for si_drv1 and si_drv2 then? My idea is to turn si_drv0 in an integer field that can be freely used. There is reason to force a policy on this field. --=20 Ed Schouten WWW: http://80386.nl/ --hdW7zL/qDS6RXdAL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkg8PZEACgkQ52SDGA2eCwVBRgCfeVpGRCUJXHSyEklM21b/+nU0 2HAAn1Qvig6tm6SOBvvE40MLed3AKv6m =5BRD -----END PGP SIGNATURE----- --hdW7zL/qDS6RXdAL--