[zaptel-commits] mattf: branch mattf/zaptel-1.4-stackcleanup r4148 - /team/mattf/zaptel-1.4-st...
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Sat Apr 5 15:01:08 CDT 2008
Author: mattf
Date: Sat Apr 5 15:01:07 2008
New Revision: 4148
URL: http://svn.digium.com/view/zaptel?view=rev&rev=4148
Log:
Reduce zt_ctl_ioctl common stack by approximately 340 bytes
Modified:
team/mattf/zaptel-1.4-stackcleanup/kernel/zaptel-base.c
Modified: team/mattf/zaptel-1.4-stackcleanup/kernel/zaptel-base.c
URL: http://svn.digium.com/view/zaptel/team/mattf/zaptel-1.4-stackcleanup/kernel/zaptel-base.c?view=diff&rev=4148&r1=4147&r2=4148
==============================================================================
--- team/mattf/zaptel-1.4-stackcleanup/kernel/zaptel-base.c (original)
+++ team/mattf/zaptel-1.4-stackcleanup/kernel/zaptel-base.c Sat Apr 5 15:01:07 2008
@@ -3536,9 +3536,6 @@
{
/* I/O CTL's for control interface */
int i,j;
- struct zt_lineconfig lc;
- struct zt_chanconfig ch;
- struct zt_sfconfig sf;
int sigcap;
int res = 0;
int x,y;
@@ -3546,7 +3543,6 @@
struct zt_dialparams tdp;
struct zt_maintinfo maint;
struct zt_indirect_data ind;
- struct zt_versioninfo vi;
unsigned long flags;
int rv;
switch(cmd) {
@@ -3556,6 +3552,9 @@
VALID_CHANNEL(ind.chan);
return zt_chan_ioctl(inode, file, ind.op, (unsigned long) ind.data, ind.chan);
case ZT_SPANCONFIG:
+ {
+ struct zt_lineconfig lc;
+
if (copy_from_user(&lc, (struct zt_lineconfig *)data, sizeof(lc)))
return -EFAULT;
VALID_SPAN(lc.span);
@@ -3570,6 +3569,7 @@
return spans[lc.span]->spanconfig(spans[lc.span], &lc);
}
return 0;
+ }
case ZT_STARTUP:
CHECK_VALID_SPAN(j);
if (spans[j]->flags & ZT_FLAG_RUNNING)
@@ -3596,6 +3596,9 @@
spans[j]->flags &= ~ZT_FLAG_RUNNING;
return 0;
case ZT_CHANCONFIG:
+ {
+ struct zt_chanconfig ch;
+
if (copy_from_user(&ch, (struct zt_chanconfig *)data, sizeof(ch)))
return -EFAULT;
VALID_CHANNEL(ch.chan);
@@ -3631,7 +3634,7 @@
free_netdev(chans[ch.chan]->hdlcnetdev->netdev);
#else
unregister_hdlc_device(&chans[ch.chan]->hdlcnetdev->netdev);
-#endif
+#endif
kfree(chans[ch.chan]->hdlcnetdev);
chans[ch.chan]->hdlcnetdev = NULL;
chans[ch.chan]->flags &= ~ZT_FLAG_NETDEV;
@@ -3642,7 +3645,7 @@
printk(KERN_WARNING "Zaptel networking not supported by this build.\n");
return -ENOSYS;
}
-#endif
+#endif
sigcap = chans[ch.chan]->sigcap;
/* If they support clear channel, then they support the HDLC and such through
us. */
@@ -3770,7 +3773,7 @@
res = -1;
}
}
-#endif
+#endif
if ((chans[ch.chan]->sig == ZT_SIG_HDLCNET) &&
(chans[ch.chan] == newmaster) &&
!(chans[ch.chan]->flags & ZT_FLAG_NETDEV))
@@ -3791,10 +3794,14 @@
}
#ifdef CONFIG_ZAPATA_DEBUG
printk("Configured channel %s, flags %04x, sig %04x\n", chans[ch.chan]->name, chans[ch.chan]->flags, chans[ch.chan]->sig);
-#endif
+#endif
spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
return res;
+ }
case ZT_SFCONFIG:
+ {
+ struct zt_sfconfig sf;
+
if (copy_from_user(&sf, (struct zt_chanconfig *)data, sizeof(sf)))
return -EFAULT;
VALID_CHANNEL(sf.chan);
@@ -3821,6 +3828,7 @@
}
spin_unlock_irqrestore(&chans[sf.chan]->lock, flags);
return res;
+ }
case ZT_DEFAULTZONE:
if (get_user(j,(int *)data))
return -EFAULT;
@@ -3880,12 +3888,16 @@
return -EFAULT;
break;
case ZT_GETVERSION:
+ {
+ struct zt_versioninfo vi;
+
memset(&vi, 0, sizeof(vi));
zap_copy_string(vi.version, ZAPTEL_VERSION, sizeof(vi.version));
echo_can_identify(vi.echo_canceller, sizeof(vi.echo_canceller) - 1);
if (copy_to_user((struct zt_versioninfo *) data, &vi, sizeof(vi)))
return -EFAULT;
break;
+ }
case ZT_MAINT: /* do maintenance stuff */
/* get struct from user */
if (copy_from_user(&maint,(struct zt_maintinfo *) data, sizeof(maint)))
More information about the zaptel-commits
mailing list