Yes, this is similar to a problem I had with User-Mode-Linux it appears
that the partitoning must be done at "init" time in order to have a bootable
partiton map (even if devfs is not mounted) and the device nodes created
But this requires reading the device before it is "open"ed
You should be returning 1 from the check_media_change bdop when the
new disk is inserted this should cause the revalidate where you can update
the partitions and devfs will create the device nodes.
Also at open time check_disk_change should be called instead if the map
may have changed without notification.
This still leaves the problem of having a device node to open so that the
map is revalidated and the device nodes created :(
see http://www.xml.com/ldd/chapter/book/ch12.html#t7 Removeable devices
and http://www.xml.com/ldd/chapter/book/ch12.html#t8 Partitionable devices
Linux Device Drivers 2nd Ed is a very nice book (in print & electrons)
http://www.oreilly.com/catalog/linuxdrive2/
I still have not figured out how to handle this properly.
Suggestions welcome.
One of my problems was that at init time kmalloc paniced and it required
the boot memory allocator but only at init time, later it needed kmalloc.
And reading from a un"open"ed devices caused several other assumptions
to break in the User-Mode-Linux user-block-device :(
----- Original Message -----
From: "Paul Bristow" <paul@xxxxxxxxxxxxxxx>
To: <devfs@xxxxxxxxxxx>
Sent: Tuesday, December 04, 2001 1:43 AM
Subject: Removeable Media, partitions and devfs?
> Hi everyone,
>
> I have spent three entire days trying to work out what can be done to
> the ide-floppy driver to fix the problems people are having with devfs.
> However, as far as I can tell, the driver is working correctly, but
> the behaviour is not user-friendly.
>
> The problem is simple. If there is no disk in the drive when the driver
> is loaded, then no device nodes are created. The device nodes are
> actually created by the grok_partitions call in fs/partitions/check.c.
>
> The grok_partitions will create the disc node and any partitions IF
> there is a disk present.
>
> Most people with Zip drives have the entry /dev/hdx4 -> /mnt/zip in
> their fstab. The effect is that, if the driver was loaded with no disk
> in the drive, no nodes are created, and hence the mount attempt fails
> with a "device not found" error. If the driver is compiled as a module,
> you can rmmod and insmod with a disk inserted. If the driver is
> compiled in, you have to reboot.
>
> I could screw up the grok_partitions to always create a disc entry, but
> that won't actually help, unless I also create a part4 entry. This way
> madness lies.
>
> Is there a way within devfs to get a mount attempt to cause a
> revalidate_disc to be called when the relevant device directory is
> scanned? In the ide-floppy driver this would be the
> /host/bus/target/lun folder...
>
> This way fixes it with no changes to grok_partitions or the drivers, and
> should work for all removeable media.
>
> --
>
> Paul
>
> ide-floppy maintainer for devfs
>
> Email: paul@xxxxxxxxxxxxxxx
> Web: http://paulbristow.net
> ICQ: 11965223
>
>
>
|