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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109929
@ -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 New Issue
Block a user