12 #include <linux/module.h>
13 #include <linux/poll.h>
14 #include <linux/slab.h>
20 #include <linux/sched.h>
21 #include <linux/isdnif.h>
32 static struct divert_info *divert_info_head =
NULL;
33 static struct divert_info *divert_info_tail =
NULL;
43 struct divert_info *ib;
54 strcpy(ib->info_start, cp);
58 if (!divert_info_head)
59 divert_info_head = ib;
61 divert_info_tail->next = ib;
62 divert_info_tail = ib;
65 while (divert_info_head->next) {
66 if ((divert_info_head->usage_cnt <= 0) &&
67 (divert_info_head->next->usage_cnt <= 0)) {
68 ib = divert_info_head;
69 divert_info_head = divert_info_head->next;
74 spin_unlock_irqrestore(&divert_info_lock, flags);
84 isdn_divert_read(
struct file *
file,
char __user *
buf,
size_t count, loff_t *off)
86 struct divert_info *inf;
94 if (!(inf = *((
struct divert_info **) file->
private_data)))
99 if ((len =
strlen(inf->info_start)) <= count) {
112 isdn_divert_write(
struct file *file,
const char __user *buf,
size_t count, loff_t *off)
124 unsigned int mask = 0;
126 poll_wait(file, &(rd_queue), wait);
138 isdn_divert_open(
struct inode *
ino,
struct file *filep)
144 if (divert_info_head)
148 spin_unlock_irqrestore(&divert_info_lock, flags);
157 isdn_divert_close(
struct inode *ino,
struct file *filep)
159 struct divert_info *inf;
170 while (divert_info_head) {
171 inf = divert_info_head;
172 divert_info_head = divert_info_head->next;
175 spin_unlock_irqrestore(&divert_info_lock, flags);
182 static int isdn_divert_ioctl_unlocked(
struct file *file,
uint cmd,
ulong arg)
223 spin_unlock_irqrestore(&divert_lock, flags);
267 static long isdn_divert_ioctl(
struct file *file,
uint cmd,
ulong arg)
272 ret = isdn_divert_ioctl_unlocked(file, cmd, arg);
282 .read = isdn_divert_read,
283 .write = isdn_divert_write,
284 .poll = isdn_divert_poll,
285 .unlocked_ioctl = isdn_divert_ioctl,
286 .open = isdn_divert_open,
287 .release = isdn_divert_close,
306 #ifdef CONFIG_PROC_FS
308 if (!isdn_proc_entry)
311 isdn_proc_entry, &isdn_fops);
312 if (!isdn_divert_entry) {
329 #ifdef CONFIG_PROC_FS