PCMCIA product id strings -> hashes generation at compilation time? [Was: Re: [patch 14/38] pcmcia: id_table for wavelan_cs]

From: Dominik Brodowski (linux_at_dominikbrodowski.net)
Date: 03/08/05

  • Next message: Paul Davis: "Re: [PATCH] [request for inclusion] Realtime LSM"
    Date:	Tue, 8 Mar 2005 20:11:38 +0100
    To: Andrew Morton <akpm@osdl.org>, torvalds@osdl.org
    
    

    Andrew, Linus, all,

    [note: for detailed code please take a look at 2.6.11-mm2]

    Most pcmcia devices are matched to drivers using "product ID strings"
    embedded in the devices' Card Information Structures, as "manufactor ID /
    card ID" matches are much less reliable. Unfortunately, these strings cannot
    be passed to userspace for easy userspace-based loading of appropriate
    modules (MODNAME -- hotplug), so my suggestion is to also store crc32 hashes
    of the strings in the MODULE_DEVICE_TABLEs, e.g.:

    PCMCIA_DEVICE_PROD_ID12("LINKSYS", "E-CARD", 0xf7cb0b07, 0x6701da11),

    Only the hashes are stored in "modules.alias", and only the hashes
    calculated upon device insertion are passed to userspace.

    While having to determine the crc32 hashes is a hassle to device driver
    authors, I do not see a smart way to generate these (or similar) hashes
    automatically at compilation time:
            - the C preprocessor doesn't seem to be smart enough
            - scripts/mod/file2alias.c would need to learn all architectures
              (and be cross-compilation aware) to relocate/dereference/access
              strings saved as
                    const char * prod_id[4];
              in struct pcmcia_device_id s

    To make the life easier for device driver authors,
            - a big warning is put into dmesg if a pcmcia driver is inserted
              into the kernel and the hash mentioned in PCMCIA_DEVICE_PROD_ID()
              is incorrect,
            - the hash can easily be calculated in userspace from existing
              /etc/pcmcia/config files, from inserted PCMCIA cards and and and...,
            - I've added the appropriate hashes for all device matches for
              drivers in the base linux kernel.

    Even though I'm a bit uncomfortable with this solution, I do not see any
    other feasible way. Linus, Andrew, do you agree with this handling despite
    all the troubles involved with it?

            Dominik
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Paul Davis: "Re: [PATCH] [request for inclusion] Realtime LSM"

    Relevant Pages

    • Re: Dynamic Hash
      ... Please read the documentation on hashes before making assumptions about how they look. ... Perl provides no alternate means of handling the issue. ... The program structures were never strings per-se, in the same sense as data ... This does not get as deeply nested as a directory tree, of course, but you should be able to see how references link together ...
      (perl.beginners)
    • Re: updateRow() Fails
      ... This driver does not implement prepared statements in a compliant manner. ... Instead of using parameterized operations where there is no conversion of ... strings, the driver converts all parameters to string values for use in text ...
      (microsoft.public.sqlserver.jdbcdriver)
    • RE: Question on drivers installation during FBA and fbreseal
      ... C:\WINDOWS\inf\oem3.inf, using [STRINGS] instead. ... Effective driver date: 03/04/2003. ... #-166 Device install function: DIF_SELECTBESTCOMPATDRV. ... Does the first bootup after fbreseal reinstall the ...
      (microsoft.public.windowsxp.embedded)
    • Re: how to display messages during boot time
      ... the disk checker that occasionally kicks in as XP boots uses ... this fucntion to print strings to the screen. ... display strings if the video driver hasn't taken over yet, ...
      (microsoft.public.development.device.drivers)
    • Re: Recursion limit problems
      ... Dicts first compare hashes and if they are equal, ... two unequal strings have the same hash value, ... (given only 2**32 possible hashes and many more possible strings), ... sentence, about mixing, is directed at minimizing such hash collisions. ...
      (comp.lang.python)