mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	jt@hpl.hp.com, linux-pcmcia@lists.infradead.org,
	Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Greg KH <greg@kroah.com>
Subject: Re: PCMCIA product id strings -> hashes generation at compilation time? [Was: Re: [patch 14/38] pcmcia: id_table for wavelan_cs]
Date: Wed, 9 Mar 2005 00:39:39 +0100	[thread overview]
Message-ID: <20050308233939.GA21112@isilmar.linta.de> (raw)
In-Reply-To: <20050308231636.GA20658@isilmar.linta.de>

On Wed, Mar 09, 2005 at 12:16:36AM +0100, Dominik Brodowski wrote:
> > Dominik Brodowski <linux@dominikbrodowski.net> wrote:
> > >
> > > 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),
> > 
> > What is the difficulty in passing these strings via /sbin/hotplug arguments?
> 
> The difficulty is that extracting and evaluating them breaks the wonderful 
> bus-independent MODNAME implementation for hotplug suggested by Roman Kagan
> ( http://article.gmane.org/gmane.linux.hotplug.devel/7039 ), and that these
> strings may contain spaces and other "strange" characters. The latter may be 
> worked around, but the former cannot. /etc/hotplug/pcmcia.agent looks really
> clean because of this MODNAME implementation:

In addition: this isn't the problematic part. The product ID string and/or
the hash can easily be passed from kernelspace to userspace in calls to
hotplug, and that's not the real reason for the hashing. Instead, it is
caused by the module.alias generation (even module.pcmciamap, if it existed,
wouldn't be of help here) at compilation time: the format of such aliases is

alias [bus_name]:[{one or multiple chars as separators}{NUMBERS!} multiple such blocks] [module_name]

This means: only (hex) numbers are allowed as _values_ in such a module alias 
map. The module alias map is generated by file2alias.c, which cannot and
should not be able to access strings inside modules, because that would mean
awareness of all sorts of (arch-dependant) relocation. Therefore,
file2alias.c can't calculate the hashes for us, and as the C preprocessor
cannot either, only the explicit passing of strings _and_ hashes to struct 
pcmcia_device_id-generating macros is the only feasible way I currently see 
to use module.alias for PCMCIA devices.

	Dominik

  parent reply	other threads:[~2005-03-08 23:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050227161308.GO7351@dominikbrodowski.de>
     [not found] ` <20050307225355.GB30371@bougret.hpl.hp.com>
     [not found]   ` <20050307230102.GA29779@isilmar.linta.de>
     [not found]     ` <20050307150957.0456dd75.akpm@osdl.org>
     [not found]       ` <20050307232339.GA30057@isilmar.linta.de>
2005-03-08 19:11         ` Dominik Brodowski
2005-03-08 20:34           ` Andrew Morton
2005-03-08 22:54           ` Linus Torvalds
2005-03-08 23:16             ` Dominik Brodowski
2005-03-08 23:37               ` Greg KH
2005-03-08 23:46                 ` Dominik Brodowski
2005-03-08 23:39               ` Dominik Brodowski [this message]
2005-03-09  5:45               ` Benjamin Herrenschmidt
2005-03-09  6:00                 ` Greg KH
2005-03-09  7:21                   ` Benjamin Herrenschmidt
2005-03-09  7:19                 ` Dominik Brodowski
2005-03-09  7:36                   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050308233939.GA21112@isilmar.linta.de \
    --to=linux@dominikbrodowski.net \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=jt@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®