From owner-freebsd-qa Sun Dec 23 14:52:36 2001 Delivered-To: freebsd-qa@freebsd.org Received: from tomts9-srv.bellnexxia.net (tomts9.bellnexxia.net [209.226.175.53]) by hub.freebsd.org (Postfix) with ESMTP id 6557237B41A; Sun, 23 Dec 2001 14:52:30 -0800 (PST) Received: from khan.anarcat.dyndns.org ([65.94.189.35]) by tomts9-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20011223225228.EOAU3274.tomts9-srv.bellnexxia.net@khan.anarcat.dyndns.org>; Sun, 23 Dec 2001 17:52:28 -0500 Received: from shall.anarcat.dyndns.org (shall.anarcat.dyndns.org [192.168.0.1]) by khan.anarcat.dyndns.org (Postfix) with ESMTP id 8ED5A1B24; Sun, 23 Dec 2001 17:52:26 -0500 (EST) Received: by shall.anarcat.dyndns.org (Postfix, from userid 1000) id 9CA7920ACD; Sun, 23 Dec 2001 17:52:21 -0500 (EST) Date: Sun, 23 Dec 2001 17:52:20 -0500 From: The Anarcat To: re@freebsd.org, qa@freebsd.org Cc: jkh@freebsd.org Subject: Re: regression tests for possible sysctl kern.disks/libdisk changes/mfc Message-ID: <20011223225220.GG34708@shall.anarcat.dyndns.org> References: <20011223224933.GF34708@shall.anarcat.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bPrm2PuLP7ysUh6c" Content-Disposition: inline In-Reply-To: <20011223224933.GF34708@shall.anarcat.dyndns.org> User-Agent: Mutt/1.3.24i Sender: owner-freebsd-qa@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --bPrm2PuLP7ysUh6c Content-Type: multipart/mixed; boundary="Mit9XoPEfICDqq/V" Content-Disposition: inline --Mit9XoPEfICDqq/V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I forgot to attach. The patch should apply cleanly on stable. A. --Mit9XoPEfICDqq/V Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch1 Content-Transfer-Encoding: quoted-printable Index: Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/lib/libdisk/Makefile,v retrieving revision 1.27.2.5 diff -u -r1.27.2.5 Makefile --- Makefile 18 Sep 2001 06:47:30 -0000 1.27.2.5 +++ Makefile 22 Dec 2001 23:58:22 -0000 @@ -6,7 +6,7 @@ INCS=3D libdisk.h =20 # Remove KERN_DISKS_BROKEN when kern.disks sysctl returns disks in sorted = order -CFLAGS+=3D -Wall -DKERN_DISKS_BROKEN +CFLAGS+=3D -Wall .if ${MACHINE} =3D=3D "pc98" CFLAGS+=3D -DPC98 .endif Index: disk.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/lib/libdisk/disk.c,v retrieving revision 1.50.2.14 diff -u -r1.50.2.14 disk.c --- disk.c 18 Sep 2001 06:47:30 -0000 1.50.2.14 +++ disk.c 23 Dec 2001 00:43:01 -0000 @@ -483,10 +483,18 @@ static char * device_list[] =3D {"aacd", "ad", "da", "afd", "fla", "idad",= "mlxd", "amrd", "twed", "ar", "fd", 0}; #endif =20 +int qstrcmp(const void* a, const void* b) { + + char *str1 =3D *(char**)a; + char *str2 =3D *(char**)b; + return strcmp(str1, str2); + +} + char ** Disk_Names() { - int i,j,k; + int i,j,disk_cnt; char disk[25]; char diskname[25]; struct stat st; @@ -506,14 +514,16 @@ error =3D sysctlbyname("kern.disks", disklist, &listsize, NULL, 0); if (error)=20 return NULL; - k =3D 0; - for (dp =3D disks; ((*dp =3D strsep(&disklist, " ")) !=3D NULL) && k = < MAX_NO_DISKS; k++, dp++); - return disks; - } + disk_cnt =3D 0; + for (dp =3D disks; ((*dp =3D strsep(&disklist, " ")) !=3D NULL) &&=20 + disk_cnt < MAX_NO_DISKS; disk_cnt++, dp++); + } else { warn("kern.disks sysctl not available"); #endif - k =3D 0; + disk_cnt =3D 0; for (j =3D 0; device_list[j]; j++) { + if(disk_cnt >=3D MAX_NO_DISKS) + break; for (i =3D 0; i < MAX_NO_DISKS; i++) { sprintf(diskname, "%s%d", device_list[j], i); sprintf(disk, _PATH_DEV"%s", diskname); @@ -529,12 +539,17 @@ continue; } close(fd); - disks[k++] =3D strdup(diskname); - if(k =3D=3D MAX_NO_DISKS) - return disks; + disks[disk_cnt++] =3D strdup(diskname); + if(disk_cnt >=3D MAX_NO_DISKS) + break; } } - return disks; +#if !defined(PC98) && !defined(KERN_DISKS_BROKEN) + } +#endif + qsort(disks, disk_cnt, sizeof(char*), qstrcmp); + =20 + return disks; } =20 #ifdef PC98 --Mit9XoPEfICDqq/V-- --bPrm2PuLP7ysUh6c Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjwmYCMACgkQttcWHAnWiGddTgCfbl6RkxNatFk8rT085Ha8f3l0 qnwAn0vV+3x3Tq8cDGvpMmX7nO5peTFR =JchB -----END PGP SIGNATURE----- --bPrm2PuLP7ysUh6c-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-qa" in the body of the message