From e6d0e5ec96cca3d323ab8f919676a00cd72efd63 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Tue, 22 Oct 1996 23:14:19 +0000 Subject: [PATCH] Changes for compatibility to 2.0.X and 2.1.X kernels. --- drivers/isdn/hisax/llglue.c | 5 ++- drivers/isdn/icn/icn.c | 19 +++++--- drivers/isdn/isdn_common.c | 88 +++++++++++++++++++------------------ drivers/isdn/isdn_net.c | 9 ++-- drivers/isdn/isdn_ppp.c | 40 ++++++++++++----- drivers/isdn/isdn_tty.c | 16 ++++--- drivers/isdn/pcbit/drv.c | 13 ++++-- drivers/isdn/teles/callc.c | 5 ++- drivers/isdn/teles/card.c | 17 ++++--- drivers/isdn/teles/llglue.c | 5 ++- include/linux/isdnif.h | 24 ++++++++++ 11 files changed, 159 insertions(+), 82 deletions(-) diff --git a/drivers/isdn/hisax/llglue.c b/drivers/isdn/hisax/llglue.c index 0960b2c6..2ea93b3a 100644 --- a/drivers/isdn/hisax/llglue.c +++ b/drivers/isdn/hisax/llglue.c @@ -7,6 +7,9 @@ * Fritz Elfert * * $Log$ + * Revision 1.1 1996/10/13 20:04:56 keil + * Initial revision + * * */ #define __NO_VERSION__ @@ -36,7 +39,7 @@ HiSax_readstatus(byte * buf, int len, int user, int id, int channel) for (p = buf, count = 0; count < len; p++, count++) { if (user) - put_fs_byte(*HiSax_status_read++, p); + put_user(*HiSax_status_read++, p); else *p++ = *HiSax_status_read++; if (HiSax_status_read > HiSax_status_end) diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index c7709b74..968a3167 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c @@ -19,6 +19,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.29 1996/08/29 20:34:54 fritz + * Bugfix in send queue management: + * sndcount was not updated correctly. + * Minor Bugfixes. + * * Revision 1.28 1996/06/28 17:02:53 fritz * replaced memcpy_fromfs_toio. * @@ -837,7 +842,7 @@ static int icn_loadboot(u_char * buffer, icn_card * card) icn_lock_channel(card,0); /* Lock Bank 0 */ restore_flags(flags); SLEEP(1); - memcpy_fromfs(codebuf, buffer, ICN_CODE_STAGE1); + copy_from_user(codebuf, buffer, ICN_CODE_STAGE1); memcpy_toio(dev.shmem, codebuf, ICN_CODE_STAGE1); /* Copy code */ #ifdef BOOT_DEBUG printk(KERN_DEBUG "Bootloader transfered\n"); @@ -908,7 +913,7 @@ static int icn_loadproto(u_char * buffer, icn_card * card) while (left) { if (sbfree) { /* If there is a free buffer... */ cnt = MIN(256, left); - memcpy_fromfs(codebuf, p, cnt); + copy_from_user(codebuf, p, cnt); memcpy_toio(&sbuf_l, codebuf, cnt); /* copy data */ sbnext; /* switch to next buffer */ p += cnt; @@ -990,7 +995,7 @@ static int icn_readstatus(u_char * buf, int len, int user, icn_card * card) if (card->msg_buf_read == card->msg_buf_write) return count; if (user) - put_fs_byte(*card->msg_buf_read++, p); + put_user(*card->msg_buf_read++, p); else *p = *card->msg_buf_read++; if (card->msg_buf_read > card->msg_buf_end) @@ -1018,7 +1023,7 @@ static int icn_writecmd(const u_char * buf, int len, int user, icn_card * card, avail = cmd_free; count = MIN(avail, len); if (user) - memcpy_fromfs(msg, buf, count); + copy_from_user(msg, buf, count); else memcpy(msg, buf, count); save_flags(flags); @@ -1170,12 +1175,12 @@ static int icn_command(isdn_ctrl * c, icn_card * card) (void *) a, sizeof(ulong) * 2))) return i; - memcpy_tofs((char *)a, + copy_from_user((char *)a, (char *)&card, sizeof(ulong)); a += sizeof(ulong); { ulong l = (ulong)&dev; - memcpy_tofs((char *)a, + copy_from_user((char *)a, (char *)&l, sizeof(ulong)); } return 0; @@ -1193,7 +1198,7 @@ static int icn_command(isdn_ctrl * c, icn_card * card) case ICN_IOCTL_ADDCARD: if ((i = verify_area(VERIFY_READ, (void *) a, sizeof(icn_cdef)))) return i; - memcpy_fromfs((char *)&cdef, (char *)a, sizeof(cdef)); + copy_from_user((char *)&cdef, (char *)a, sizeof(cdef)); return (icn_addcard(cdef.port, cdef.id1, cdef.id2)); break; case ICN_IOCTL_LEASEDCFG: diff --git a/drivers/isdn/isdn_common.c b/drivers/isdn/isdn_common.c index b5dd3d03..de8f524a 100644 --- a/drivers/isdn/isdn_common.c +++ b/drivers/isdn/isdn_common.c @@ -21,6 +21,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.24 1996/10/11 14:02:03 fritz + * Bugfix: call to isdn_ppp_timer_timeout() never compiled, because of + * typo in #ifdef. + * * Revision 1.23 1996/06/25 18:35:38 fritz * Fixed bogus memory access in isdn_set_allcfg(). * @@ -766,13 +770,13 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int while ((count_pull < skb->len) && (left-- > 0)) { if (dev->drv[di]->DLEflag & DLEmask) { if (user) - put_fs_byte(DLE,cp++); + put_user(DLE,cp++); else *cp++ = DLE; dev->drv[di]->DLEflag &= ~DLEmask; } else { if (user) - put_fs_byte(*p,cp++); + put_user(*p,cp++); else *cp++ = *p; if (*p == DLE) { @@ -795,7 +799,7 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int } count_put = count_pull; if (user) - memcpy_tofs(cp, skb->data, count_put); + copy_to_user(cp, skb->data, count_put); else memcpy(cp, skb->data, count_put); cp += count_put; @@ -905,7 +909,7 @@ void isdn_info_update(void) wake_up_interruptible(&(dev->info_waitq)); } -static int isdn_read(struct inode *inode, struct file *file, char *buf, int count) +static RWTYPE isdn_read(struct inode *inode, struct file *file, char *buf, RWARG count) { uint minor = MINOR(inode->i_rdev); int len = 0; @@ -923,7 +927,7 @@ static int isdn_read(struct inode *inode, struct file *file, char *buf, int coun p = isdn_statstr(); file->private_data = 0; if ((len = strlen(p)) <= count) { - memcpy_tofs(buf, p, len); + copy_to_user(buf, p, len); file->f_pos += len; return len; } @@ -977,12 +981,12 @@ static int isdn_read(struct inode *inode, struct file *file, char *buf, int coun return -ENODEV; } -static int isdn_lseek(struct inode *inode, struct file *file, off_t offset, int orig) +static LSTYPE isdn_lseek(struct inode *inode, struct file *file, LSARG offset, int orig) { return -ESPIPE; } -static int isdn_write(struct inode *inode, struct file *file, const char *buf, int count) +static RWTYPE isdn_write(struct inode *inode, struct file *file, const char *buf, RWARG count) { uint minor = MINOR(inode->i_rdev); int drvidx; @@ -1076,7 +1080,7 @@ static int isdn_set_allcfg(char *src) restore_flags(flags); return ret; } - memcpy_fromfs((char *) &i, src, sizeof(int)); + copy_from_user((char *) &i, src, sizeof(int)); src += sizeof(int); while (i) { char *c; @@ -1086,7 +1090,7 @@ static int isdn_set_allcfg(char *src) restore_flags(flags); return ret; } - memcpy_fromfs((char *) &cfg, src, sizeof(cfg)); + copy_from_user((char *) &cfg, src, sizeof(cfg)); src += sizeof(cfg); if (!isdn_net_new(cfg.name, NULL)) { restore_flags(flags); @@ -1100,7 +1104,7 @@ static int isdn_set_allcfg(char *src) restore_flags(flags); return ret; } - memcpy_fromfs(buf, src, sizeof(buf)); + copy_from_user(buf, src, sizeof(buf)); src += sizeof(buf); c = buf; while (*c) { @@ -1122,7 +1126,7 @@ static int isdn_set_allcfg(char *src) restore_flags(flags); return ret; } - memcpy_fromfs(buf, src, sizeof(buf)); + copy_from_user(buf, src, sizeof(buf)); src += sizeof(buf); c = buf; while (*c) { @@ -1179,9 +1183,9 @@ static int isdn_get_allcfg(char *dest) cfg.callback = (p->local.flags & ISDN_NET_CALLBACK) ? 1 : 0; cfg.chargehup = (p->local.hupflags & 4) ? 1 : 0; cfg.ihup = (p->local.hupflags & 8) ? 1 : 0; - memcpy_tofs(dest, p->local.name, 10); + copy_to_user(dest, p->local.name, 10); dest += 10; - memcpy_tofs(dest, (char *) &cfg, sizeof(cfg)); + copy_to_user(dest, (char *) &cfg, sizeof(cfg)); dest += sizeof(cfg); strcpy(phone.name, p->local.name); phone.outgoing = 0; @@ -1231,8 +1235,8 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar sizeof(ulong)*ISDN_MAX_CHANNELS*2))) return ret; for (i = 0;iibytes[i],p++); - put_fs_long(dev->obytes[i],p++); + put_user(dev->ibytes[i],p++); + put_user(dev->obytes[i],p++); } return 0; } else @@ -1261,14 +1265,14 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) return ret; - memcpy_fromfs(name, (char *) arg, sizeof(name)); + copy_from_user(name, (char *) arg, sizeof(name)); s = name; } else s = NULL; if ((s = isdn_net_new(s, NULL))) { if ((ret = verify_area(VERIFY_WRITE, (void *) arg, strlen(s) + 1))) return ret; - memcpy_tofs((char *) arg, s, strlen(s) + 1); + copy_to_user((char *) arg, s, strlen(s) + 1); return 0; } else return -ENODEV; @@ -1277,13 +1281,13 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(bname)))) return ret; - memcpy_fromfs(bname, (char *) arg, sizeof(bname)); + copy_from_user(bname, (char *) arg, sizeof(bname)); } else return -EINVAL; if ((s = isdn_net_newslave(bname))) { if ((ret = verify_area(VERIFY_WRITE, (void *) arg, strlen(s) + 1))) return ret; - memcpy_tofs((char *) arg, s, strlen(s) + 1); + copy_to_user((char *) arg, s, strlen(s) + 1); return 0; } else return -ENODEV; @@ -1292,7 +1296,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) return ret; - memcpy_fromfs(name, (char *) arg, sizeof(name)); + copy_from_user(name, (char *) arg, sizeof(name)); return isdn_net_rm(name); } else return -EINVAL; @@ -1301,7 +1305,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(cfg)))) return ret; - memcpy_fromfs((char *) &cfg, (char *) arg, sizeof(cfg)); + copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg)); return isdn_net_setcfg(&cfg); } else return -EINVAL; @@ -1310,11 +1314,11 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(cfg)))) return ret; - memcpy_fromfs((char *) &cfg, (char *) arg, sizeof(cfg)); + copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg)); if (!(ret = isdn_net_getcfg(&cfg))) { if ((ret = verify_area(VERIFY_WRITE, (void *) arg, sizeof(cfg)))) return ret; - memcpy_tofs((char *) arg, (char *) &cfg, sizeof(cfg)); + copy_to_user((char *) arg, (char *) &cfg, sizeof(cfg)); } return ret; } else @@ -1324,7 +1328,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(phone)))) return ret; - memcpy_fromfs((char *) &phone, (char *) arg, sizeof(phone)); + copy_from_user((char *) &phone, (char *) arg, sizeof(phone)); return isdn_net_addphone(&phone); } else return -EINVAL; @@ -1333,7 +1337,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(phone)))) return ret; - memcpy_fromfs((char *) &phone, (char *) arg, sizeof(phone)); + copy_from_user((char *) &phone, (char *) arg, sizeof(phone)); return isdn_net_getphones(&phone, (char *) arg); } else return -EINVAL; @@ -1342,7 +1346,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(phone)))) return ret; - memcpy_fromfs((char *) &phone, (char *) arg, sizeof(phone)); + copy_from_user((char *) &phone, (char *) arg, sizeof(phone)); return isdn_net_delphone(&phone); } else return -EINVAL; @@ -1351,7 +1355,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) return ret; - memcpy_fromfs(name, (char *) arg, sizeof(name)); + copy_from_user(name, (char *) arg, sizeof(name)); return isdn_net_force_dial(name); } else return -EINVAL; @@ -1364,7 +1368,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return ret; } else return -EINVAL; - memcpy_fromfs(name,(char*)arg,sizeof(name)); + copy_from_user(name,(char*)arg,sizeof(name)); return isdn_ppp_dial_slave(name); case IIOCNETDLN: if(arg) { @@ -1374,7 +1378,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return ret; } else return -EINVAL; - memcpy_fromfs(name,(char*)arg,sizeof(name)); + copy_from_user(name,(char*)arg,sizeof(name)); return isdn_ppp_hangup_slave(name); #endif case IIOCNETHUP: @@ -1382,7 +1386,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(name)))) return ret; - memcpy_fromfs(name, (char *) arg, sizeof(name)); + copy_from_user(name, (char *) arg, sizeof(name)); return isdn_net_force_hangup(name); } else return -EINVAL; @@ -1408,7 +1412,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(isdn_ioctl_struct)))) return ret; - memcpy_fromfs((char *) &iocts, (char *) arg, + copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); if (strlen(iocts.drvid)) { if ((p = strchr(iocts.drvid, ','))) @@ -1457,10 +1461,10 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return ret; for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - memcpy_tofs(p, dev->mdm.info[i].emu.profile, + copy_to_user(p, dev->mdm.info[i].emu.profile, ISDN_MODEM_ANZREG); p += ISDN_MODEM_ANZREG; - memcpy_tofs(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN); + copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN); p += ISDN_MSNLEN; } return (ISDN_MODEM_ANZREG + ISDN_MSNLEN) * ISDN_MAX_CHANNELS; @@ -1479,10 +1483,10 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return ret; for (i = 0; i < ISDN_MAX_CHANNELS; i++) { - memcpy_fromfs(dev->mdm.info[i].emu.profile, p, + copy_from_user(dev->mdm.info[i].emu.profile, p, ISDN_MODEM_ANZREG); p += ISDN_MODEM_ANZREG; - memcpy_fromfs(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN); + copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN); p += ISDN_MSNLEN; } return 0; @@ -1500,7 +1504,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(isdn_ioctl_struct)))) return ret; - memcpy_fromfs((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); + copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); if (strlen(iocts.drvid)) { drvidx = -1; for (i = 0; i < ISDN_MAX_DRIVERS; i++) @@ -1515,7 +1519,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (cmd == IIOCSETMAP) { if ((ret = verify_area(VERIFY_READ, (void *) iocts.arg, 255))) return ret; - memcpy_fromfs(nstring, (char *) iocts.arg, 255); + copy_from_user(nstring, (char *) iocts.arg, 255); memset(dev->drv[drvidx]->msn2eaz, 0, sizeof(dev->drv[drvidx]->msn2eaz)); p = strtok(nstring, ","); @@ -1534,7 +1538,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if ((ret = verify_area(VERIFY_WRITE, (void *) iocts.arg, strlen(nstring) + 1))) return ret; - memcpy_tofs((char *) iocts.arg, nstring, strlen(nstring) + 1); + copy_to_user((char *) iocts.arg, nstring, strlen(nstring) + 1); } return 0; } else @@ -1543,7 +1547,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { if ((ret = verify_area(VERIFY_WRITE, (void *) arg, sizeof(ulong)))) return ret; - memcpy_tofs((char *) arg, (char *) &dev, sizeof(ulong)); + copy_to_user((char *) arg, (char *) &dev, sizeof(ulong)); return 0; } else return -EINVAL; @@ -1559,7 +1563,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if ((ret = verify_area(VERIFY_READ, (void *) arg, sizeof(isdn_ioctl_struct)))) return ret; - memcpy_fromfs((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); + copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); if (strlen(iocts.drvid)) { if ((p = strchr(iocts.drvid, ','))) *p = 0; @@ -1582,7 +1586,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar memcpy(c.num, (char *) &iocts.arg, sizeof(ulong)); ret = dev->drv[drvidx]->interface->command(&c); memcpy((char *) &iocts.arg, c.num, sizeof(ulong)); - memcpy_tofs((char *) arg, &iocts, sizeof(isdn_ioctl_struct)); + copy_to_user((char *) arg, &iocts, sizeof(isdn_ioctl_struct)); return ret; } else return -EINVAL; @@ -1891,7 +1895,7 @@ int isdn_writebuf_stub(int drvidx, int chan, const u_char *buf, int len, skb->free = 1; if (user) - memcpy_fromfs(skb_put(skb, len), buf, len); + copy_from_user(skb_put(skb, len), buf, len); else memcpy(skb_put(skb, len), buf, len); diff --git a/drivers/isdn/isdn_net.c b/drivers/isdn/isdn_net.c index 282ce192..5f84fa9f 100644 --- a/drivers/isdn/isdn_net.c +++ b/drivers/isdn/isdn_net.c @@ -21,6 +21,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.24 1996/10/11 13:57:40 fritz + * Bugfix: Error in BogoCPS calculation. + * * Revision 1.23 1996/09/23 01:58:08 fritz * Fix: With syncPPP encapsulation, discard LCP packets * when calculating hangup timeout. @@ -2229,19 +2232,19 @@ int isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones) inout &= 1; for (n = p->local.phone[inout]; n; n = n->next) { if (more) { - put_fs_byte(' ', phones++); + put_user(' ', phones++); count++; } if ((ret = verify_area(VERIFY_WRITE, (void *) phones, strlen(n->num) + 1))) { restore_flags(flags); return ret; } - memcpy_tofs(phones, n->num, strlen(n->num) + 1); + copy_to_user(phones, n->num, strlen(n->num) + 1); phones += strlen(n->num); count += strlen(n->num); more = 1; } - put_fs_byte(0,phones); + put_user(0,phones); count++; restore_flags(flags); return count; diff --git a/drivers/isdn/isdn_ppp.c b/drivers/isdn/isdn_ppp.c index f7dc3966..71ed6c5e 100644 --- a/drivers/isdn/isdn_ppp.c +++ b/drivers/isdn/isdn_ppp.c @@ -19,6 +19,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.17 1996/10/22 09:39:49 hipp + * a few MP changes and bugfixes + * + * Revision 1.16 1996/09/23 01:58:10 fritz + * Fix: With syncPPP encapsulation, discard LCP packets + * when calculating hangup timeout. + * + * Revision 1.15 1996/09/07 12:50:12 hipp + * bugfixes (unknown device after failed dial attempt, minor bugs) + * * Revision 1.14 1996/08/12 16:26:47 hipp * code cleanup * changed connection management from minors to slots @@ -166,7 +176,7 @@ int isdn_ppp_free(isdn_net_local *lp) if( (is->state & IPPP_CONNECT) ) isdn_ppp_closewait(lp->ppp_slot); /* force wakeup on ippp device */ else if(is->state & IPPP_ASSIGNED) - is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGEND" staet */ + is->state = IPPP_OPEN; /* fallback to 'OPEN but not ASSIGEND' staet */ if(is->debug & 0x1) @@ -399,7 +409,7 @@ static int get_arg(void *b,void *val,int len) len = sizeof(unsigned long); if ((r = verify_area(VERIFY_READ, (void *) b, len ))) return r; - memcpy_fromfs((void *) val, b, len ); + copy_from_user((void *) val, b, len ); return 0; } @@ -412,12 +422,12 @@ static int set_arg(void *b, unsigned long val,void *str) if(!str) { if ((r = verify_area(VERIFY_WRITE, b, 4 ))) return r; - memcpy_tofs(b, (void *) &val, 4 ); + copy_to_user(b, (void *) &val, 4 ); } else { if ((r = verify_area(VERIFY_WRITE, b,val))) return r; - memcpy_tofs(b,str,val); + copy_to_user(b,str,val); } return 0; } @@ -671,7 +681,7 @@ int isdn_ppp_read(int min, struct file *file, char *buf, int count) } if (b->len < count) count = b->len; - memcpy_tofs(buf, b->buf, count); + copy_to_user(buf, b->buf, count); kfree(b->buf); b->buf = NULL; is->first = b; @@ -688,6 +698,8 @@ int isdn_ppp_write(int min, struct file *file, const char *buf, int count) { isdn_net_local *lp; struct ippp_struct *is; + int proto; + unsigned char protobuf[4]; is = file->private_data; @@ -701,7 +713,15 @@ int isdn_ppp_write(int min, struct file *file, const char *buf, int count) if (!lp) printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n"); else { - lp->huptimer = 0; + /* + * Don't reset huptimer for + * LCP packets. (Echo requests). + */ + copy_from_user(protobuf, buf, 4); + proto = PPP_PROTOCOL(protobuf); + if (proto != PPP_LCP) + lp->huptimer = 0; + if (lp->isdn_device < 0 || lp->isdn_channel < 0) return 0; @@ -715,7 +735,7 @@ int isdn_ppp_write(int min, struct file *file, const char *buf, int count) return count; } skb->free = 1; - memcpy_fromfs(skb_put(skb, count), buf, count); + copy_from_user(skb_put(skb, count), buf, count); if(is->debug & 0x40) { printk(KERN_DEBUG "ppp xmit: len %ld\n",skb->len); isdn_ppp_frame_log("xmit",skb->data,skb->len,32); @@ -879,7 +899,7 @@ void isdn_ppp_receive(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buf sqno_end = sqno; if(is->debug & 0x40) - printk(KERN_DEBUG "min_sqno: %ld sqno_end %ld next: %ld\n",min_sqno,sqno_end,net_dev->ib.next_num ); + printk(KERN_DEBUG "min_sqno: %ld sqno_end %d next: %ld\n",min_sqno,sqno_end,net_dev->ib.next_num ); /* * MP buffer management .. reorders incoming packets .. @@ -1605,7 +1625,7 @@ static int isdn_ppp_dev_ioctl_stats(int slot,struct ifreq *ifr,struct device *de } #endif } - memcpy_tofs (res, &t, sizeof (struct ppp_stats)); + copy_to_user (res, &t, sizeof (struct ppp_stats)); return 0; } @@ -1630,7 +1650,7 @@ int isdn_ppp_dev_ioctl(struct device *dev, struct ifreq *ifr, int cmd) len = strlen(PPP_VERSION) + 1; error = verify_area(VERIFY_WRITE, r, len); if (!error) - memcpy_tofs(r, PPP_VERSION, len); + copy_to_user(r, PPP_VERSION, len); break; case SIOCGPPPSTATS: error = isdn_ppp_dev_ioctl_stats (lp->ppp_slot, ifr, dev); diff --git a/drivers/isdn/isdn_tty.c b/drivers/isdn/isdn_tty.c index d7d62a5f..c18bbc09 100644 --- a/drivers/isdn/isdn_tty.c +++ b/drivers/isdn/isdn_tty.c @@ -20,6 +20,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.22 1996/10/19 18:56:43 fritz + * ATZ did not change the xmitbuf size. + * * Revision 1.21 1996/06/24 17:40:28 fritz * Bugfix: Did not compile without CONFIG_ISDN_AUDIO * @@ -375,7 +378,7 @@ static int isdn_tty_end_vrx(const char *buf, int c, int from_user) return 1; } if (from_user) { - memcpy_fromfs(tmpbuf, buf, c); + copy_from_user(tmpbuf, buf, c); p = tmpbuf; } else p = (char *)buf; @@ -836,7 +839,7 @@ static int isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * &(m->lastplus), from_user); if (from_user) - memcpy_fromfs(&(info->xmit_buf[info->xmit_count]), buf, c); + copy_from_user(&(info->xmit_buf[info->xmit_count]), buf, c); else memcpy(&(info->xmit_buf[info->xmit_count]), buf, c); #ifdef CONFIG_ISDN_AUDIO @@ -1041,9 +1044,10 @@ static int isdn_tty_get_modem_info(modem_info * info, uint * value) static int isdn_tty_set_modem_info(modem_info * info, uint cmd, uint * value) { - uint arg = get_user((uint *) value); + uint arg; int pre_dtr; + GET_USER(arg, (uint *)value); switch (cmd) { case TIOCMBIS: #ifdef ISDN_DEBUG_MODEM_IOCTL @@ -1152,7 +1156,7 @@ static int isdn_tty_ioctl(struct tty_struct *tty, struct file *file, error = verify_area(VERIFY_READ, (void *) arg, sizeof(long)); if (error) return error; - arg = get_user((ulong *) arg); + GET_USER(arg, (ulong *) arg); tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); @@ -1842,7 +1846,7 @@ static void isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pl *pluscount = 0; } if (from_user) { - memcpy_fromfs(cbuf, p, count); + copy_from_user(cbuf, p, count); p = cbuf; } while (count > 0) { @@ -2672,7 +2676,7 @@ static int isdn_tty_edit_at(const char *p, int count, modem_info * info, int use for (cnt = count; cnt > 0; p++, cnt--) { if (user) - c = get_user(p); + GET_USER(c, p); else c = *p; total++; diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c index 806a27a2..dc386a13 100644 --- a/drivers/isdn/pcbit/drv.c +++ b/drivers/isdn/pcbit/drv.c @@ -428,7 +428,7 @@ int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel { u_char cbuf[1024]; - memcpy_fromfs(cbuf, buf, len); + copy_from_user(cbuf, buf, len); for (i=0; ish_mem + i); } @@ -446,7 +446,7 @@ int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel /* get it into kernel space */ if ((ptr = kmalloc(len, GFP_KERNEL))==NULL) return -ENOMEM; - memcpy_fromfs(ptr, buf, len); + copy_from_user(ptr, buf, len); loadbuf = ptr; } else @@ -761,8 +761,13 @@ static int stat_st = 0; static int stat_end = 0; -#define memcpy_to_COND(flag, d, s, len) \ -(flag ? memcpy_tofs(d, s, len) : memcpy(d, s, len)) +static __inline void +memcpy_to_COND(int flag, char *d, const char *s, int len) { + if (flag) + copy_to_user(d, s, len); + else + memcpy(d, s, len); +} int pcbit_stat(u_char* buf, int len, int user, int driver, int channel) diff --git a/drivers/isdn/teles/callc.c b/drivers/isdn/teles/callc.c index 4f96325c..b337d5d3 100644 --- a/drivers/isdn/teles/callc.c +++ b/drivers/isdn/teles/callc.c @@ -1,6 +1,9 @@ /* $Id$ * * $Log$ + * Revision 1.13 1996/06/24 17:15:55 fritz + * corrected return code of teles_writebuf() + * * Revision 1.12 1996/06/12 16:15:33 fritz * Extended user-configurable debugging flags. * @@ -1448,7 +1451,7 @@ teles_writebuf(int id, int chan, const u_char * buf, int count, int user) ptr += i; if (user) - memcpy_fromfs(ptr, buf, count); + copy_from_user(ptr, buf, count); else memcpy(ptr, buf, count); ibh->datasize = count + i; diff --git a/drivers/isdn/teles/card.c b/drivers/isdn/teles/card.c index b1475c03..5e2c5e46 100644 --- a/drivers/isdn/teles/card.c +++ b/drivers/isdn/teles/card.c @@ -7,6 +7,9 @@ * Beat Doebeli log all D channel traffic * * $Log$ + * Revision 1.15 1996/09/29 19:41:56 fritz + * Bugfix: ignore unknown frames. + * * Revision 1.14 1996/09/23 01:53:49 fritz * Bugfix: discard unknown frames (non-EDSS1 and non-1TR6). * @@ -81,7 +84,7 @@ extern int nrcards; static inline byte readisac_0(byte * cardm, byte offset) { - return *(byte *) (cardm + 0x100 + ((offset & 1) ? 0x1ff : 0) + offset); + return readb(cardm + 0x100 + ((offset & 1) ? 0x1ff : 0) + offset); } static inline byte @@ -96,7 +99,7 @@ readisac_3(int iobase, byte offset) static inline void writeisac_0(byte * cardm, byte offset, byte value) { - *(byte *) (cardm + 0x100 + ((offset & 1) ? 0x1ff : 0) + offset) = value; + writeb(value, cardm + 0x100 + ((offset & 1) ? 0x1ff : 0) + offset); } static inline void @@ -123,7 +126,7 @@ writeisac_s(int iobase, byte offset, byte * src, int count) static inline byte readhscx_0(byte * base, byte hscx, byte offset) { - return *(byte *) (base + 0x180 + ((offset & 1) ? 0x1FF : 0) + + return readb(base + 0x180 + ((offset & 1) ? 0x1FF : 0) + ((hscx & 1) ? 0x40 : 0) + offset); } @@ -139,8 +142,8 @@ readhscx_3(int iobase, byte hscx, byte offset) static inline void writehscx_0(byte * base, byte hscx, byte offset, byte data) { - *(byte *) (base + 0x180 + ((offset & 1) ? 0x1FF : 0) + - ((hscx & 1) ? 0x40 : 0) + offset) = data; + writeb(data, base + 0x180 + ((offset & 1) ? 0x1FF : 0) + + ((hscx & 1) ? 0x40 : 0) + offset); } static inline void @@ -1257,12 +1260,12 @@ checkcard(int cardnr) if (card->membase) { cli(); timout = jiffies + (HZ / 5) + 1; - *(byte *) (card->membase + 0x80) = 0; + writeb(0, card->membase + 0x80); sti(); while (jiffies <= timout); cli(); - *(byte *) (card->membase + 0x80) = 1; + writeb(1, card->membase + 0x80); timout = jiffies + (HZ / 5) + 1; sti(); while (jiffies <= timout); diff --git a/drivers/isdn/teles/llglue.c b/drivers/isdn/teles/llglue.c index c5da9954..ffbae38e 100644 --- a/drivers/isdn/teles/llglue.c +++ b/drivers/isdn/teles/llglue.c @@ -1,6 +1,9 @@ /* $Id$ * * $Log$ + * Revision 1.6 1996/06/03 20:03:39 fritz + * Fixed typos. + * * Revision 1.5 1996/05/31 00:58:47 fritz * Errata: Reverted change from rev 1.4. * @@ -44,7 +47,7 @@ teles_readstatus(byte * buf, int len, int user, int id, int channel) for (p = buf, count = 0; count < len; p++, count++) { if (user) - put_fs_byte(*teles_status_read++, p); + put_user(*teles_status_read++, p); else *p++ = *teles_status_read++; if (teles_status_read > teles_status_end) diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h index 1cbcb4b0..8b7be328 100644 --- a/include/linux/isdnif.h +++ b/include/linux/isdnif.h @@ -22,6 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log$ + * Revision 1.9 1996/06/06 21:24:24 fritz + * Started adding support for suspend/resume. + * * Revision 1.8 1996/05/18 01:45:37 fritz * More spelling corrections. * @@ -299,6 +302,27 @@ typedef struct { */ extern int register_isdn(isdn_if*); +/* Compatibility Linux-2.0.X <-> Linux-2.1.X */ + +#ifndef LINUX_VERSION_CODE +#include +#endif +#if (LINUX_VERSION_CODE < 0x020100) +#define copy_from_user memcpy_fromfs +#define copy_to_user memcpy_tofs +#define GET_USER(x, addr) ( x = get_user(addr) ) +typedef int RWTYPE; +typedef int LSTYPE; +typedef int RWARG; +typedef int LSARG; +#else +#define GET_USER get_user +typedef long RWTYPE; +typedef long long LSTYPE; +typedef unsigned long RWARG; +typedef long long LSARG; +#endif + #endif /* __KERNEL__ */ #endif /* isdnif_h */