mirror of
https://github.com/opnsense/src.git
synced 2026-04-24 23:57:30 -04:00
Use <sys/queue.h> macro API.
Submitted by: "Jason" <jsmethers@pdq.net> Reviewed by: /sbin/md5
This commit is contained in:
parent
d4b6ae6159
commit
0d7b8d16dc
1 changed files with 12 additions and 12 deletions
|
|
@ -66,8 +66,8 @@ pnp_scan(int argc, char *argv[])
|
|||
if (verbose) {
|
||||
pager_open();
|
||||
pager_output("PNP scan summary:\n");
|
||||
for (pi = pnp_devices.stqh_first; pi != NULL; pi = pi->pi_link.stqe_next) {
|
||||
pager_output(pi->pi_ident.stqh_first->id_ident); /* first ident should be canonical */
|
||||
STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
|
||||
pager_output(STAILQ_FIRST(&pi->pi_ident)->id_ident); /* first ident should be canonical */
|
||||
if (pi->pi_desc != NULL) {
|
||||
pager_output(" : ");
|
||||
pager_output(pi->pi_desc);
|
||||
|
|
@ -92,7 +92,7 @@ pnp_load(int argc, char *argv[])
|
|||
char *modfname;
|
||||
|
||||
/* find anything? */
|
||||
if (pnp_devices.stqh_first != NULL) {
|
||||
if (STAILQ_FIRST(&pnp_devices) != NULL) {
|
||||
|
||||
/* check for kernel, assign modules handled by static drivers there */
|
||||
if (pnp_scankernel()) {
|
||||
|
|
@ -111,13 +111,13 @@ pnp_load(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* try to load any modules that have been nominated */
|
||||
for (pi = pnp_devices.stqh_first; pi != NULL; pi = pi->pi_link.stqe_next) {
|
||||
STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
|
||||
/* Already loaded? */
|
||||
if ((pi->pi_module != NULL) && (file_findfile(pi->pi_module, NULL) == NULL)) {
|
||||
modfname = malloc(strlen(pi->pi_module) + 4);
|
||||
sprintf(modfname, "%s.ko", pi->pi_module); /* XXX implicit knowledge of KLD module filenames */
|
||||
if (mod_load(pi->pi_module, pi->pi_argc, pi->pi_argv))
|
||||
printf("Could not load module '%s' for device '%s'\n", modfname, pi->pi_ident.stqh_first->id_ident);
|
||||
printf("Could not load module '%s' for device '%s'\n", modfname, STAILQ_FIRST(&pi->pi_ident)->id_ident);
|
||||
free(modfname);
|
||||
}
|
||||
}
|
||||
|
|
@ -133,8 +133,8 @@ pnp_discard(void)
|
|||
{
|
||||
struct pnpinfo *pi;
|
||||
|
||||
while (pnp_devices.stqh_first != NULL) {
|
||||
pi = pnp_devices.stqh_first;
|
||||
while (STAILQ_FIRST(&pnp_devices) != NULL) {
|
||||
pi = STAILQ_FIRST(&pnp_devices);
|
||||
STAILQ_REMOVE_HEAD(&pnp_devices, pi_link);
|
||||
pnp_freeinfo(pi);
|
||||
}
|
||||
|
|
@ -257,14 +257,14 @@ pnp_readconf(char *path)
|
|||
* assigned.
|
||||
* XXX no revision parse/test here yet.
|
||||
*/
|
||||
for (pi = pnp_devices.stqh_first; pi != NULL; pi = pi->pi_link.stqe_next) {
|
||||
STAILQ_FOREACH(pi, &pnp_devices, pi_link) {
|
||||
|
||||
/* no driver assigned, bus matches OK */
|
||||
if ((pi->pi_module == NULL) &&
|
||||
!strcmp(pi->pi_handler->pp_name, currbus)) {
|
||||
|
||||
/* scan idents, take first match */
|
||||
for (id = pi->pi_ident.stqh_first; id != NULL; id = id->id_link.stqe_next)
|
||||
STAILQ_FOREACH(id, &pi->pi_ident, id_link)
|
||||
if (!strcmp(id->id_ident, ident))
|
||||
break;
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ pnp_addident(struct pnpinfo *pi, char *ident)
|
|||
{
|
||||
struct pnpident *id;
|
||||
|
||||
for (id = pi->pi_ident.stqh_first; id != NULL; id = id->id_link.stqe_next)
|
||||
STAILQ_FOREACH(id, &pi->pi_ident, id_link)
|
||||
if (!strcmp(id->id_ident, ident))
|
||||
return; /* already have this one */
|
||||
|
||||
|
|
@ -331,8 +331,8 @@ pnp_freeinfo(struct pnpinfo *pi)
|
|||
{
|
||||
struct pnpident *id;
|
||||
|
||||
while (pi->pi_ident.stqh_first != NULL) {
|
||||
id = pi->pi_ident.stqh_first;
|
||||
while (!STAILQ_EMPTY(&pi->pi_ident)) {
|
||||
id = STAILQ_FIRST(&pi->pi_ident);
|
||||
STAILQ_REMOVE_HEAD(&pi->pi_ident, id_link);
|
||||
free(id->id_ident);
|
||||
free(id);
|
||||
|
|
|
|||
Loading…
Reference in a new issue