コード例 #1
0
/* (re-)initialize the data structures for x25iface encapsulation
 */
static int isdn_x25iface_proto_restart(struct concap_proto *cprot,
					struct net_device *ndev,
					struct concap_device_ops *dops)
{
	ix25_pdata_t * pda = cprot -> proto_data ;
	ulong flags;

	IX25DEBUG( "isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev) );

	if ( pdata_is_bad( pda ) ) return -1;

	if( !( dops  && dops -> data_req && dops -> connect_req 
	       && dops -> disconn_req )  ){
		printk( KERN_WARNING "isdn_x25iface_restart: required dops"
			" missing\n" );
		isdn_x25iface_proto_close(cprot);
		return -1;
	}
	spin_lock_irqsave(&cprot->lock, flags);
	cprot -> net_dev = ndev;
	cprot -> pops = &ix25_pops;
	cprot -> dops = dops;
	pda -> state = WAN_DISCONNECTED;
	spin_unlock_irqrestore(&cprot->lock, flags);
	return 0;
}
コード例 #2
0
ファイル: isdn_x25iface.c プロジェクト: cilynx/dd-wrt
/* (re-)initialize the data structures for x25iface encapsulation
 */
int isdn_x25iface_proto_restart(struct concap_proto *cprot,
				struct net_device *ndev, 
				struct concap_device_ops *dops)
{
	ix25_pdata_t * pda = cprot -> proto_data ;
	ulong flags;

	IX25DEBUG( "isdn_x25iface_proto_restart %s \n", MY_DEVNAME(ndev) );

	if ( pdata_is_bad( pda ) ) return -1;

	if( !( dops  && dops -> data_req && dops -> connect_req 
	       && dops -> disconn_req )  ){
		printk( KERN_WARNING "isdn_x25iface_restart: required dops"
			" missing\n" );
		isdn_x25iface_proto_close(cprot);
		return -1;
	}
	save_flags(flags);
	cli();  /* avoid races with incoming events calling pops methods while
		 cprot members are inconsistent */  
	cprot -> net_dev = ndev;
	cprot -> pops = &ix25_pops;
	cprot -> dops = dops;
	pda -> state = WAN_DISCONNECTED;
	restore_flags(flags);
	return 0;
}
コード例 #3
0
/* Delete the x25iface encapsulation protocol instance
 */
static void isdn_x25iface_proto_del(struct concap_proto *cprot){

	ix25_pdata_t * tmp;
 
	IX25DEBUG( "isdn_x25iface_proto_del \n" );
	if( ! cprot ){
		printk( KERN_ERR "isdn_x25iface_proto_del: "
			"concap_proto pointer is NULL\n" );
		return;
	}
	tmp = cprot -> proto_data;
	if( tmp == NULL ){ 
		printk( KERN_ERR "isdn_x25iface_proto_del: inconsistent "
			"proto_data pointer (maybe already deleted?)\n"); 
		return;
	}
	/* close if the protocol is still open */
	if( cprot -> dops ) isdn_x25iface_proto_close(cprot);
	/* freeing the storage should be sufficient now. But some additional
	   settings might help to catch wild pointer bugs */
	tmp -> magic = 0;
	cprot -> proto_data = NULL;

	kfree( tmp );
	return;
}
コード例 #4
0
static void isdn_x25iface_proto_del(struct concap_proto *cprot) {

	ix25_pdata_t *tmp;

	IX25DEBUG("isdn_x25iface_proto_del \n");
	if (!cprot) {
		printk(KERN_ERR "isdn_x25iface_proto_del: "
		       "concap_proto pointer is NULL\n");
		return;
	}
	tmp = cprot->proto_data;
	if (tmp == NULL) {
		printk(KERN_ERR "isdn_x25iface_proto_del: inconsistent "
		       "proto_data pointer (maybe already deleted?)\n");
		return;
	}
	
	if (cprot->dops) isdn_x25iface_proto_close(cprot);
	tmp->magic = 0;
	cprot->proto_data = NULL;

	kfree(tmp);
	return;
}