diff options
author | iwasaki <iwasaki@FreeBSD.org> | 2000-05-17 18:29:17 +0000 |
---|---|---|
committer | iwasaki <iwasaki@FreeBSD.org> | 2000-05-17 18:29:17 +0000 |
commit | 4cc2182ced2cdf1225fcc7c0af25539887cf677b (patch) | |
tree | bda35feaee6c8746da13ed1011c29c23a3c77215 | |
parent | de71a10db8fa141fab30ff9d691650cf090090e8 (diff) | |
download | FreeBSD-src-4cc2182ced2cdf1225fcc7c0af25539887cf677b.zip FreeBSD-src-4cc2182ced2cdf1225fcc7c0af25539887cf677b.tar.gz |
Add CIS string comparison function.
This should solve tentatively the pccardd core dump problem when
there's no CIS (likely CardBus cards).
Later, this function will have regex CIS string comparison capability
too.
Obtained from: PAO
-rw-r--r-- | usr.sbin/pccard/pccardd/cardd.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/pccard/pccardd/cardd.c b/usr.sbin/pccard/pccardd/cardd.c index ccac0b3..e8e1622 100644 --- a/usr.sbin/pccard/pccardd/cardd.c +++ b/usr.sbin/pccard/pccardd/cardd.c @@ -206,6 +206,21 @@ card_removed(struct slot *sp) pool_irq[sp->irq] = 1; } +/* CIS string comparison */ + +static int +cis_strcmp(char *db, char *cis) +{ + size_t n; + + if (!db || !cis) { + return -1; + } + n = strlen(db); + return strncmp(db, cis, n); + /* XXX Add code for regex CIS string comparison here */ +} + /* * card_inserted - Card has been inserted; * - Read the CIS @@ -235,8 +250,8 @@ card_inserted(struct slot *sp) for (cp = cards; cp; cp = cp->next) { switch (cp->deftype) { case DT_VERS: - if (strcmp(cp->manuf, sp->cis->manuf) == 0 && - strcmp(cp->version, sp->cis->vers) == 0) { + if (cis_strcmp(cp->manuf, sp->cis->manuf) == 0 && + cis_strcmp(cp->version, sp->cis->vers) == 0) { logmsg("Card \"%s\"(\"%s\") " "matched \"%s\" (\"%s\") ", sp->cis->manuf, sp->cis->vers, |