diff options
Diffstat (limited to 'kernel/zaptel-base.c')
-rw-r--r-- | kernel/zaptel-base.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/kernel/zaptel-base.c b/kernel/zaptel-base.c index f0a3809..ff748dd 100644 --- a/kernel/zaptel-base.c +++ b/kernel/zaptel-base.c @@ -114,6 +114,7 @@ static char *zt_txlevelnames[] = { "-22.5db (CSU)" } ; +EXPORT_SYMBOL(zt_transcode_fops); EXPORT_SYMBOL(zt_init_tone_state); EXPORT_SYMBOL(zt_mf_tone); EXPORT_SYMBOL(zt_register); @@ -267,6 +268,7 @@ static sumtype *conf_sums_prev; static struct zt_span *master; static struct file_operations zt_fops; +struct file_operations *zt_transcode_fops = NULL; static struct { @@ -2578,11 +2580,33 @@ static void zt_free_pseudo(struct zt_chan *pseudo) static int zt_open(struct inode *inode, struct file *file) { int unit = UNIT(file); + int ret = -ENXIO; struct zt_chan *chan; - /* Minor 0: Special "control" descriptor */ if (!unit) return zt_ctl_open(inode, file); + if (unit == 250) { + if (!zt_transcode_fops) + request_module("zttranscode"); + if (zt_transcode_fops && zt_transcode_fops->open) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + if (zt_transcode_fops->owner) { + __MOD_INC_USE_COUNT (zt_transcode_fops->owner); +#else + if (try_module_get(zt_transcode_fops->owner)) { +#endif + ret = zt_transcode_fops->open(inode, file); + if (ret) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + __MOD_DEC_USE_COUNT (zt_transcode_fops->owner); +#else + module_put(zt_transcode_fops->owner); +#endif + } + return ret; + } + return -ENXIO; + } if (unit == 253) { if (maxspans) { return zt_timing_open(inode, file); @@ -3100,6 +3124,16 @@ static int zt_release(struct inode *inode, struct file *file) if (unit == 253) { return zt_timer_release(inode, file); } + if (unit == 250) { + res = zt_transcode_fops->release(inode, file); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) + if (zt_transcode_fops->owner) + __MOD_DEC_USE_COUNT (zt_transcode_fops->owner); +#else + module_put(zt_transcode_fops->owner); +#endif + return res; + } if (unit == 254) { chan = file->private_data; if (!chan) @@ -5114,6 +5148,9 @@ static int zt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un if (!unit) return zt_ctl_ioctl(inode, file, cmd, data); + if (unit == 250) + return zt_transcode_fops->ioctl(inode, file, cmd, data); + if (unit == 253) { timer = file->private_data; if (timer) @@ -7170,6 +7207,14 @@ zt_chan_poll(struct file *file, struct poll_table_struct *wait_table, int unit) return(ret); /* return what we found */ } +static int zt_mmap(struct file *file, struct vm_area_struct *vm) +{ + int unit = UNIT(file); + if (unit == 250) + return zt_transcode_fops->mmap(file, vm); + return -ENOSYS; +} + static unsigned int zt_poll(struct file *file, struct poll_table_struct *wait_table) { int unit = UNIT(file); @@ -7178,6 +7223,9 @@ static unsigned int zt_poll(struct file *file, struct poll_table_struct *wait_ta if (!unit) return -EINVAL; + if (unit == 250) + return zt_transcode_fops->poll(file, wait_table); + if (unit == 253) return zt_timer_poll(file, wait_table); @@ -7583,7 +7631,7 @@ static struct file_operations zt_fops = { read: zt_read, write: zt_write, poll: zt_poll, - mmap: NULL, + mmap: zt_mmap, flush: NULL, fsync: NULL, fasync: NULL, |