From owner-freebsd-arch Mon Jan 29 14:16:41 2001 Delivered-To: freebsd-arch@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id CD8A837B402; Mon, 29 Jan 2001 14:16:21 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0TMGL101787; Mon, 29 Jan 2001 14:16:21 -0800 (PST) Date: Mon, 29 Jan 2001 14:16:21 -0800 From: Alfred Perlstein To: John Baldwin Cc: Brian Somers , freebsd-arch@FreeBSD.ORG, Poul-Henning Kamp Subject: Re: Cloned open support Message-ID: <20010129141621.F26076@fw.wintelcom.net> References: <200101291228.f0TCSgP60147@storm.FreeBSD.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from jhb@FreeBSD.ORG on Mon, Jan 29, 2001 at 01:58:48PM -0800 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * John Baldwin [010129 14:00] wrote: > > On 29-Jan-01 Brian Somers wrote: > >> >2. Given that I'll need to change the d_open prototype (and > >> > thus cdevsw) > >> > >> I'm not sure that is really a good idea. > >> > >> If you look at the device name clone stuff I think I have made > >> it possible to handle it there. > >> > >> The idea being that you call it on "/dev/pty" and it will clone > >> "/dev/pty38" for you and return the dev_t for that. You then > >> complete the open on that dev_t. I have not quite thought > >> it through though. > >> > >> Either way, I think cloning open should be kept out of d_open > >> one way or another. > > > > The thing is that I believe the driver needs to be able to > > decide what minor number will be opened. This idea is taken > > from the Solaris implementation. For example, I have a > > theoretical driver that does this: > > > > o Makes minor 0 available in /dev as a control device > > o Makes minor 1 available as something that'll be cloned. > > o The descriptor returned from opening minor 1 may itself > > me made available via namefs (a vfs that allows you to > > turn a descriptor into a mountpoint to give other users > > access to it) and may be opened again. Such descriptors > > are not cloned. > > > > Although this sounds exotic, it's quite practical, and > > impossible to do outside of the driver. > > > > I think deciding on the minor outside the driver is too > > limiting. > > Why not use an ioctl on the control device to get a minor number to > use? The ioctl could then do a make_dev() on the appropriate device > to create it. Yes, but will it swap the current open fd with the new device? Afaik the idea is to remove the race condition. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message