mirror of
https://github.com/opnsense/src.git
synced 2026-04-24 07:37:25 -04:00
Implement MDIOCLIST which returns the unit numbers of configured md(4)
devices. We use the md_pad[] array and if there are more units than its size the last returned unit number will be -1, but the number of units returned is correct.
This commit is contained in:
parent
b6532aa9a5
commit
16bcbe8cf7
1 changed files with 11 additions and 0 deletions
|
|
@ -1133,6 +1133,7 @@ mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
|
|||
{
|
||||
struct md_ioctl *mdio;
|
||||
struct md_s *sc;
|
||||
int i;
|
||||
|
||||
if (md_debug)
|
||||
printf("mdctlioctl(%s %lx %p %x %p)\n",
|
||||
|
|
@ -1195,6 +1196,16 @@ mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
|
|||
break;
|
||||
}
|
||||
return (0);
|
||||
case MDIOCLIST:
|
||||
i = 1;
|
||||
LIST_FOREACH(sc, &md_softc_list, list) {
|
||||
if (i == MDNPAD - 1)
|
||||
mdio->md_pad[i] = -1;
|
||||
else
|
||||
mdio->md_pad[i++] = sc->unit;
|
||||
}
|
||||
mdio->md_pad[0] = i - 1;
|
||||
return (0);
|
||||
default:
|
||||
return (ENOIOCTL);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue