diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-12-06 23:51:34 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-12-06 23:51:34 +0000 |
commit | 230e5ab6a084ed50470f101934782dbf54b0d06b (patch) | |
tree | 5dd821c8d33f450470588e7a543f74bf74306e9e /drivers/net/ppp.c | |
parent | c9b1c8a64c6444d189856f1e26bdcb8b4cd0113a (diff) |
Merge with Linux 2.1.67.
Diffstat (limited to 'drivers/net/ppp.c')
-rw-r--r-- | drivers/net/ppp.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/drivers/net/ppp.c b/drivers/net/ppp.c index 740bfc1ff..3c86a779f 100644 --- a/drivers/net/ppp.c +++ b/drivers/net/ppp.c @@ -190,10 +190,10 @@ static struct net_device_stats *ppp_dev_stats (struct device *); * TTY callbacks */ -static int ppp_tty_read (struct tty_struct *, struct file *, __u8 *, - unsigned int); -static int ppp_tty_write (struct tty_struct *, struct file *, const __u8 *, - unsigned int); +static ssize_t ppp_tty_read (struct tty_struct *, struct file *, __u8 *, + size_t); +static ssize_t ppp_tty_write (struct tty_struct *, struct file *, + const __u8 *, size_t); static int ppp_tty_ioctl (struct tty_struct *, struct file *, unsigned int, unsigned long); static unsigned int ppp_tty_poll (struct tty_struct *tty, struct file *filp, poll_table * wait); @@ -405,11 +405,6 @@ ppp_init_dev (struct device *dev) /* New-style flags */ dev->flags = IFF_POINTOPOINT; - dev->family = AF_INET; - dev->pa_addr = 0; - dev->pa_brdaddr = 0; - dev->pa_mask = 0; - dev->pa_alen = 4; /* sizeof (__u32) */ return 0; } @@ -687,9 +682,9 @@ ppp_release (struct ppp *ppp) if (tty != NULL && tty->disc_data == ppp) tty->disc_data = NULL; /* Break the tty->ppp link */ + /* Strong layering violation. */ if (dev && dev->flags & IFF_UP) { dev_close (dev); /* close the device properly */ - dev->flags = 0; /* prevent recursion */ } ppp_free_buf (ppp->rbuf); @@ -1665,13 +1660,12 @@ ppp_doframe (struct ppp *ppp) waiting if necessary */ -static int -ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, - unsigned int nr) +static ssize_t +ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, size_t nr) { struct ppp *ppp = tty2ppp (tty); __u8 c; - int len, indx; + ssize_t len, indx; #define GETC(c) \ { \ @@ -1692,8 +1686,8 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, if (ppp->flags & SC_DEBUG) printk (KERN_DEBUG - "ppp_tty_read: called buf=%p nr=%u\n", - buf, nr); + "ppp_tty_read: called buf=%p nr=%lu\n", + buf, (unsigned long)nr); /* * Acquire the read lock. */ @@ -1711,7 +1705,7 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, current->state = TASK_INTERRUPTIBLE; schedule (); - if (current->signal & ~current->blocked) + if (signal_pending(current)) return -EINTR; continue; } @@ -1753,7 +1747,7 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, "ppp_tty_read: sleeping(read_wait)\n"); interruptible_sleep_on (&ppp->read_wait); - if (current->signal & ~current->blocked) + if (signal_pending(current)) return -EINTR; continue; } @@ -1761,7 +1755,8 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, * Reset the time of the last read operation. */ if (ppp->flags & SC_DEBUG) - printk (KERN_DEBUG "ppp_tty_read: len = %d\n", len); + printk (KERN_DEBUG "ppp_tty_read: len = %ld\n", + (long)len); /* * Ensure that the frame will fit within the caller's buffer. If not, then * discard the frame from the input buffer. @@ -1771,8 +1766,8 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, if (ppp->flags & SC_DEBUG) printk (KERN_DEBUG - "ppp: read of %u bytes too small for %d " - "frame\n", nr, len + 2); + "ppp: read of %lu bytes too small for %ld " + "frame\n", (unsigned long)nr, (long)len + 2); ppp->ubuf->tail += len; ppp->ubuf->tail &= ppp->ubuf->size; clear_bit (0, &ppp->ubuf->locked); @@ -1811,7 +1806,8 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf, len += 2; /* Account for ADDRESS and CONTROL bytes */ if (ppp->flags & SC_DEBUG) printk (KERN_DEBUG - "ppp_tty_read: passing %d bytes up\n", len); + "ppp_tty_read: passing %ld bytes up\n", + (long) len); return len; } #undef GETC @@ -2051,13 +2047,13 @@ send_revise_frame (register struct ppp *ppp, __u8 *data, int len) * we have to put the FCS field on ourselves */ -static int +static ssize_t ppp_tty_write (struct tty_struct *tty, struct file *file, const __u8 * data, - unsigned int count) + size_t count) { struct ppp *ppp = tty2ppp (tty); __u8 *new_data; - int status; + ssize_t status; /* * Verify the pointers. */ @@ -2075,7 +2071,8 @@ ppp_tty_write (struct tty_struct *tty, struct file *file, const __u8 * data, if (ppp->flags & SC_DEBUG) printk (KERN_WARNING "ppp_tty_write: truncating user packet " - "from %u to mtu %d\n", count, PPP_MTU); + "from %lu to mtu %d\n", + (unsigned long) count, PPP_MTU); count = PPP_MTU; } /* @@ -2104,7 +2101,7 @@ ppp_tty_write (struct tty_struct *tty, struct file *file, const __u8 * data, return 0; } - if (current->signal & ~current->blocked) { + if (signal_pending(current)) { kfree (new_data); return -EINTR; } @@ -2129,7 +2126,7 @@ ppp_tty_write (struct tty_struct *tty, struct file *file, const __u8 * data, */ ppp_dev_xmit_frame (ppp, ppp->tbuf, new_data, count); kfree (new_data); - return (int) count; + return count; } /* @@ -2399,7 +2396,7 @@ ppp_tty_ioctl (struct tty_struct *tty, struct file * file, sizeof (struct ppp_idle)); if (error == 0) { struct ppp_idle cur_ddinfo; - __u32 cur_jiffies = jiffies; + unsigned long cur_jiffies = jiffies; /* change absolute times to relative times. */ cur_ddinfo.xmit_idle = (cur_jiffies - ppp->ddinfo.xmit_idle) / HZ; @@ -2620,9 +2617,6 @@ ppp_dev_open (struct device *dev) { struct ppp *ppp = dev2ppp (dev); - /* reset POINTOPOINT every time, since dev_close zaps it! */ - dev->flags |= IFF_POINTOPOINT; - if (ppp2tty (ppp) == NULL) { if (ppp->flags & SC_DEBUG) printk (KERN_ERR @@ -3017,12 +3011,16 @@ ppp_dev_xmit (sk_buff *skb, struct device *dev) printk (KERN_WARNING "ppp_dev_xmit: null packet!\n"); return 0; } + /* * Avoid timing problem should tty hangup while data is queued to be sent */ if (!ppp->inuse) { dev_kfree_skb (skb, FREE_WRITE); + printk("I am dying to know, are you still alive?\n"); +#ifdef main_got_it_is_something dev_close (dev); +#endif return 0; } /* |