mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Update ndiscvt to handle .INF files that specify multiple entries in
their [Manufacturer] sections.
This commit is contained in:
parent
5ad9a2d7ba
commit
d001b3ba20
1 changed files with 56 additions and 8 deletions
|
|
@ -55,6 +55,9 @@ static struct assign_head ah;
|
|||
static char *sstrdup (const char *);
|
||||
static struct assign
|
||||
*find_assign (const char *, const char *);
|
||||
static struct assign
|
||||
*find_next_assign
|
||||
(struct assign *);
|
||||
static struct section
|
||||
*find_section (const char *);
|
||||
static void dump_deviceids_pci (void);
|
||||
|
|
@ -126,6 +129,24 @@ find_assign (const char *s, const char *k)
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
static struct assign *
|
||||
find_next_assign (struct assign *a)
|
||||
{
|
||||
struct assign *assign;
|
||||
|
||||
TAILQ_FOREACH(assign, &ah, link) {
|
||||
if (assign == a)
|
||||
break;
|
||||
}
|
||||
|
||||
assign = assign->link.tqe_next;
|
||||
|
||||
if (assign == NULL || assign->section != a->section)
|
||||
return(NULL);
|
||||
|
||||
return (assign);
|
||||
}
|
||||
|
||||
static const char *
|
||||
stringcvt(const char *s)
|
||||
{
|
||||
|
|
@ -239,9 +260,14 @@ dump_deviceids_pci()
|
|||
char xpsec[256];
|
||||
int found = 0;
|
||||
|
||||
/* Emit start of PCI device table */
|
||||
fprintf (ofp, "#define NDIS_PCI_DEV_TABLE");
|
||||
|
||||
/* Find manufacturer name */
|
||||
manf = find_assign("Manufacturer", NULL);
|
||||
|
||||
nextmanf:
|
||||
|
||||
/* Find manufacturer section */
|
||||
if (manf->vals[1] != NULL &&
|
||||
(strcasecmp(manf->vals[1], "NT.5.1") == 0 ||
|
||||
|
|
@ -268,13 +294,10 @@ dump_deviceids_pci()
|
|||
}
|
||||
|
||||
if (found == 0)
|
||||
return;
|
||||
goto done;
|
||||
|
||||
found = 0;
|
||||
|
||||
/* Emit start of PCI device table */
|
||||
fprintf (ofp, "#define NDIS_PCI_DEV_TABLE");
|
||||
|
||||
retry:
|
||||
|
||||
/*
|
||||
|
|
@ -304,10 +327,18 @@ retry:
|
|||
goto retry;
|
||||
}
|
||||
|
||||
/* Handle Manufacturer sections with multiple entries. */
|
||||
manf = find_next_assign(manf);
|
||||
|
||||
if (manf != NULL)
|
||||
goto nextmanf;
|
||||
|
||||
done:
|
||||
/* Emit end of table */
|
||||
|
||||
fprintf(ofp, "\n\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -322,6 +353,8 @@ dump_deviceids_pcmcia()
|
|||
/* Find manufacturer name */
|
||||
manf = find_assign("Manufacturer", NULL);
|
||||
|
||||
nextmanf:
|
||||
|
||||
/* Find manufacturer section */
|
||||
if (manf->vals[1] != NULL &&
|
||||
(strcasecmp(manf->vals[1], "NT.5.1") == 0 ||
|
||||
|
|
@ -348,7 +381,7 @@ dump_deviceids_pcmcia()
|
|||
}
|
||||
|
||||
if (found == 0)
|
||||
return;
|
||||
goto done;
|
||||
|
||||
found = 0;
|
||||
|
||||
|
|
@ -384,10 +417,18 @@ retry:
|
|||
goto retry;
|
||||
}
|
||||
|
||||
/* Handle Manufacturer sections with multiple entries. */
|
||||
manf = find_next_assign(manf);
|
||||
|
||||
if (manf != NULL)
|
||||
goto nextmanf;
|
||||
|
||||
done:
|
||||
/* Emit end of table */
|
||||
|
||||
fprintf(ofp, "\n\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -573,9 +614,14 @@ dump_regvals(void)
|
|||
if (strcasecmp(assign->vals[0], "$windows nt$") == 0)
|
||||
is_winnt++;
|
||||
|
||||
/* Emit start of block */
|
||||
fprintf (ofp, "ndis_cfg ndis_regvals[] = {");
|
||||
|
||||
/* Find manufacturer name */
|
||||
manf = find_assign("Manufacturer", NULL);
|
||||
|
||||
nextmanf:
|
||||
|
||||
/* Find manufacturer section */
|
||||
if (manf->vals[1] != NULL &&
|
||||
(strcasecmp(manf->vals[1], "NT.5.1") == 0 ||
|
||||
|
|
@ -590,9 +636,6 @@ dump_regvals(void)
|
|||
} else
|
||||
sec = find_section(manf->vals[0]);
|
||||
|
||||
/* Emit start of block */
|
||||
fprintf (ofp, "ndis_cfg ndis_regvals[] = {");
|
||||
|
||||
retry:
|
||||
|
||||
TAILQ_FOREACH(assign, &ah, link) {
|
||||
|
|
@ -640,6 +683,11 @@ retry:
|
|||
goto retry;
|
||||
}
|
||||
|
||||
manf = find_next_assign(manf);
|
||||
|
||||
if (manf != NULL)
|
||||
goto nextmanf;
|
||||
|
||||
fprintf(ofp, "\n\t{ NULL, NULL, { 0 }, 0 }\n};\n\n");
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue