Commit 51430a3c authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Use <linux/list.h> for list of phone numbers

Simplifies the code which was previously using an open coded
singly linked list.

Also, deleting a phone number during dial-out could easily oops
the kernel before this patch.
parent 7e22da6a
This diff is collapsed.
...@@ -413,8 +413,6 @@ get_arg(void *b, void *val, int len) ...@@ -413,8 +413,6 @@ get_arg(void *b, void *val, int len)
static int static int
set_arg(void *b, void *val,int len) set_arg(void *b, void *val,int len)
{ {
if(len <= 0)
len = sizeof(void *);
if (copy_to_user(b, (void *) val, len)) if (copy_to_user(b, (void *) val, len))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -560,13 +558,18 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned ...@@ -560,13 +558,18 @@ isdn_ppp_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned
return isdn_ppp_set_compressor(is, &data); return isdn_ppp_set_compressor(is, &data);
case PPPIOCGCALLINFO: case PPPIOCGCALLINFO:
{ {
struct isdn_net_phone *phone;
struct pppcallinfo pci; struct pppcallinfo pci;
int i;
memset((char *) &pci,0,sizeof(struct pppcallinfo)); memset((char *) &pci,0,sizeof(struct pppcallinfo));
if(lp) if(lp) {
{
strncpy(pci.local_num,lp->msn,63); strncpy(pci.local_num,lp->msn,63);
if(lp->dial) { i = 0;
strncpy(pci.remote_num,lp->dial->num,63); list_for_each_entry(phone, &lp->phone[1], list) {
if (i++ == lp->dial) {
strncpy(pci.remote_num,phone->num,63);
break;
}
} }
pci.charge_units = lp->charge; pci.charge_units = lp->charge;
if(lp->outgoing) if(lp->outgoing)
......
...@@ -266,7 +266,7 @@ typedef struct { ...@@ -266,7 +266,7 @@ typedef struct {
/* Phone-list-element */ /* Phone-list-element */
struct isdn_net_phone { struct isdn_net_phone {
struct isdn_net_phone *next; struct list_head list;
char num[ISDN_MSNLEN]; char num[ISDN_MSNLEN];
}; };
...@@ -334,10 +334,10 @@ typedef struct isdn_net_local_s { ...@@ -334,10 +334,10 @@ typedef struct isdn_net_local_s {
ulong sqfull_stamp; /* Start-Time of overload */ ulong sqfull_stamp; /* Start-Time of overload */
ulong slavedelay; /* Dynamic bundling delaytime */ ulong slavedelay; /* Dynamic bundling delaytime */
int triggercps; /* BogoCPS needed for trigger slave */ int triggercps; /* BogoCPS needed for trigger slave */
struct isdn_net_phone *phone[2]; /* List of remote-phonenumbers */ struct list_head phone[2]; /* List of remote-phonenumbers */
/* phone[0] = Incoming Numbers */ /* phone[0] = Incoming Numbers */
/* phone[1] = Outgoing Numbers */ /* phone[1] = Outgoing Numbers */
struct isdn_net_phone *dial; /* Pointer to dialed number */ int dial; /* # of phone number just dialed */
struct net_device *master; /* Ptr to Master device for slaves */ struct net_device *master; /* Ptr to Master device for slaves */
struct net_device *slave; /* Ptr to Slave device for masters */ struct net_device *slave; /* Ptr to Slave device for masters */
struct isdn_net_local_s *next; /* Ptr to next link in bundle */ struct isdn_net_local_s *next; /* Ptr to next link in bundle */
......
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