Commit 36743e75 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: cleanup ISDN net / ioctl code

Try to convert the setup of network interfaces into something readable.
In particular, use dummy inline functions to get rid of
#ifdef CONFIG_ISDN_* spread all over the place everywhere and separate 
stuff into smaller functions.
parent 67cba4d4
...@@ -106,3 +106,39 @@ struct concap_proto * isdn_concap_new( int encap ) ...@@ -106,3 +106,39 @@ struct concap_proto * isdn_concap_new( int encap )
} }
return NULL; return NULL;
} }
void isdn_x25_encap_changed(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
{
isdn_net_local *lp = &p->local;
struct concap_proto * cprot = p -> cprot;
unsigned long flags;
/* delete old encapsulation protocol if present ... */
save_flags(flags);
cli(); /* avoid races with incoming events trying to
call cprot->pops methods */
if( cprot && cprot -> pops )
cprot -> pops -> proto_del ( cprot );
p -> cprot = NULL;
lp -> dops = NULL;
restore_flags(flags);
/* ... , prepare for configuration of new one ... */
switch ( cfg -> p_encap ){
case ISDN_NET_ENCAP_X25IFACE:
lp -> dops = &isdn_concap_reliable_dl_dops;
}
/* ... and allocate new one ... */
p -> cprot = isdn_concap_new( cfg -> p_encap );
/* p -> cprot == NULL now if p_encap is not supported
by means of the concap_proto mechanism */
/* the protocol is not configured yet; this will
happen later when isdn_net_reset() is called */
}
int isdn_x25_setup_dev(isdn_net_dev *p)
{
p->dev.type = ARPHRD_X25; /* change ARP type */
p->dev.addr_len = 0;
return 0;
}
...@@ -9,6 +9,27 @@ ...@@ -9,6 +9,27 @@
extern struct concap_device_ops isdn_concap_reliable_dl_dops; extern struct concap_device_ops isdn_concap_reliable_dl_dops;
extern struct concap_device_ops isdn_concap_demand_dial_dops; extern struct concap_device_ops isdn_concap_demand_dial_dops;
extern struct concap_proto * isdn_concap_new( int );
struct concap_proto *isdn_concap_new(int);
#ifdef CONFIG_ISDN_X25
void isdn_x25_encap_changed(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg);
int isdn_x25_setup_dev(isdn_net_dev *p);
#else
static inline void
isdn_x25_encap_changed(isdn_net_dev *p, isdn_net_ioctl_cfg *cfg)
{
}
static inline int
isdn_x25_setup_dev(isdn_net_dev *p)
{
printk(KERN_WARNING "ISDN: SyncPPP support not configured\n");
return -EINVAL;
}
#endif
This diff is collapsed.
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/ppp-comp.h> #include <linux/ppp-comp.h>
#include <linux/if_arp.h>
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
...@@ -2901,3 +2902,12 @@ static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_ ...@@ -2901,3 +2902,12 @@ static int isdn_ppp_set_compressor(struct ippp_struct *is, struct isdn_ppp_comp_
} }
return -EINVAL; return -EINVAL;
} }
int isdn_ppp_setup_dev(isdn_net_dev *p)
{
p->dev.type = ARPHRD_PPP; /* change ARP type */
p->dev.addr_len = 0;
p->dev.do_ioctl = isdn_ppp_dev_ioctl;
return 0;
}
...@@ -20,13 +20,27 @@ extern int isdn_ppp_free(isdn_net_local *); ...@@ -20,13 +20,27 @@ extern int isdn_ppp_free(isdn_net_local *);
extern int isdn_ppp_bind(isdn_net_local *); extern int isdn_ppp_bind(isdn_net_local *);
extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *); extern int isdn_ppp_xmit(struct sk_buff *, struct net_device *);
extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *); extern void isdn_ppp_receive(isdn_net_dev *, isdn_net_local *, struct sk_buff *);
extern int isdn_ppp_dev_ioctl(struct net_device *, struct ifreq *, int);
extern int isdn_ppp_dial_slave(char *); extern int isdn_ppp_dial_slave(char *);
extern void isdn_ppp_wakeup_daemon(isdn_net_local *); extern void isdn_ppp_wakeup_daemon(isdn_net_local *);
extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc); extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc);
extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc); extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc);
#ifdef CONFIG_ISDN_PPP
int isdn_ppp_setup_dev(isdn_net_dev *p);
#else
static inline int
isdn_ppp_setup_dev(isdn_net_dev *p)
{
printk(KERN_WARNING "ISDN: SyncPPP support not configured\n");
return -EINVAL;
}
#endif
#define IPPP_OPEN 0x01 #define IPPP_OPEN 0x01
#define IPPP_CONNECT 0x02 #define IPPP_CONNECT 0x02
#define IPPP_CLOSEWAIT 0x04 #define IPPP_CLOSEWAIT 0x04
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment