- put_fs_long ((long) temp_i, param3);
- PRINTKN (3, (KERN_DEBUG
- "ppp_tty_ioctl: get flags: addr %lx flags %x\n",
- param3, temp_i));
- }
- break;
-/*
- * Set the flags for the various options
- */
- case PPPIOCSFLAGS:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- temp_i = (int) get_fs_long (param3);
- ppp->flags ^= ((ppp->flags ^ temp_i) & SC_MASK);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set flags to %x\n", temp_i));
- }
- break;
-/*
- * Retrieve the transmit async map
- */
- case PPPIOCGASYNCMAP:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- put_fs_long (ppp->xmit_async_map[0], param3);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: get asyncmap: addr %lx asyncmap %lx\n",
- param3, ppp->xmit_async_map[0]));
- }
- break;
-/*
- * Set the transmit async map
- */
- case PPPIOCSASYNCMAP:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- ppp->xmit_async_map[0] = get_fs_long (param3);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set xmit asyncmap %lx\n",
- ppp->xmit_async_map[0]));
- }
- break;
-/*
- * Set the receive async map
- */
- case PPPIOCSRASYNCMAP:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- ppp->recv_async_map = get_fs_long (param3);
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set rcv asyncmap %lx\n",
- ppp->recv_async_map));
- }
- break;
-/*
- * Obtain the unit number for this device.
- */
- case PPPIOCGUNIT:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- put_fs_long (ppp->dev->base_addr, param3);
- PRINTKN (3,
- (KERN_INFO "ppp_tty_ioctl: get unit: %d",
- ppp->dev->base_addr));
- }
- break;
-/*
- * Set the debug level
- */
- case PPPIOCSDEBUG:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- ppp_debug = (int) get_fs_long (param3);
- ppp_debug_netpackets = (ppp_debug & 0xff00) >> 8;
- ppp_debug &= 0xff;
- PRINTKN (1, (KERN_INFO
- "ppp_tty_ioctl: set debug level %d, netpacket %d\n",
- ppp_debug, ppp_debug_netpackets));
- }
- break;
-/*
- * Get the debug level
- */
- case PPPIOCGDEBUG:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- put_fs_long ((long) (ppp_debug |
- (ppp_debug_netpackets << 8)),
- param3);
-
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: get debug level %d\n",
- ppp_debug | (ppp_debug_netpackets << 8)));
- }
- break;
-/*
- * Get the times since the last send/receive frame operation
- */
- case PPPIOCGTIME:
- error = verify_area (VERIFY_WRITE, (void *) param3,
- sizeof (struct ppp_ddinfo));
- if (error == 0) {
- struct ppp_ddinfo cur_ddinfo;
- unsigned long cur_jiffies = jiffies;
-
- /* change absolute times to relative times. */
- cur_ddinfo.ip_sjiffies = cur_jiffies - ppp->ddinfo.ip_sjiffies;
- cur_ddinfo.ip_rjiffies = cur_jiffies - ppp->ddinfo.ip_rjiffies;
- cur_ddinfo.nip_sjiffies = cur_jiffies - ppp->ddinfo.nip_sjiffies;
- cur_ddinfo.nip_rjiffies = cur_jiffies - ppp->ddinfo.nip_rjiffies;
-
- memcpy_tofs ((void *) param3, &cur_ddinfo,
- sizeof (struct ppp_ddinfo));
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: read demand dial info\n"));
- }
- break;
-/*
- * Retrieve the extended async map
- */
- case PPPIOCGXASYNCMAP:
- error = verify_area (VERIFY_WRITE,
- (void *) param3,
- sizeof (ppp->xmit_async_map));
- if (error == 0) {
- memcpy_tofs ((void *) param3,
- ppp->xmit_async_map,
- sizeof (ppp->xmit_async_map));
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: get xasyncmap: addr %lx\n",
- param3));
- }
- break;
-/*
- * Set the async extended map
- */
- case PPPIOCSXASYNCMAP:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (ppp->xmit_async_map));
- if (error == 0) {
- unsigned long temp_tbl[8];
-
- memcpy_fromfs (temp_tbl, (void *) param3,
- sizeof (ppp->xmit_async_map));
- temp_tbl[1] = 0x00000000;
- temp_tbl[2] &= ~0x40000000;
- temp_tbl[3] |= 0x60000000;
-
- if ((temp_tbl[2] & temp_tbl[3]) != 0 ||
- (temp_tbl[4] & temp_tbl[5]) != 0 ||
- (temp_tbl[6] & temp_tbl[7]) != 0) {
- error = -EINVAL;
- } else {
- memcpy (ppp->xmit_async_map, temp_tbl,
- sizeof (ppp->xmit_async_map));
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set xasyncmap\n"));
- }
- }
- break;
-/*
- * Set the maximum VJ header compression slot number.
- */
- case PPPIOCSMAXCID:
- error = verify_area (VERIFY_READ, (void *) param3,
- sizeof (temp_i));
- if (error == 0) {
- temp_i = (int) get_fs_long (param3) + 1;
- PRINTKN (3, (KERN_INFO
- "ppp_tty_ioctl: set maxcid to %d\n",
- temp_i));
- if (ppp->slcomp != NULL) {
- slhc_free (ppp->slcomp);
- }
- ppp->slcomp = slhc_init (temp_i, temp_i);
-
- if (ppp->slcomp == NULL) {
- PRINTKN (1, (KERN_ERR
- "ppp: no space for compression buffers!\n"));
- ppp_release (ppp);
- error = -ENOMEM;
- }
- }
- break;
-/*
- * Allow users to read, but not set, the serial port parameters
- */
- case TCGETS:
- case TCGETA:
- error = n_tty_ioctl (tty, file, param2, param3);
- break;
-/*
- * All other ioctl() events will come here.
- */
- default:
- PRINTKN (1, (KERN_ERR
- "ppp_tty_ioctl: invalid ioctl: %x, addr %lx\n",
- param2,
- param3));
-
- error = -ENOIOCTLCMD;
- break;
- }
- return error;
-}
-
-/*
- * TTY callback.
- *
- * Process the select() statement for the PPP device.
- */