From owner-freebsd-mobile Wed May 10 5: 8:14 2000 Delivered-To: freebsd-mobile@freebsd.org Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by hub.freebsd.org (Postfix) with ESMTP id 13EB037B5C5; Wed, 10 May 2000 05:08:09 -0700 (PDT) (envelope-from iwasaki@jp.FreeBSD.org) Received: from localhost (isdn55.imasy.or.jp [202.227.24.247]) by tasogare.imasy.or.jp (8.9.3+3.2W/3.7W-tasogare/smtpfeed 1.04) with ESMTP id VAA48184; Wed, 10 May 2000 21:08:03 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) To: dcs@newsguy.com Cc: imp@freebsd.org, iwasaki@freebsd.org, mobile@freebsd.org Subject: Re: Bug on readcis.c r1.19 In-Reply-To: <200005100540.OAA00517@daniel.sobral> References: <200005100540.OAA00517@daniel.sobral> X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20000510210800Y.iwasaki@jp.FreeBSD.org> Date: Wed, 10 May 2000 21:08:00 +0900 From: Mitsuru IWASAKI X-Dispatcher: imput version 20000228(IM140) Lines: 76 Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > My pccardd has been core dumping since my last upgrade. I think the > following change (revision 1.19 or readcis.c) is the responsible: Yes, CardBus cards make pccardd core dumped as you pointed out. The following cis_ctrcmp() was supposed to merge replacing strcmp() but I hesitated about rewriting entries in pccard.conf to use regex. Index: cardd.c =================================================================== RCS file: /miserv/home/ncvs/src/usr.sbin/pccard/pccardd/cardd.c,v retrieving revision 1.51 diff -u -r1.51 cardd.c --- cardd.c 2000/05/09 22:01:16 1.51 +++ cardd.c 2000/05/10 12:01:54 @@ -206,6 +206,41 @@ pool_irq[sp->irq] = 1; } +/* regex CIS string comparison (hosokawa) */ + +#define REGCOMP_FLAGS (REG_EXTENDED | REG_NOSUB) +#define REGEXEC_FLAGS (0) + +static int +cis_strcmp(char *db, char *cis) +{ + int res, err; + char buf[256]; + regex_t rx; + char * p; + size_t n; + + if (!db || !cis) { + return -1; + } + n = strlen(db); + p = xmalloc(n + 2); + strcpy(p + 1, db); + *p = '^'; + db = p; + if ((err = regcomp(&rx, p, REGCOMP_FLAGS))) { + regerror(err, &rx, buf, sizeof buf); + logmsg("Warning: REGEX error for\"%s\" -- %s\n", p, buf); + regfree(&rx); + free(p); + return -1; + } + res = regexec(&rx, cis, 0, NULL, REGEXEC_FLAGS); + regfree(&rx); + free(p); + return res; +} + /* * card_inserted - Card has been inserted; * - Read the CIS @@ -235,8 +270,8 @@ 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, So I'm thinking introduce 'regex' prefix for strings such as manufacturer, card version, etc. for new entries, like this. card "SunDisk" "regex:SDP*" Without 'regex' prefix, we just use strcmp() in cis_strcmp(). Any comments? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message