NetBSD Problem Report #11659
Received: (qmail 25497 invoked from network); 7 Dec 2000 13:30:41 -0000
Message-Id: <200012070416.eB74GJa00874@kaakeli.ssh.fi>
Date: Thu, 7 Dec 2000 06:16:19 +0200 (EET)
From: kivinen@ssh.fi
Reply-To: kivinen@ssh.fi
To: gnats-bugs@gnats.netbsd.org
Subject: pcmcia/devlist2h.awk generates invalid c-code in pcmciadevs_data.h
X-Send-Pr-Version: 3.95
>Number: 11659
>Category: kern
>Synopsis: pcmciadevs_data.h contains invalid c-code
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 07 13:31:00 +0000 2000
>Closed-Date: Mon Feb 11 20:07:41 +0000 2002
>Last-Modified: Mon Feb 11 20:07:41 +0000 2002
>Originator: Tero Kivinen
>Release: NetBSD-current Dec 6 2000
>Organization:
SSH Communications Security
>Environment:
System: NetBSD kaakeli.ssh.fi 1.5L NetBSD 1.5L (KAAKELI) #22: Thu Dec 7 01:39:27 EET 2000 root@kaakeli.ssh.fi:/usr/src/sys/arch/i386/compile/KAAKELI i386
Architecture: i386
Machine: i386
>Description:
Sys/dev/pcmcia/pcmciadevs_data.h contains invalid c-code.
There is two bugs in the awk code that generates the file. The
first adds extra } at end of each product string. Second one
generates fields in invalid order for those devices whose
product id is not known.
Also there is no definition of the pcmcia_knowndev structure
itself.
It would also be better to export pcmciadevs.h,
pcmciadevs_data.h, cardbusdevs.h and cardbusdevs_data.h, as
they can be usefull in the usermode programs. I have a
loadable kernel module (with ~20 line patch to pcmcia.c and
cardbus.c) that will send card attach and detach notifications
from kernel to user mode daemon. Currently the daemon only
prints out debug info, but I plan to run suitable shell script
when the card is attached/detached, so I can run ifconfig up /
dhclient etc stuff there.
The debugging info include the vendor and product names, thus
I need the pcmciadevs_data.h and cardbusdevs_data.h files for
that:
kaakeli (6:12) ~>./cardwatchd
pcmcia card wi0 attached to pcmcia0
Manufacturer Lucent Technologies (0x156), product = WaveLAN/IEEE (0x2)
pcmcia card wi0 detached
pcmcia card ne0 attached to pcmcia0
Manufacturer I-O DATA (0x1bf), product = I-O DATA PCLA/TE (0x2216)
pcmcia card ne0 detached
...
>How-To-Repeat:
Try to compile following file:
#include <stdio.h>
#include <fcntl.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/device.h>
#include <dev/pcmcia/pcmciavar.h>
struct pcmcia_knowndev {
int32_t vendor;
int32_t product;
struct {
const char *cis[4];
} cis;
int32_t flags;
const char *vendor_name;
const char *product_name;
};
#include "pcmciadevs.h"
#define PCMCIA_VENDOR_UNKNOWN -1
#define PCMCIA_KNOWNDEV_NOPROD -1
#include "pcmciadevs_data.h"
>Fix:
Here is patch:
----------------------------------------------------------------------
--- devlist2h.awk.orig Thu Dec 7 06:00:07 2000
+++ devlist2h.awk Thu Dec 7 05:49:30 2000
@@ -202,20 +202,19 @@
}
printf("\t PCMCIA_CIS_%s_%s,\n",
products[i, 1], products[i, 2]) > dfile
- printf("\t ") > dfile
- printf("0") > dfile
- printf(",\n") > dfile
+ printf("\t 0,\n") > dfile
vendi = vendorindex[products[i, 1]];
printf("\t \"%s\",\n", vendors[vendi, 3]) > dfile
- printf("\t \"%s\"\t},\n", products[i, 5]) > dfile
+ printf("\t \"%s\"\n", products[i, 5]) > dfile
printf("\t},\n") > dfile
}
for (i = 1; i <= nvendors; i++) {
printf("\t{\n") > dfile
- printf("\t PCMCIA_VENDOR_%s, 0,\n", vendors[i, 1]) > dfile
+ printf("\t PCMCIA_VENDOR_%s,\n", vendors[i, 1]) > dfile
printf("\t PCMCIA_KNOWNDEV_NOPROD,\n") > dfile
printf("\t PCMCIA_CIS_INVALID,\n") > dfile
+ printf("\t 0,\n") > dfile
printf("\t \"%s\",\n", vendors[i, 3]) > dfile
printf("\t NULL,\n") > dfile
printf("\t},\n") > dfile
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: haya
State-Changed-When: Wed Jan 30 02:01:53 PST 2002
State-Changed-Why:
This problem is fixed by devlist2h.awk r1.4. Could you check this fix?
State-Changed-From-To: feedback->closed
State-Changed-By: fair
State-Changed-When: Mon Feb 11 12:07:02 PST 2002
State-Changed-Why:
Submitter reports that the fix works.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.