kernels/linux-2.4.0/drivers/net/ppp_generic.c
/*
 * Create a new, unattached ppp channel.
 */
Create a new, unattached ppp channel.
Create a new unattached ppp channel .
int
ppp_register_channel(struct ppp_channel *chan)
{
	struct channel *pch;
	pch = kmalloc(sizeof(struct channel), GFP_ATOMIC);
	if (pch == 0)
		return -ENOMEM;
	memset(pch, 0, sizeof(struct channel));
	pch->ppp = NULL;
	pch->chan = chan;
	chan->ppp = pch;
	init_ppp_file(&pch->file, CHANNEL);
	pch->file.hdrlen = chan->hdrlen;
#ifdef CONFIG_PPP_MULTILINK
	pch->lastseq = -1;
#endif 
	spin_lock_init(&pch->downl);
	pch->upl = RW_LOCK_UNLOCKED;
	spin_lock_bh(&all_channels_lock);
	pch->file.index = ++last_channel_index;
	list_add(&pch->file.list, &all_channels);
	spin_unlock_bh(&all_channels_lock);
	MOD_INC_USE_COUNT;
	return 0;
}
int ppp_register_channel ( struct ppp_channel * chan ) { struct channel * pch ; pch = kmalloc ( sizeof ( struct channel ) , GFP_ATOMIC ) ; if ( pch == 0 ) return - ENOMEM ; memset ( pch , 0 , sizeof ( struct channel ) ) ; pch -> ppp = NULL ; pch -> chan = chan ; chan -> ppp = pch ; init_ppp_file ( & pch -> file , CHANNEL ) ; pch -> file . hdrlen = chan -> hdrlen ; #ifdef CONFIG_PPP_MULTILINK pch -> lastseq = -1 ; #endif spin_lock_init ( & pch -> downl ) ; pch -> upl = RW_LOCK_UNLOCKED ; spin_lock_bh ( & all_channels_lock ) ; pch -> file . index = ++ last_channel_index ; list_add ( & pch -> file . list , & all_channels ) ; spin_unlock_bh ( & all_channels_lock ) ; MOD_INC_USE_COUNT ; return 0 ; }
Create a new, unattached ppp channel.
Create a new unattached ppp channel .
/* CONFIG_PPP_MULTILINK */