Date: Sun, 23 Dec 2001 17:52:20 -0500 From: The Anarcat <anarcat@anarcat.dyndns.org> 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> In-Reply-To: <20011223224933.GF34708@shall.anarcat.dyndns.org> References: <20011223224933.GF34708@shall.anarcat.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011223225220.GG34708>