Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 2004 12:53:33 +0000 (GMT)
From:      Robert Watson <rwatson@freebsd.org>
To:        Patrick Bowen <pbowen25@juno.com>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Getting devfs to recognize a hotplugged fd0
Message-ID:  <Pine.NEB.3.96L.1041128124544.94120B-100000@fledge.watson.org>
In-Reply-To: <41A943F9.40106@juno.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sat, 27 Nov 2004, Patrick Bowen wrote:

> No, I'm not sure. But, in 4.10, with /dev already populated with an
> entry for fd0, I could plug the floppy into a running machine and then
> mount it, no problem. So I'm thinking that if can either create an entry
> for /dev/fd0 during or shortly after boot time, or get devfs to rescan
> for devices, then it should work on -current also. I occurs to me that
> rescanning might wreak havoc with operations already using other
> devices, like a disk write or something, so the first option may be
> preferable. 
> 
> This is not a critical issue, but falls more in the category of "Gee, I
> wonder if i can (fill-in-the-blank)" sort of thing. 
> 
> BTW, thanks for your reply... 

I think some of the confusion here is from the use of terminology: devfs
doesn't operate quite like MAKEDEV did -- the creation of devfs nodes is
driven by the device drivers and device driver frameworks directly.  If a
device node is missing in /dev, it's because no device driver has
registered it, not because devfs needs to realize the set of devices has
changed and update its list.  Right now, storage drivers register with
GEOM to announce that a new disk is available, using the disk(9) API. GEOM
will perform the necessary probing and transforms to find disk labels,
etc, and then announce the resulting device nodes to devfs using
make_dev(9).  If /dev/fd0 isn't in /dev, it's most likely because the
floppy disk device driver hasn't notified GEOM that one is available.

It's worth noting that there are actually two approaches to removable
media in FreeBSD: first, one where the drive itself is considered a fairly
"fixed" device, with removable media that come and go, and second, where
the device itself coes and goes.  The floppy disk subsystem has generally
taken the former approach, which results in the floppy disk device node
being present even if a floppy disk itself is not present in the drive. 
My understanding is that, unlike with SCSI or USB, the floppy disk
controller interface doesn't have the capability to announce device
arrival or departure.  It could be that in 4.x, we had the device node
hooked up to the driver regardless of a successful probe, and an open of
the node would result in a hardware probe, whereas in 5.x, the device node
is only presented if the driver says "it's here".  The device driver has
also changed quite a bit since 4.x -- could you compare what is probed in
the dmesg output of 4.x and 5.x, in terms of probing the controller (fdc)
vs. drives (fd*)?

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Principal Research Scientist, McAfee Research





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1041128124544.94120B-100000>