FreeBSD/sys/dev/usb/net/uhso.c
/*
 * Expands allocated memory to fit an additional TTY.
 * Two arrays are kept with matching indexes, one for ucom and one
 * for our private data.
 */
Expands allocated memory to fit an additional TTY.
Two arrays are kept with matching indexes, one for ucom and one
for our private data.
Expands allocated memory to fit an additional TTY . Two arrays are kept with matching indexes one for ucom and one for our private data .
static int
uhso_alloc_tty(struct uhso_softc *sc)
{
	sc->sc_ttys++;
	sc->sc_tty = reallocf(sc->sc_tty, sizeof(struct uhso_tty) * sc->sc_ttys,
	    M_USBDEV, M_WAITOK | M_ZERO);
	if (sc->sc_tty == NULL)
		return (-1);
	sc->sc_ucom = reallocf(sc->sc_ucom,
	    sizeof(struct ucom_softc) * sc->sc_ttys, M_USBDEV, M_WAITOK | M_ZERO);
	if (sc->sc_ucom == NULL)
		return (-1);
	sc->sc_tty[sc->sc_ttys - 1].ht_sc = sc;
	UHSO_DPRINTF(1, "Allocated TTY %d\n", sc->sc_ttys - 1);	
	return (sc->sc_ttys - 1);
}
static int uhso_alloc_tty ( struct uhso_softc * sc ) { sc -> sc_ttys ++ ; sc -> sc_tty = reallocf ( sc -> sc_tty , sizeof ( struct uhso_tty ) * sc -> sc_ttys , M_USBDEV , M_WAITOK | M_ZERO ) ; if ( sc -> sc_tty == NULL ) return ( -1 ) ; sc -> sc_ucom = reallocf ( sc -> sc_ucom , sizeof ( struct ucom_softc ) * sc -> sc_ttys , M_USBDEV , M_WAITOK | M_ZERO ) ; if ( sc -> sc_ucom == NULL ) return ( -1 ) ; sc -> sc_tty [ sc -> sc_ttys - 1 ] . ht_sc = sc ; UHSO_DPRINTF ( 1 , " \n " , sc -> sc_ttys - 1 ) ; return ( sc -> sc_ttys - 1 ) ; }
Expands allocated memory to fit an additional TTY.
Expands allocated memory to fit an additional TTY .