From owner-freebsd-current@FreeBSD.ORG Tue Jan 25 14:54:57 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6F48D16A4CE for ; Tue, 25 Jan 2005 14:54:57 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 043D343D46 for ; Tue, 25 Jan 2005 14:54:57 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.13.1/8.13.1) with ESMTP id j0PEsUCb003822; Tue, 25 Jan 2005 09:54:30 -0500 (EST) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)j0PEsTuK003814; Tue, 25 Jan 2005 14:54:29 GMT (envelope-from robert@fledge.watson.org) Date: Tue, 25 Jan 2005 14:54:29 +0000 (GMT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Poul-Henning Kamp In-Reply-To: <85367.1106664286@critter.freebsd.dk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: pete@altadena.net cc: current@freebsd.org cc: "M. Warner Losh" Subject: Re: Devd event from GEOM? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2005 14:54:57 -0000 On Tue, 25 Jan 2005, Poul-Henning Kamp wrote: > In message <20050125.073258.94555150.imp@bsdimp.com>, "M. Warner Losh" writes: > > >: So suppose I'm listening to a devd socket to try and identify storage > >: devices arriving that I can automount. How do I know which device > >: announcements are for storage devices? > > > >Hmmmm, once upon a time I'd have said 'stat the device, and you know' > >since those would be block devices.... > > We do actually have an ioctl, FIODTYPE, which will tell you the "kind" > of device, but that requires you to open it (O_NDELAY will do) However, many device nodes can only be opened "exclusively", security event auditing will occur, or opening will have side effects. Opening a device node to find out what type it is currently seems not to work very well and/or be undesirable. > >The trouble is that we don't > >know at that level either, yet when the GEOM even happens, how can we > >be sure that we win that race? > > There is no way you can win the race. The device may already be gone > again by the time you hear about the event. > > Welcome to the world of dynamic hardware. While you could imagine user space controlling the stepping of exposed device nodes to prevent inconsistency, it's similarly easy to imagine the potential feedback loops, deadlocks, etc, that would occur. Given that we already mediate use of the /dev name space, I think we have to be able to rely on sane use of that space: if ad0 is replaced almost immediately by ad0, it shouldn't really matter which you get, at least in as much as that the consumer can figure out if it happened (should it matter, which I suspect in most cases it won't). Robert N M Watson