diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-07-24 16:03:27 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-07-24 16:03:27 +0000 |
commit | 491081bb9fd20fe122636025a3f51376fbe0080d (patch) | |
tree | 613b4a09b9c48d222429dde05aa071beecb2468d | |
parent | 179bdea436913895e66c9ee860ecfa7fcf5cd061 (diff) |
Heavily reduce stack usage, remove ancient and useless tor.h
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@440 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-x | Makefile | 2 | ||||
-rwxr-xr-x | tor.h | 578 | ||||
-rwxr-xr-x | zaptel.c | 326 |
3 files changed, 169 insertions, 737 deletions
@@ -84,7 +84,7 @@ devel: tor2ee tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest -tor2.o: tor2.c tor2-hw.h tor.h tor2fw.h zaptel.h +tor2.o: tor2.c tor2-hw.h tor2fw.h zaptel.h $(HOSTCC) $(KFLAGS) -c tor2.c zaptel.o: zaptel.c zaptel.h digits.h arith.h sec.h mec.h sec-2.h mec2.h mec3.h zconfig.h @@ -1,578 +0,0 @@ -/* - * Tormenta 2 Quad-T1 PCI Driver - * - * Written by Mark Spencer <markster@linux-suppot.net> - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - */ - -/* - * Header file for: - * BSD Telephony Of Mexico "Tormenta" card LINUX driver, version 1.8X1 3/14/01 - * - * Part of the "Zapata" Computer Telephony Technology. - * - * See http://www.bsdtelephony.com.mx - * - * - * The technologies, software, hardware, designs, drawings, scheumatics, board - * layouts and/or artwork, concepts, methodologies (including the use of all - * of these, and that which is derived from the use of all of these), all other - * intellectual properties contained herein, and all intellectual property - * rights have been and shall continue to be expressly for the benefit of all - * mankind, and are perpetually placed in the public domain, and may be used, - * copied, and/or modified by anyone, in any manner, for any legal purpose, - * without restriction. - * - */ - - -#define NTOR 80 /* max number of Tormenta channels (physical + virtual) */ - -#ifndef _MACHINE_TOR_H_ -#define _MACHINE_TOR_H_ - -#include <linux/ioctl.h> - -typedef struct tor_params -{ -int sigtype; /* read-only */ -int rxisoffhook; /* read-only */ -int prewinktime; -int preflashtime; -int winktime; -int flashtime; -int starttime; -int rxwinktime; -int rxflashtime; -int debouncetime; -} TOR_PARAMS; - -typedef struct tor_spaninfo -{ -int spanno; /* span number */ -int alarms; /* alarms status */ -int txlevel; /* what TX level is set to */ -int rxlevel; /* current RX level */ -int bpvcount; /* current BPV count */ -int crc4count; /* current CRC4 error count */ -int ebitcount; /* current E-bit error count */ -int fascount; /* current FAS error count */ -int syncsrc; /* span # of current sync source, or 0 for free run */ -int numchans; /* number of configured channels on this span */ -} TOR_SPANINFO; - -typedef struct tor_maintinfo -{ -int spanno; /* span number 1-2 */ -int command; /* command */ -} TOR_MAINTINFO; - -typedef struct tor_confinfo -{ -int chan; /* channel number, 0 for current */ -int confno; /* conference number */ -int confmode; /* conferencing mode */ -} TOR_CONFINFO; - -typedef struct tor_gains -{ -int chan; /* channel number, 0 for current */ -unsigned char rxgain[256]; /* Receive gain table */ -unsigned char txgain[256]; /* Transmit gain table */ -} TOR_GAINS; - -struct tor_lineconfig -{ -int lbo[2]; /* line build-outs */ -int lineconfig[2]; /* line config parameters (framing, coding) */ -int psync; /* primary sync source */ -int ssync; /* secondary sync source */ -} ; - -struct tor_chanconfig -{ -int chan; /* Channel we're applying this to */ -int sigtype; /* Signal type */ -int master; /* Master channel if sigtype is TOR_SLAVE */ -} ; - -/* We use two buffers for output */ -#define DEFAULT_NUM_BUFS 2 -#define MAX_NUM_BUFS 8 - -#define POLICY_IMMEDIATE 0 /* Start playing/recording immediate */ -#define POLICY_WHEN_FULL 1 /* Play/record when buffers are full */ - -typedef struct tor_bufferinfo -{ -int txbufpolicy; /* Policy for handling receive buffers */ -int rxbufpolicy; /* Policy for handling receive buffers */ -int numbufs; /* How many buffers to use */ -int bufsize; /* How big each buffer is */ -int readbufs; /* How many read buffers are full (read-only) */ -int writebufs; /* How many write buffers are full (read-only) */ -} BUFFER_INFO; - -typedef struct tor_dialparams -{ -int mfv1_tonelen; /* MF tone length (KP = this * 5/3) */ -int dtmf_tonelen; /* DTMF tone length */ -int reserved[4]; /* Reserved for future expansion -- always set to 0 */ -} DIAL_PARAMS; - -/* Define the max # of outgoing DTMF or MFv1 digits to queue in-kernel */ -#define TOR_MAX_DTMF_BUF 256 - -#define TOR_DIAL_OP_APPEND 1 -#define TOR_DIAL_OP_REPLACE 2 -#define TOR_DIAL_OP_CANCEL 3 - -typedef struct tor_dialoperation -{ -int op; -char dialstr[TOR_MAX_DTMF_BUF]; -} DIAL_OPERATION; - -#ifdef TOR_DEVEL -#define TOR_MAJOR 250 -#else -#define TOR_MAJOR 196 -#endif - -#ifndef ELAST -#define ELAST 500 -#endif - -#define TORMAX 48 /* max physical (real) TOR ports */ -#define NCONF (TORMAX/2) /* number of conferences */ - -#define TOR_CODE 'J' - -/* - * Get Transfer Block Size. - */ -#define TOR_GET_BLOCKSIZE _IOR (TOR_CODE, 1, int) - -/* - * Set Transfer Block Size. - */ -#define TOR_SET_BLOCKSIZE _IOW (TOR_CODE, 2, int) - -/* - * Flush Buffer(s) and stop I/O - */ -#define TOR_FLUSH _IOW (TOR_CODE, 3, int) - -/* - * Wait for Write to Finish - */ -#define TOR_SYNC _IOW (TOR_CODE, 4, int) - -/* - * Get channel parameters - */ -#define TOR_GET_PARAMS _IOR (TOR_CODE, 5, struct tor_params) - -/* - * Get channel parameters - */ -#define TOR_SET_PARAMS _IOW (TOR_CODE, 6, struct tor_params) - -/* - * Set Hookswitch Status - */ -#define TOR_HOOK _IOW (TOR_CODE, 7, int) - -/* - * Get Signalling Event - */ -#define TOR_GETEVENT _IOR (TOR_CODE, 8, int) - -/* - * Wait for something to happen (IO Mux) - */ -#define TOR_IOMUX _IOWR (TOR_CODE, 9, int) - -/* - * Get Span Status - */ -#define TOR_SPANSTAT _IOWR (TOR_CODE, 10, struct tor_spaninfo) - -/* - * Set Maintenance Mode - */ -#define TOR_MAINT _IOW (TOR_CODE, 11, struct tor_maintinfo) - -/* - * Get Conference Mode - */ -#define TOR_GETCONF _IOWR (TOR_CODE, 12, struct tor_confinfo) - -/* - * Set Conference Mode - */ -#define TOR_SETCONF _IOWR (TOR_CODE, 13, struct tor_confinfo) - -/* - * Setup or Remove Conference Link - */ -#define TOR_CONFLINK _IOW (TOR_CODE, 14, struct tor_confinfo) - -/* - * Display Conference Diagnostic Information on Console - */ -#define TOR_CONFDIAG _IOR (TOR_CODE, 15, int) - -/* - * Get Channel audio gains - */ -#define TOR_GETGAINS _IOWR (TOR_CODE, 16, struct tor_gains) - -/* - * Set Channel audio gains - */ -#define TOR_SETGAINS _IOWR (TOR_CODE, 17, struct tor_gains) - -/* - * Set Line (T1) Configurations and start system - */ -#define TOR_STARTUP _IOW (TOR_CODE, 18, struct tor_lineconfig) - -/* - * Set Channel Configuration - */ -#define TOR_CHANCONFIG _IOW (TOR_CODE, 19, struct tor_chanconfig) - -/* - * Set Conference to mute mode - */ -#define TOR_CONFMUTE _IOW (TOR_CODE, 20, int) - -/* - * Send a particular tone (see TOR_TONE_*) - */ -#define TOR_SENDTONE _IOW (TOR_CODE, 21, int) - -/* - * Set your region for tones (see TOR_TONE_ZONE_*) - */ -#define TOR_SETTONEZONE _IOW (TOR_CODE, 22, int) - -/* - * Retrieve current region for tones (see TOR_TONE_ZONE_*) - */ -#define TOR_GETTONEZONE _IOR (TOR_CODE, 23, int) - -/* - * Master unit only -- set default zone (see TOR_TONE_ZONE_*) - */ -#define TOR_DEFAULTZONE _IOW (TOR_CODE, 24, int) - -/* - * Load a tone zone from a tor_tone_def_header, see - * below... - */ -#define TOR_LOADZONE _IOW (TOR_CODE, 25, struct tor_tone_def_header) - -/* - * Free a tone zone - */ -#define TOR_FREEZONE _IOW (TOR_CODE, 26, int) - -/* - * Set buffer policy - */ -#define TOR_SET_BUFINFO _IOW (TOR_CODE, 27, struct tor_bufferinfo) - -/* - * Get current buffer info - */ -#define TOR_GET_BUFINFO _IOR (TOR_CODE, 28, struct tor_bufferinfo) - -/* - * Get dialing parameters - */ -#define TOR_GET_DIALPARAMS _IOR (TOR_CODE, 29, struct tor_dialparams) - -/* - * Set dialing parameters - */ -#define TOR_SET_DIALPARAMS _IOW (TOR_CODE, 30, struct tor_dialparams) - -/* - * Append, replace, or cancel a dial string - */ -#define TOR_DIAL _IOW (TOR_CODE, 31, struct tor_dialoperation) - -/* - * Set a clear channel into audio mode - */ -#define TOR_AUDIOMODE _IOW (TOR_CODE, 32, int) - -/* - * Enable or disable echo cancellation on a tormenta channel - */ -#define TOR_ECHOCANCEL _IOW (TOR_CODE, 33, int) - -/* - * Shutdown the card - */ -#define TOR_SHUTDOWN _IO (TOR_CODE, 100) - -#define TOR_TONE_ZONE_MAX 128 - -#define TOR_TONE_ZONE_DEFAULT -1 /* To restore default */ - -#define TOR_TONE_STOP -1 -#define TOR_TONE_DIALTONE 0 -#define TOR_TONE_BUSY 1 -#define TOR_TONE_RINGTONE 2 -#define TOR_TONE_CONGESTION 3 -#define TOR_TONE_CALLWAIT 4 -#define TOR_TONE_DIALRECALL 5 -#define TOR_TONE_RECORDTONE 6 -#define TOR_TONE_INFO 7 -#define TOR_TONE_CUST1 8 -#define TOR_TONE_CUST2 9 -#define TOR_TONE_MAX 16 - -#define TOR_MAX_CADENCE 16 - -struct tor_tone_def_header { - int count; /* How many samples follow */ - int size; /* Total size of the *data* of our samples (data only!) */ - int zone; /* Which zone we are loading */ - int ringcadence[TOR_MAX_CADENCE]; /* Ring cadence in ms (0=on, 1=off, ends with 0 value) */ - char name[40]; /* Informational name of zone */ - /* Immediately follow the tor_tone_def_header by tor_tone_def's */ -}; - -struct tor_tone_def { /* Structure for zone programming */ - int size; /* The size of the data we have */ - int tone; /* See TOR_TONE_* */ - int next; /* What the next position in the cadence is - (They're numbered by the order the appear here) */ - int samples; /* How many samples to play for this cadence */ - unsigned char data[0]; /* The actual samples */ -}; - -#ifdef __KERNEL__ -#endif /* KERNEL */ - -/* Define the maximum block size */ -#define TOR_MAX_BLOCKSIZE 8192 - -/* Define the default block size */ -#define TOR_DEFAULT_BLOCKSIZE 1024 - -/* Define the default network block size */ -#define TOR_DEFAULT_MTU_MRU 2048 - -/* Flush and stop the read (input) process */ -#define TOR_FLUSH_READ 1 - -/* Flush and stop the write (output) process */ -#define TOR_FLUSH_WRITE 2 - -/* Flush and stop both (input and output) processes */ -#define TOR_FLUSH_BOTH (TOR_FLUSH_READ | TOR_FLUSH_WRITE) - -/* Flush the event queue */ -#define TOR_FLUSH_EVENT 4 - -/* Flush everything */ -#define TOR_FLUSH_ALL (TOR_FLUSH_READ | TOR_FLUSH_WRITE | TOR_FLUSH_EVENT) - - -/* Value for TOR_HOOK, set to ON hook */ -#define TOR_ONHOOK 0 - -/* Value for TOR_HOOK, set to OFF hook */ -#define TOR_OFFHOOK 1 - -/* Value for TOR_HOOK, wink (off hook momentarily) */ -#define TOR_WINK 2 - -/* Value for TOR_HOOK, flash (on hook momentarily) */ -#define TOR_FLASH 3 - -/* Value for TOR_HOOK, start line */ -#define TOR_START 4 - -/* Value for TOR_HOOK, ring line (same as start line) */ -#define TOR_RING TOR_START - - -/* Ret. Value for GET/WAIT Event, no event */ -#define TOR_EVENT_NONE 0 - -/* Ret. Value for GET/WAIT Event, Went Onhook */ -#define TOR_EVENT_ONHOOK 1 - -/* Ret. Value for GET/WAIT Event, Went Offhook or got Ring */ -#define TOR_EVENT_RINGOFFHOOK 2 - -/* Ret. Value for GET/WAIT Event, Got Wink or Flash */ -#define TOR_EVENT_WINKFLASH 3 - -/* Ret. Value for GET/WAIT Event, Got Alarm */ -#define TOR_EVENT_ALARM 4 - -/* Ret. Value for GET/WAIT Event, Got No Alarm (after alarm) */ -#define TOR_EVENT_NOALARM 5 - -/* Ret. Value for GET/WAIT Event, HDLC Abort frame */ -#define TOR_EVENT_ABORT 6 - -/* Ret. Value for GET/WAIT Event, HDLC Frame overrun */ -#define TOR_EVENT_OVERRUN 7 - -/* Ret. Value for GET/WAIT Event, Bad FCS */ -#define TOR_EVENT_BADFCS 8 - -/* Ret. Value for dial complete */ -#define TOR_EVENT_DIALCOMPLETE 9 - -/* Ret Value for ringer going on */ -#define TOR_EVENT_RINGERON 10 - -/* Ret Value for ringer going off */ -#define TOR_EVENT_RINGEROFF 11 - -/* Ret Value for hook change complete */ -#define TOR_EVENT_HOOKCOMPLETE 12 - -/* Value For signal type, E&M Trunk */ -#define TOR_EM 1 - -/* Value For signal type, FXS Loopstart Trunk */ -#define TOR_FXSLS 2 - -/* Value For signal type, FXS Groundstart Trunk */ -#define TOR_FXSGS 3 - -/* Value For signal type, FXS Kewlstart Trunk */ -#define TOR_FXSKS 4 - -/* Value For signal type, FXO Loopstart Trunk */ -#define TOR_FXOLS 5 - -/* Value For signal type, FXS Groundstart Trunk */ -#define TOR_FXOGS 6 - -/* Value For signal type, FXS Kewlstart Trunk */ -#define TOR_FXOKS 7 - -/* Value for signal type, Clear Channel (no stuffing or RBS) */ -#define TOR_CLEAR 8 - -/* Value for signal type, HDLC raw */ -#define TOR_HDLCRAW 9 - -/* Value for signal type, HDLC network */ -#define TOR_HDLCNET 10 - -/* Value for signal type, HDLC with FCS calculation/checking */ -#define TOR_HDLCFCS 11 - -/* Value for signal type, Slave channel */ -#define TOR_SLAVE 20 - -/* Value for signal type, flag to indicate pseudo-trunk */ -#define TOR_PSEUDO 0x100 - -/* Flag Value for IOMUX, read avail */ -#define TOR_IOMUX_READ 1 - -/* Flag Value for IOMUX, write avail */ -#define TOR_IOMUX_WRITE 2 - -/* Flag Value for IOMUX, write done */ -#define TOR_IOMUX_WRITEEMPTY 4 - -/* Flag Value for IOMUX, signalling event avail */ -#define TOR_IOMUX_SIGEVENT 8 - -/* Flag Value for IOMUX, Do Not Wait if nothing to report */ -#define TOR_IOMUX_NOWAIT 0x100 - -/* Alarm Condition bits */ -#define TOR_ALARM_NONE 0 /* No alarms */ -#define TOR_ALARM_RECOVER 1 /* Recovering from alarm */ -#define TOR_ALARM_LOOPBACK 2 /* In loopback */ -#define TOR_ALARM_YELLOW 4 /* Yellow Alarm */ -#define TOR_ALARM_RED 8 /* Red Alarm */ -#define TOR_ALARM_BLUE 16 /* Blue Alarm */ -#define TOR_ALARM_NOTOPEN 32 -/* Maintenance modes */ -#define TOR_MAINT_NONE 0 /* Normal Mode */ -#define TOR_MAINT_LOCALLOOP 1 /* Local Loopback */ -#define TOR_MAINT_REMOTELOOP 2 /* Remote Loopback */ -#define TOR_MAINT_LOOPUP 3 /* send loopup code */ -#define TOR_MAINT_LOOPDOWN 4 /* send loopdown code */ - -/* Per-span configuration values */ -#define TOR_CONFIG_TXLEVEL 7 /* bits 0-2 are tx level */ -#define TOR_CONFIG_ESF 0x10 /* bit 4 is set for ESF, clear for SF */ -#define TOR_CONFIG_B8ZS 0x20 /* bit 5 is set for B8ZS, clear for D4 */ -#define TOR_CONFIG_NOTOPEN 0x40 - -/* Conference modes */ -#define TOR_CONF_MODE_MASK 0xff /* mask for modes */ -#define TOR_CONF_NORMAL 0 /* normal mode */ -#define TOR_CONF_MONITOR 1 /* monitor mode (rx of other chan) */ -#define TOR_CONF_MONITORTX 2 /* monitor mode (tx of other chan) */ -#define TOR_CONF_MONITORBOTH 3 /* monitor mode (rx & tx of other chan) */ -#define TOR_CONF_CONF 4 /* conference mode */ -#define TOR_CONF_CONFANN 5 /* conference announce mode */ -#define TOR_CONF_CONFMON 6 /* conference monitor mode */ -#define TOR_CONF_CONFANNMON 7 /* conference announce/monitor mode */ -#define TOR_CONF_REALANDPSEUDO 8 /* real and pseudo port both on conf */ -#define TOR_CONF_FLAG_MASK 0xff00 /* mask for flags */ -#define TOR_CONF_LISTENER 0x100 /* is a listener on the conference */ -#define TOR_CONF_TALKER 0x200 /* is a talker on the conference */ -#define TOR_CONF_PSEUDO_LISTENER 0x400 /* pseudo is a listener on the conference */ -#define TOR_CONF_PSEUDO_TALKER 0x800 /* pseudo is a talker on the conference */ - - -#define TOR_DEFAULT_WINKTIME 150 /* 150 ms default wink time */ -#define TOR_DEFAULT_FLASHTIME 750 /* 750 ms default flash time */ - -#define TOR_DEFAULT_PREWINKTIME 50 /* 50 ms before wink */ -#define TOR_DEFAULT_PREFLASHTIME 50 /* 50 ms before flash */ -#define TOR_DEFAULT_STARTTIME 1500 /* 1500 ms of start */ -#define TOR_DEFAULT_RINGTIME 2000 /* 2000 ms of ring on (start, FXO) */ -#if 0 -#define TOR_DEFAULT_RXWINKTIME 250 /* 250ms longest rx wink */ -#endif -#define TOR_DEFAULT_RXWINKTIME 300 /* 300ms longest rx wink (to work with the Atlas) */ -#define TOR_DEFAULT_RXFLASHTIME 1250 /* 1250ms longest rx flash */ -#define TOR_DEFAULT_DEBOUNCETIME 600 /* 600ms of FXS GS signalling debounce */ - -#define TOR_LOOPCODE_TIME 10000 /* send loop codes for 10 secs */ -#define TOR_ALARMSETTLE_TIME 5000 /* allow alarms to settle for 5 secs */ -#define TOR_AFTERSTART_TIME 500 /* 500ms after start */ - -#define TOR_RINGOFFTIME 4000 /* Turn off ringer for 4000 ms */ -#define TOR_KEWLTIME 500 /* 500ms for kewl pulse */ - -#endif /* !_MACHINE_TOR_H_ */ @@ -1563,14 +1563,14 @@ static ssize_t zt_chan_read(struct file *file, char *usrbuf, size_t count, int u if (amnt) { /* There seems to be a max stack size, so we have to do this in smaller pieces */ - short lindata[512]; + short lindata[128]; int left = amnt >> 1; /* amnt is in bytes */ int pos = 0; int pass; while(left) { pass = left; - if (pass > 512) - pass = 512; + if (pass > 128) + pass = 128; for (x=0;x<pass;x++) lindata[x] = ZT_XLAW(chan->readbuf[chan->outreadbuf][x + pos], chan); if (copy_to_user(usrbuf + (pos << 1), lindata, pass << 1)) @@ -1660,14 +1660,14 @@ static ssize_t zt_chan_write(struct file *file, const char *usrbuf, size_t count if (chan->flags & ZT_FLAG_LINEAR) { /* There seems to be a max stack size, so we have to do this in smaller pieces */ - short lindata[512]; + short lindata[128]; int left = amnt >> 1; /* amnt is in bytes */ int pos = 0; int pass; while(left) { pass = left; - if (pass > 512) - pass = 512; + if (pass > 128) + pass = 128; if (copy_from_user(lindata, usrbuf + (pos << 1), pass << 1)) return -EFAULT; left -= pass; @@ -2285,14 +2285,14 @@ static ssize_t zt_write(struct file *file, const char *usrbuf, size_t count, lof /* No bigger than 32k for everything per tone zone */ #define MAX_SIZE 32768 -/* No more than 128 subtones */ -#define MAX_TONES 128 +/* No more than 64 subtones */ +#define MAX_TONES 64 static int ioctl_load_zone(unsigned long data) { struct zt_tone *samples[MAX_TONES]; - int next[MAX_TONES]; + short next[MAX_TONES]; struct zt_tone_def_header th; void *slab, *ptr; long size; @@ -2616,120 +2616,126 @@ static int zt_timer_ioctl(struct inode *node, struct file *file, unsigned int cm } static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int cmd, unsigned long data, int unit) { - struct zt_gains gain; - struct zt_spaninfo span; - struct zt_chan *chan,mychan; - int i,j; - struct zt_params param; + union { + struct zt_gains gain; + struct zt_spaninfo span; + struct zt_params param; + } stack; + struct zt_chan *chan; +#ifdef ALLOW_CHAN_DIAG + /* This structure is huge and will bork a 4k stack */ + struct zt_chan mychan; unsigned long flags; +#endif + int i,j; switch(cmd) { case ZT_GET_PARAMS: /* get channel timing parameters */ - copy_from_user(¶m,(struct zt_params *)data,sizeof(param)); + copy_from_user(&stack.param,(struct zt_params *)data,sizeof(stack.param)); /* Pick the right channo's */ - if (!param.channo || unit) { - param.channo = unit; + if (!stack.param.channo || unit) { + stack.param.channo = unit; } /* Check validity of channel */ - VALID_CHANNEL(param.channo); - chan = chans[param.channo]; + VALID_CHANNEL(stack.param.channo); + chan = chans[stack.param.channo]; /* point to relevant structure */ - param.sigtype = chan->sig; /* get signalling type */ + stack.param.sigtype = chan->sig; /* get signalling type */ /* return non-zero if rx not in idle state */ if (chan->span) { j = zt_q_sig(chan); if (j >= 0) { /* if returned with success */ - param.rxisoffhook = ((chan->rxsig & (j >> 8)) != (j & 0xff)); + stack.param.rxisoffhook = ((chan->rxsig & (j >> 8)) != (j & 0xff)); } else { - param.rxisoffhook = ((chan->rxhooksig != ZT_RXSIG_ONHOOK) && + stack.param.rxisoffhook = ((chan->rxhooksig != ZT_RXSIG_ONHOOK) && (chan->rxhooksig != ZT_RXSIG_INITIAL)); } - } else param.rxisoffhook = 0; + } else stack.param.rxisoffhook = 0; if (chan->span && chan->span->rbsbits && !(chan->sig & ZT_SIG_CLEAR)) { - param.rxbits = chan->rxsig; - param.txbits = chan->txsig; - param.idlebits = chan->idlebits; + stack.param.rxbits = chan->rxsig; + stack.param.txbits = chan->txsig; + stack.param.idlebits = chan->idlebits; } else { - param.rxbits = -1; - param.txbits = -1; - param.idlebits = 0; + stack.param.rxbits = -1; + stack.param.txbits = -1; + stack.param.idlebits = 0; } if (chan->span && (chan->span->rbsbits || chan->span->hooksig) && !(chan->sig & ZT_SIG_CLEAR)) { - param.rxhooksig = chan->rxhooksig; - param.txhooksig = chan->txhooksig; + stack.param.rxhooksig = chan->rxhooksig; + stack.param.txhooksig = chan->txhooksig; } else { - param.rxhooksig = -1; - param.txhooksig = -1; + stack.param.rxhooksig = -1; + stack.param.txhooksig = -1; } - param.prewinktime = chan->prewinktime; - param.preflashtime = chan->preflashtime; - param.winktime = chan->winktime; - param.flashtime = chan->flashtime; - param.starttime = chan->starttime; - param.rxwinktime = chan->rxwinktime; - param.rxflashtime = chan->rxflashtime; - param.debouncetime = chan->debouncetime; - param.channo = chan->channo; - if (chan->span) param.spanno = chan->span->spanno; - else param.spanno = 0; - strncpy(param.name, chan->name, sizeof(param.name) - 1); - param.chanpos = chan->chanpos; + stack.param.prewinktime = chan->prewinktime; + stack.param.preflashtime = chan->preflashtime; + stack.param.winktime = chan->winktime; + stack.param.flashtime = chan->flashtime; + stack.param.starttime = chan->starttime; + stack.param.rxwinktime = chan->rxwinktime; + stack.param.rxflashtime = chan->rxflashtime; + stack.param.debouncetime = chan->debouncetime; + stack.param.channo = chan->channo; + if (chan->span) stack.param.spanno = chan->span->spanno; + else stack.param.spanno = 0; + strncpy(stack.param.name, chan->name, sizeof(stack.param.name) - 1); + stack.param.chanpos = chan->chanpos; /* Return current law */ if (chan->xlaw == __zt_alaw) - param.curlaw = ZT_LAW_ALAW; + stack.param.curlaw = ZT_LAW_ALAW; else - param.curlaw = ZT_LAW_MULAW; - copy_to_user((struct zt_params *)data,¶m,sizeof(param)); + stack.param.curlaw = ZT_LAW_MULAW; + copy_to_user((struct zt_params *)data,&stack.param,sizeof(stack.param)); break; - case ZT_SET_PARAMS: /* set channel timing paramters */ - copy_from_user(¶m,(struct zt_params *)data,sizeof(param)); + case ZT_SET_PARAMS: /* set channel timing stack.paramters */ + copy_from_user(&stack.param,(struct zt_params *)data,sizeof(stack.param)); /* Pick the right channo's */ - if (!param.channo || unit) { - param.channo = unit; + if (!stack.param.channo || unit) { + stack.param.channo = unit; } /* Check validity of channel */ - VALID_CHANNEL(param.channo); - chan = chans[param.channo]; + VALID_CHANNEL(stack.param.channo); + chan = chans[stack.param.channo]; /* point to relevant structure */ /* NOTE: sigtype is *not* included in this */ - /* get timing paramters */ - chan->prewinktime = param.prewinktime; - chan->preflashtime = param.preflashtime; - chan->winktime = param.winktime; - chan->flashtime = param.flashtime; - chan->starttime = param.starttime; + /* get timing stack.paramters */ + chan->prewinktime = stack.param.prewinktime; + chan->preflashtime = stack.param.preflashtime; + chan->winktime = stack.param.winktime; + chan->flashtime = stack.param.flashtime; + chan->starttime = stack.param.starttime; /* Update ringtime if not using a tone zone */ if (!chan->curzone) chan->ringcadence[0] = chan->starttime; - chan->rxwinktime = param.rxwinktime; - chan->rxflashtime = param.rxflashtime; - chan->debouncetime = param.debouncetime; + chan->rxwinktime = stack.param.rxwinktime; + chan->rxflashtime = stack.param.rxflashtime; + chan->debouncetime = stack.param.debouncetime; break; case ZT_GETGAINS: /* get gain stuff */ - if (copy_from_user(&gain,(struct zt_gains *) data,sizeof(gain))) + if (copy_from_user(&stack.gain,(struct zt_gains *) data,sizeof(stack.gain))) return -EIO; - i = gain.chan; /* get channel no */ + i = stack.gain.chan; /* get channel no */ /* if zero, use current channel no */ if (!i) i = unit; /* make sure channel number makes sense */ if ((i < 0) || (i > ZT_MAX_CHANNELS) || !chans[i]) return(-EINVAL); if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - gain.chan = i; /* put the span # in here */ + stack.gain.chan = i; /* put the span # in here */ for (j=0;j<256;j++) { - gain.txgain[j] = chans[i]->txgain[j]; - gain.rxgain[j] = chans[i]->rxgain[j]; + stack.gain.txgain[j] = chans[i]->txgain[j]; + stack.gain.rxgain[j] = chans[i]->rxgain[j]; } - if (copy_to_user((struct zt_gains *) data,&gain,sizeof(gain))) + if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain))) return -EIO; break; case ZT_SETGAINS: /* set gain stuff */ - if (copy_from_user(&gain,(struct zt_gains *) data,sizeof(gain))) + if (copy_from_user(&stack.gain,(struct zt_gains *) data,sizeof(stack.gain))) return -EIO; - i = gain.chan; /* get channel no */ + i = stack.gain.chan; /* get channel no */ /* if zero, use current channel no */ if (!i) i = unit; /* make sure channel number makes sense */ @@ -2745,10 +2751,10 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c chans[i]->txgain = chans[i]->rxgain + 256; } } - gain.chan = i; /* put the span # in here */ + stack.gain.chan = i; /* put the span # in here */ for (j=0;j<256;j++) { - chans[i]->rxgain[j] = gain.rxgain[j]; - chans[i]->txgain[j] = gain.txgain[j]; + chans[i]->rxgain[j] = stack.gain.rxgain[j]; + chans[i]->txgain[j] = stack.gain.txgain[j]; } if (!memcmp(chans[i]->rxgain, defgain, 256) && !memcmp(chans[i]->txgain, defgain, 256)) { @@ -2760,12 +2766,12 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c chans[i]->txgain = defgain; chans[i]->gainalloc = 0; } - if (copy_to_user((struct zt_gains *) data,&gain,sizeof(gain))) + if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain))) return -EIO; break; case ZT_SPANSTAT: - copy_from_user(&span,(struct tor_spaninfo *) data,sizeof(span)); - i = span.spanno; /* get specified span number */ + copy_from_user(&stack.span,(struct zt_spaninfo *) data,sizeof(stack.span)); + i = stack.span.spanno; /* get specified span number */ if ((i < 0) || (i >= maxspans)) return(-EINVAL); /* if bad span no */ if (i == 0) /* if to figure it out for this chan */ { @@ -2775,27 +2781,28 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c } if (!spans[i]) return -EINVAL; - span.spanno = i; /* put the span # in here */ - span.totalspans = 0; - if (maxspans) span.totalspans = maxspans - 1; /* put total number of spans here */ - strncpy(span.desc, spans[i]->desc, sizeof(span.desc) - 1); - strncpy(span.name, spans[i]->name, sizeof(span.name) - 1); - span.alarms = spans[i]->alarms; /* get alarm status */ - span.bpvcount = spans[i]->bpvcount; /* get BPV count */ - span.rxlevel = spans[i]->rxlevel; /* get rx level */ - span.txlevel = spans[i]->txlevel; /* get tx level */ - span.crc4count = spans[i]->crc4count; /* get CRC4 error count */ - span.ebitcount = spans[i]->ebitcount; /* get E-bit error count */ - span.fascount = spans[i]->fascount; /* get FAS error count */ - span.irqmisses = spans[i]->irqmisses; /* get IRQ miss count */ - span.syncsrc = spans[i]->syncsrc; /* get active sync source */ - span.totalchans = spans[i]->channels; - span.numchans = 0; + stack.span.spanno = i; /* put the span # in here */ + stack.span.totalspans = 0; + if (maxspans) stack.span.totalspans = maxspans - 1; /* put total number of spans here */ + strncpy(stack.span.desc, spans[i]->desc, sizeof(stack.span.desc) - 1); + strncpy(stack.span.name, spans[i]->name, sizeof(stack.span.name) - 1); + stack.span.alarms = spans[i]->alarms; /* get alarm status */ + stack.span.bpvcount = spans[i]->bpvcount; /* get BPV count */ + stack.span.rxlevel = spans[i]->rxlevel; /* get rx level */ + stack.span.txlevel = spans[i]->txlevel; /* get tx level */ + stack.span.crc4count = spans[i]->crc4count; /* get CRC4 error count */ + stack.span.ebitcount = spans[i]->ebitcount; /* get E-bit error count */ + stack.span.fascount = spans[i]->fascount; /* get FAS error count */ + stack.span.irqmisses = spans[i]->irqmisses; /* get IRQ miss count */ + stack.span.syncsrc = spans[i]->syncsrc; /* get active sync source */ + stack.span.totalchans = spans[i]->channels; + stack.span.numchans = 0; for (j=0; j < spans[i]->channels; j++) if (spans[i]->chans[j].sig) - span.numchans++; - copy_to_user((struct tor_spaninfo *) data,&span,sizeof(span)); + stack.span.numchans++; + copy_to_user((struct zt_spaninfo *) data,&stack.span,sizeof(stack.span)); break; +#ifdef ALLOW_CHAN_DIAG case ZT_CHANDIAG: get_user(j, (int *)data); /* get channel number from user */ /* make sure its a valid channel number */ @@ -2845,6 +2852,7 @@ static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int c } } #endif +#endif /* ALLOW_CHAN_DIAG */ break; default: return -ENOTTY; @@ -3223,10 +3231,12 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit) { struct zt_chan *chan = chans[unit]; - struct zt_dialoperation tdo; - struct zt_bufferinfo bi; - struct zt_confinfo conf; - struct zt_ring_cadence cad; + union { + struct zt_dialoperation tdo; + struct zt_bufferinfo bi; + struct zt_confinfo conf; + struct zt_ring_cadence cad; + } stack; unsigned long flags, flagso; int i, j, k, rv; int ret, c; @@ -3242,13 +3252,13 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign return -EIO; return 0; case ZT_DIAL: - if (copy_from_user(&tdo, (struct zt_dialoperation *)data, sizeof(tdo))) + if (copy_from_user(&stack.tdo, (struct zt_dialoperation *)data, sizeof(stack.tdo))) return -EIO; rv = 0; /* Force proper NULL termination */ - tdo.dialstr[ZT_MAX_DTMF_BUF - 1] = '\0'; + stack.tdo.dialstr[ZT_MAX_DTMF_BUF - 1] = '\0'; spin_lock_irqsave(&chan->lock, flags); - switch(tdo.op) { + switch(stack.tdo.op) { case ZT_DIAL_OP_CANCEL: chan->curtone = NULL; chan->dialing = 0; @@ -3256,17 +3266,17 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign chan->tonep = 0; break; case ZT_DIAL_OP_REPLACE: - strcpy(chan->txdialbuf, tdo.dialstr); + strcpy(chan->txdialbuf, stack.tdo.dialstr); chan->dialing = 1; __do_dtmf(chan); break; case ZT_DIAL_OP_APPEND: - if (strlen(tdo.dialstr) + strlen(chan->txdialbuf) >= ZT_MAX_DTMF_BUF) + if (strlen(stack.tdo.dialstr) + strlen(chan->txdialbuf) >= ZT_MAX_DTMF_BUF) { rv = -EBUSY; break; } - strncpy(chan->txdialbuf + strlen(chan->txdialbuf), tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf)); + strncpy(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf)); if (!chan->dialing) { chan->dialing = 1; @@ -3279,28 +3289,28 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign spin_unlock_irqrestore(&chan->lock, flags); return rv; case ZT_GET_BUFINFO: - bi.rxbufpolicy = chan->rxbufpolicy; - bi.txbufpolicy = chan->txbufpolicy; - bi.numbufs = chan->numbufs; - bi.bufsize = chan->blocksize; + stack.bi.rxbufpolicy = chan->rxbufpolicy; + stack.bi.txbufpolicy = chan->txbufpolicy; + stack.bi.numbufs = chan->numbufs; + stack.bi.bufsize = chan->blocksize; /* XXX FIXME! XXX */ - bi.readbufs = -1; - bi.writebufs = -1; - if (copy_to_user((struct zt_bufferinfo *)data, &bi, sizeof(bi))) + stack.bi.readbufs = -1; + stack.bi.writebufs = -1; + if (copy_to_user((struct zt_bufferinfo *)data, &stack.bi, sizeof(stack.bi))) return -EIO; break; case ZT_SET_BUFINFO: - if (copy_from_user(&bi, (struct zt_bufferinfo *)data, sizeof(bi))) + if (copy_from_user(&stack.bi, (struct zt_bufferinfo *)data, sizeof(stack.bi))) return -EIO; - if (bi.bufsize > ZT_MAX_BLOCKSIZE) + if (stack.bi.bufsize > ZT_MAX_BLOCKSIZE) return -EINVAL; - if (bi.bufsize < 16) + if (stack.bi.bufsize < 16) return -EINVAL; - if (bi.bufsize * bi.numbufs > ZT_MAX_BUF_SPACE) + if (stack.bi.bufsize * stack.bi.numbufs > ZT_MAX_BUF_SPACE) return -EINVAL; - chan->rxbufpolicy = bi.rxbufpolicy & 0x1; - chan->txbufpolicy = bi.txbufpolicy & 0x1; - if ((rv = zt_reallocbufs(chan, bi.bufsize, bi.numbufs))) + chan->rxbufpolicy = stack.bi.rxbufpolicy & 0x1; + chan->txbufpolicy = stack.bi.txbufpolicy & 0x1; + if ((rv = zt_reallocbufs(chan, stack.bi.bufsize, stack.bi.numbufs))) return (rv); break; case ZT_GET_BLOCKSIZE: /* get blocksize */ @@ -3470,84 +3480,84 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign spin_unlock_irqrestore(&chan->lock, flags); return rv; case ZT_GETCONF: /* get conf stuff */ - copy_from_user(&conf,(struct zt_confinfo *) data,sizeof(conf)); - i = conf.chan; /* get channel no */ + copy_from_user(&stack.conf,(struct zt_confinfo *) data,sizeof(stack.conf)); + i = stack.conf.chan; /* get channel no */ /* if zero, use current channel no */ if (!i) i = chan->channo; /* make sure channel number makes sense */ if ((i < 0) || (i > ZT_MAX_CONF) || (!chans[i])) return(-EINVAL); if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - conf.chan = i; /* get channel number */ - conf.confno = chans[i]->confna; /* get conference number */ - conf.confmode = chans[i]->confmode; /* get conference mode */ - copy_to_user((struct zt_confinfo *) data,&conf,sizeof(conf)); + stack.conf.chan = i; /* get channel number */ + stack.conf.confno = chans[i]->confna; /* get conference number */ + stack.conf.confmode = chans[i]->confmode; /* get conference mode */ + copy_to_user((struct zt_confinfo *) data,&stack.conf,sizeof(stack.conf)); break; case ZT_SETCONF: /* set conf stuff */ - copy_from_user(&conf,(struct zt_confinfo *) data,sizeof(conf)); - i = conf.chan; /* get channel no */ + copy_from_user(&stack.conf,(struct zt_confinfo *) data,sizeof(stack.conf)); + i = stack.conf.chan; /* get channel no */ /* if zero, use current channel no */ if (!i) i = chan->channo; /* make sure channel number makes sense */ if ((i < 1) || (i > ZT_MAX_CHANNELS) || (!chans[i])) return(-EINVAL); if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - if (conf.confmode && ((conf.confmode & ZT_CONF_MODE_MASK) < 4)) { + if (stack.conf.confmode && ((stack.conf.confmode & ZT_CONF_MODE_MASK) < 4)) { /* Monitor mode -- it's a channel */ - if ((conf.confno < 0) || (conf.confno >= ZT_MAX_CHANNELS) || !chans[conf.confno]) return(-EINVAL); + if ((stack.conf.confno < 0) || (stack.conf.confno >= ZT_MAX_CHANNELS) || !chans[stack.conf.confno]) return(-EINVAL); } else { /* make sure conf number makes sense, too */ - if ((conf.confno < -1) || (conf.confno > ZT_MAX_CONF)) return(-EINVAL); + if ((stack.conf.confno < -1) || (stack.conf.confno > ZT_MAX_CONF)) return(-EINVAL); } /* if taking off of any conf, must have 0 mode */ - if ((!conf.confno) && conf.confmode) return(-EINVAL); + if ((!stack.conf.confno) && stack.conf.confmode) return(-EINVAL); /* likewise if 0 mode must have no conf */ - if ((!conf.confmode) && conf.confno) return (-EINVAL); - conf.chan = i; /* return with real channel # */ + if ((!stack.conf.confmode) && stack.conf.confno) return (-EINVAL); + stack.conf.chan = i; /* return with real channel # */ spin_lock_irqsave(&bigzaplock, flagso); spin_lock_irqsave(&chan->lock, flags); - if (conf.confno == -1) - conf.confno = zt_first_empty_conference(); - if ((conf.confno < 1) && (conf.confmode)) { + if (stack.conf.confno == -1) + stack.conf.confno = zt_first_empty_conference(); + if ((stack.conf.confno < 1) && (stack.conf.confmode)) { /* No more empty conferences */ spin_unlock_irqrestore(&chan->lock, flags); spin_unlock_irqrestore(&bigzaplock, flagso); return -EBUSY; } /* if changing confs, clear last added info */ - if (conf.confno != chans[i]->confna) { + if (stack.conf.confno != chans[i]->confna) { memset(chans[i]->conflast, 0, ZT_MAX_CHUNKSIZE); memset(chans[i]->conflast1, 0, ZT_MAX_CHUNKSIZE); memset(chans[i]->conflast2, 0, ZT_MAX_CHUNKSIZE); } j = chans[i]->confna; /* save old conference number */ - chans[i]->confna = conf.confno; /* set conference number */ - chans[i]->confmode = conf.confmode; /* set conference mode */ + chans[i]->confna = stack.conf.confno; /* set conference number */ + chans[i]->confmode = stack.conf.confmode; /* set conference mode */ chans[i]->_confn = 0; /* Clear confn */ zt_check_conf(j); - zt_check_conf(conf.confno); + zt_check_conf(stack.conf.confno); /* k will be non-zero if in a real conf */ - k = conf.confmode & (ZT_CONF_CONF | ZT_CONF_CONFANN | ZT_CONF_CONFMON | ZT_CONF_CONFANNMON | ZT_CONF_REALANDPSEUDO); + k = stack.conf.confmode & (ZT_CONF_CONF | ZT_CONF_CONFANN | ZT_CONF_CONFMON | ZT_CONF_CONFANNMON | ZT_CONF_REALANDPSEUDO); /* if we are going onto a conf */ - if (conf.confno && k) { + if (stack.conf.confno && k) { /* Get alias */ - chans[i]->_confn = zt_get_conf_alias(conf.confno); + chans[i]->_confn = zt_get_conf_alias(stack.conf.confno); } spin_unlock_irqrestore(&chan->lock, flags); spin_unlock_irqrestore(&bigzaplock, flagso); - copy_to_user((struct zt_confinfo *) data,&conf,sizeof(conf)); + copy_to_user((struct zt_confinfo *) data,&stack.conf,sizeof(stack.conf)); break; case ZT_CONFLINK: /* do conf link stuff */ if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - copy_from_user(&conf,(struct zt_confinfo *) data,sizeof(conf)); + copy_from_user(&stack.conf,(struct zt_confinfo *) data,sizeof(stack.conf)); /* check sanity of arguments */ - if ((conf.chan < 0) || (conf.chan > ZT_MAX_CONF)) return(-EINVAL); - if ((conf.confno < 0) || (conf.confno > ZT_MAX_CONF)) return(-EINVAL); + if ((stack.conf.chan < 0) || (stack.conf.chan > ZT_MAX_CONF)) return(-EINVAL); + if ((stack.conf.confno < 0) || (stack.conf.confno > ZT_MAX_CONF)) return(-EINVAL); /* cant listen to self!! */ - if (conf.chan && (conf.chan == conf.confno)) return(-EINVAL); + if (stack.conf.chan && (stack.conf.chan == stack.conf.confno)) return(-EINVAL); spin_lock_irqsave(&bigzaplock, flagso); spin_lock_irqsave(&chan->lock, flags); /* if to clear all links */ - if ((!conf.chan) && (!conf.confno)) + if ((!stack.conf.chan) && (!stack.conf.confno)) { /* clear all the links */ memset(conf_links,0,sizeof(conf_links)); @@ -3561,12 +3571,12 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign for(i = 1; i <= ZT_MAX_CONF; i++) { /* if found, exit */ - if ((conf_links[i].src == conf.chan) && - (conf_links[i].dst == conf.confno)) break; + if ((conf_links[i].src == stack.conf.chan) && + (conf_links[i].dst == stack.conf.confno)) break; } if (i <= ZT_MAX_CONF) /* if found */ { - if (!conf.confmode) /* if to remove link */ + if (!stack.conf.confmode) /* if to remove link */ { conf_links[i].src = conf_links[i].dst = 0; } @@ -3577,7 +3587,7 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign } else /* if not found */ { - if (conf.confmode) /* if to add link */ + if (stack.conf.confmode) /* if to add link */ { /* look for empty location */ for(i = 1; i <= ZT_MAX_CONF; i++) @@ -3589,8 +3599,8 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign /* if empty spot found */ if (i <= ZT_MAX_CONF) { - conf_links[i].src = conf.chan; - conf_links[i].dst = conf.confno; + conf_links[i].src = stack.conf.chan; + conf_links[i].dst = stack.conf.confno; } else /* if no empties -- error */ { @@ -3662,9 +3672,9 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign case ZT_SETCADENCE: if (data) { /* Use specific ring cadence */ - if (copy_from_user(&cad, (struct zt_ring_cadence *)data, sizeof(cad))) + if (copy_from_user(&stack.cad, (struct zt_ring_cadence *)data, sizeof(stack.cad))) return -EIO; - memcpy(chan->ringcadence, &cad, sizeof(chan->ringcadence)); + memcpy(chan->ringcadence, &stack.cad, sizeof(chan->ringcadence)); } else { /* Reset to default */ if (chan->curzone) { |