ci < &cs->sc_cinfo[cs->sc_nccdisks]; ci++)
ci < &cs->sc_cinfo[cs->sc_nccunits]; ci++)
ccdinterleave(cs, unit)	struct ccd_softc *cs;	int unit;{	struct ccdcinfo *ci, *smallci;	struct ccdiinfo *ii;	daddr_t bn, lbn;	int ix;	u_long size;#ifdef DEBUG	if (ccddebug & CCDB_INIT)		printf("ccdinterleave(%p): ileave %d\n", cs, cs->sc_ileave);#endif	/*	 * Allocate an interleave table.	 * Chances are this is too big, but we don't care.	 */	size = (cs->sc_nccdisks + 1) * sizeof(struct ccdiinfo);	cs->sc_itable = (struct ccdiinfo *)malloc(size, M_DEVBUF, M_WAITOK);	bzero((caddr_t)cs->sc_itable, size);	/*	 * Trivial case: no interleave (actually interleave of disk size).	 * Each table entry represents a single component in its entirety.	 */	if (cs->sc_ileave == 0) {		bn = 0;		ii = cs->sc_itable;		for (ix = 0; ix < cs->sc_nccdisks; ix++) {			/* Allocate space for ii_index. */			ii->ii_index = malloc(sizeof(int), M_DEVBUF, M_WAITOK);			ii->ii_ndisk = 1;			ii->ii_startblk = bn;			ii->ii_startoff = 0;			ii->ii_index[0] = ix;			bn += cs->sc_cinfo[ix].ci_size;			ii++;		}		ii->ii_ndisk = 0;#ifdef DEBUG		if (ccddebug & CCDB_INIT)			printiinfo(cs->sc_itable);#endif		return;	}	/*	 * The following isn't fast or pretty; it doesn't have to be.	 */	size = 0;	bn = lbn = 0;	for (ii = cs->sc_itable; ; ii++) {		/* Allocate space for ii_index. */		ii->ii_index = malloc((sizeof(int) * cs->sc_nccdisks),		    M_DEVBUF, M_WAITOK);		/*		 * Locate the smallest of the remaining components		 */		smallci = NULL;		for (ci = cs->sc_cinfo;		    ci < &cs->sc_cinfo[cs->sc_nccdisks]; ci++)			if (ci->ci_size > size &&			    (smallci == NULL ||			    ci->ci_size < smallci->ci_size))				smallci = ci;		/*		 * Nobody left, all done		 */		if (smallci == NULL) {			ii->ii_ndisk = 0;			break;		}		/*		 * Record starting logical block and component offset		 */		ii->ii_startblk = bn / cs->sc_ileave;		ii->ii_startoff = lbn;		/*		 * Determine how many disks take part in this interleave		 * and record their indices.		 */		ix = 0;		for (ci = cs->sc_cinfo;		    ci < &cs->sc_cinfo[cs->sc_nccdisks]; ci++)			if (ci->ci_size >= smallci->ci_size)				ii->ii_index[ix++] = ci - cs->sc_cinfo;		ii->ii_ndisk = ix;		bn += ix * (smallci->ci_size - size);		lbn = smallci->ci_size / cs->sc_ileave;		size = smallci->ci_size;	}#ifdef DEBUG	if (ccddebug & CCDB_INIT)		printiinfo(cs->sc_itable);#endif}