bin/92062: mdconfig(8): mdconfig -l shows 95 entries max.

Ruslan Ermilov ru at FreeBSD.org
Tue Aug 29 20:50:27 UTC 2006


The following reply was made to PR bin/92062; it has been noted by GNATS.

From: Ruslan Ermilov <ru at FreeBSD.org>
To: "Andrey V. Elsukov" <bu7cher at yandex.ru>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/92062: mdconfig(8): mdconfig -l shows 95 entries max.
Date: Wed, 30 Aug 2006 00:40:43 +0400

 On Tue, Aug 29, 2006 at 06:40:22PM +0000, Andrey V. Elsukov wrote:
 >  Can you test this patch?
 >  
 >  Index: src/sys/dev/md/md.c
 >  ===================================================================
 >  RCS file: /home/ncvs/src/sys/dev/md/md.c,v
 >  retrieving revision 1.153.2.6
 >  diff -u -r1.153.2.6 md.c
 >  --- src/sys/dev/md/md.c 14 Feb 2006 14:46:22 -0000      1.153.2.6
 >  +++ src/sys/dev/md/md.c 29 Aug 2006 18:33:35 -0000
 >  @@ -1091,10 +1091,9 @@
 >          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;
 >  +                       if (i < MDNPAD)
 >  +                               mdio->md_pad[i] = sc->unit;
 >  +                       i++;
 >                  }
 >                  mdio->md_pad[0] = i - 1;
 >                  return (0);
 >  
 Your patch is against RELENG_6 revision, but MDIOCLIST is only used
 by mdconfig(8) in 5.x.  I think the patch should apply cleanly to
 RELENG_5.  I also think that MDIOCLIST should be removed from HEAD
 and RELENG_6 with an extreme prejudice.
 
 OTOH, your patch, if committed to RELENG_5, will cause the following
 code in 5.x's mdconfig.c to DTRT and print "... %d more".
 
 :         if (ioctl(fd, MDIOCLIST, &mdio) < 0)
 :                 err(1, "ioctl(/dev/%s)", MDCTL_NAME);
 :         for (unit = 0; unit < mdio.md_pad[0] && unit < MDNPAD - 1; unit++) {
 :                 printf("%s%s%d", unit > 0 ? " " : "",
 :                     nflag ? "" : MD_NAME, mdio.md_pad[unit + 1]);
 :         }
 :         if (mdio.md_pad[0] - unit > 0)
 :                 printf(" ... %d more", mdio.md_pad[0] - unit);
 
 
 Cheers,
 -- 
 Ruslan Ermilov
 ru at FreeBSD.org
 FreeBSD committer


More information about the freebsd-bugs mailing list