diff options
author | phk <phk@FreeBSD.org> | 2003-01-27 07:58:18 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-01-27 07:58:18 +0000 |
commit | c822610d8f077afbca293cd4ca98434e68602629 (patch) | |
tree | ff1e1a4b9aa10743fc7883a3e369e7630b907ba4 /sys/dev/md | |
parent | 62ade07c0f030962ce8806bcf1b8e0f0a0a4e965 (diff) | |
download | FreeBSD-src-c822610d8f077afbca293cd4ca98434e68602629.zip FreeBSD-src-c822610d8f077afbca293cd4ca98434e68602629.tar.gz |
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.
Diffstat (limited to 'sys/dev/md')
-rw-r--r-- | sys/dev/md/md.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 4befee3..f405b62 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -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); }; |