polling vs initial check of a device

Alexey Morozov alex-hp at idisys.iae.nsk.su
Mon Feb 14 08:28:51 PST 2005


Hello.

A while ago I asked if there's a way to split media_check_enabled into 
two possible setting:

initial device check to let hal properly detect volume's filesystem type 
etc and

periodic polling which allows hal to handle all those card readers which 
don't generate proper hotplug events on card insertion/removal.

This would allow to from one hand remove polling from 'proper' USB flash 
drives, which don't require it.

After looking at the hald code (as of 0.4.7), 
hald/linux/block_class_device.c around line 1330, I understood that 
media_check_enabled is checked before in collecting initial volume 
properties only to avoid those 'bad' devices like ide-cs card readers 
and ZIP-drives, which generate an additional hotplug event on each 
device open:
*********

        /* only check for volume_id if we are allowed to poll, otherwise 
we may
         * cause inifite loops of hotplug events, cf. broken ide-cs 
driver and
         * broken zip drives. Merely accessing the top-level block 
device if it
         * or any of it partitions are not mounted causes the loop.
         *
         * Also allow this for devices without removable media
         */

        if (hal_device_property_get_bool (stordev, 
"storage.media_check_enabled") ||
            !hal_device_property_get_bool (stordev, "storage.removable")) {
            dbus_uint64_t size = 0;
            const char *stordev_device_file;
**********

It seems that the kernel manager of my distro has already fixed the 
ide-cs issue (and now he's in process of publishing his patch :-)), so 
it seems that now only ZIPs need special handling. If so maybe it makes 
sense to replace checking storage.media_check_enabled w/ more narrowed 
checks [for ZIPs] (I don't have such devices and can't say if they can 
be automatically recognized). If this will be done then it's possible to 
solve my initial problem (setting proper filesystem type for my flash 
drive which doesn't need to be polled). Also it seems that 
media_check_enabled is actually used for several different logical tasks 
and such a change will clarify its role w/o adding another configuration 
option.

The patch is available via anonymous CVS over SSH

CVS_RSH=ssh cvs -d :ext:anoncvs at anoncvs.altlinux.org:/cvs/kernel co 
kernel/fix/drivers-ide/SOURCES/2.6_10_alt-flashcard.patch

Probably it requires some comments and substantiations (it will be done 
a bit later) but it seems it works for our kernel users.

Sincerely yours,
Alexey Morozov
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list