> 2) I'm not sure I like the strncmp(.., "md", 2) stuff, as that means that
> it would also match any other device name that might begin with md, which
> potentially might not be provided by the md driver. This is currently (I
> suspect) hypothetical as we don't have any other drivers beginning with
> md, but it would be nice not to preclude that in the future. Restricting
> all possible disk device names to two letters, of which the second is
> always d, is not a scalable approach. That said, writing an easy matching
> function without that assumption probably isn't all that easy, either.
Assuming that a device name must consist of letters (which I suspect
is the case), it's fairly trivial; just check that what follows 'md'
is a number.
Here's a patch against what I sent in previously to do that. The
original with this included can be found at
http://www.unixfreak.org/~dima/home/md-list3.diff.
Thanks again
Dima Dorfman
[EMAIL PROTECTED]
--- mdconfig.c.o2 Thu Feb 21 05:27:00 2001
+++ mdconfig.c Thu Feb 22 16:32:34 2001
@@ -195,7 +195,7 @@
int
list(void)
{
- char *disklist, *p, *p2;
+ char *disklist, *p, *p2, *p3;
int dll; /* disklist length */
int mds[512], *mdsp, mdsc, i;
@@ -211,7 +211,9 @@
if (strncmp(p2, "md", 2) != 0)
continue;
p2 += 2;
- *mdsp = strtoul(p2, NULL, 10);
+ *mdsp = strtoul(p2, &p3, 10);
+ if (p2 == p3)
+ continue;
mdsc++;
if (++mdsp >= &mds[sizeof(mds)])
break;
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message