kernels/linux-2.4.0/drivers/sound/dmasound/dmasound_q40.c
/* userCount, frameUsed, frameLeft == byte counts */
userCount, frameUsed, frameLeft == byte counts
userCount frameUsed frameLeft == byte counts
static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount,
			   u_char frame[], ssize_t *frameUsed,
			   ssize_t frameLeft)
{
	char *table = dmasound.soft.format == AFMT_MU_LAW ? dmasound_ulaw2dma8: dmasound_alaw2dma8;
	ssize_t count, used;
	u_char *p = (u_char *) &frame[*frameUsed];
	used = count = min(userCount, frameLeft);
	if (copy_from_user(p,userPtr,count))
	  return -EFAULT;
	while (count > 0) {
		*p = table[*p]+128;
		p++;
		count--;
	}
	*frameUsed += used ;
	return used;
}
static ssize_t q40_ct_law ( const u_char * userPtr , size_t userCount , u_char frame [ ] , ssize_t * frameUsed , ssize_t frameLeft ) { char * table = dmasound . soft . format == AFMT_MU_LAW ? dmasound_ulaw2dma8 : dmasound_alaw2dma8 ; ssize_t count , used ; u_char * p = ( u_char * ) & frame [ * frameUsed ] ; used = count = min ( userCount , frameLeft ) ; if ( copy_from_user ( p , userPtr , count ) ) return - EFAULT ; while ( count > 0 ) { * p = table [ * p ] + 128 ; p ++ ; count -- ; } * frameUsed += used ; return used ; }
userCount, frameUsed, frameLeft == byte counts
userCount frameUsed frameLeft == byte counts