34 #ifndef _VIRGO_QUEUE_H_
35 #define _VIRGO_QUEUE_H_
37 #define VIRGO_QUEUE_SZ 10000
39 #include <linux/ioport.h>
40 #include <linux/kobject.h>
41 #include <linux/klist.h>
42 #include <linux/list.h>
43 #include <linux/lockdep.h>
44 #include <linux/compiler.h>
45 #include <linux/types.h>
46 #include <linux/mutex.h>
48 #include <linux/atomic.h>
49 #include <linux/ratelimit.h>
50 #include <asm/device.h>
52 #include <linux/kernel.h>
53 #include <linux/kthread.h>
54 #include <linux/sched.h>
55 #include <linux/module.h>
56 #include <linux/errno.h>
57 #include <linux/fcntl.h>
58 #include <linux/net.h>
60 #include <linux/inet.h>
61 #include <linux/udp.h>
62 #include <linux/tcp.h>
63 #include <linux/string.h>
64 #include <linux/unistd.h>
65 #include <linux/slab.h>
66 #include <linux/netdevice.h>
67 #include <linux/skbuff.h>
68 #include <linux/file.h>
69 #include <linux/freezer.h>
71 #include <net/checksum.h>
75 #include <net/tcp_states.h>
76 #include <asm/uaccess.h>
77 #include <asm/ioctls.h>
78 #include <trace/events/skb.h>
80 #include <linux/module.h>
81 #include <linux/types.h>
82 #include <linux/uio.h>
83 #include <linux/unistd.h>
84 #include <linux/workqueue.h>
87 #include <linux/sunrpc/types.h>
88 #include <linux/sunrpc/clnt.h>
89 #include <linux/sunrpc/xdr.h>
90 #include <linux/sunrpc/msg_prot.h>
91 #include <linux/sunrpc/svcsock.h>
92 #include <linux/sunrpc/stats.h>
93 #include <linux/sunrpc/xprt.h>
95 #include <linux/sunrpc/xprt.h>
98 #include <linux/kingcobra.h>
112 struct work_struct work;
124 int use_for_kingcobra_messaging=1;
130 int kingcobra_in_userspace=0;
136 int kingcobra_disk_persistence=1;
137 loff_t request_reply_queue_pos=0;
142 void virgo_workqueue_handler(
struct work_struct* w);
143 static DECLARE_WORK(virgo_work, virgo_workqueue_handler);
144 static struct workqueue_struct *virgo_kernel_wq=NULL;
146 struct file* file_stdout;
148 void virgo_workqueue_handler(
struct work_struct* w)
155 printk(KERN_INFO
"virgo_workqueue_handler(): invoked for work_struct w=%p, dequeueing enqueued vwqrq->data=%s",w,vwqrq->data);
158 if(use_for_kingcobra_messaging==1)
160 if(kingcobra_in_userspace==1)
165 file_stdout=filp_open(
"/home/kashrinivaasan/linux-3.7.8/drivers/virgo/queuing/kingcobra_usermode_log.txt", O_RDWR|O_APPEND|O_CREAT, S_IRUSR|S_IWUSR);
171 argv[1]=kstrdup(
"_Z24KingCobra_ServiceRequestPv",GFP_ATOMIC);
172 argv[2]=kstrdup(vwqrq->data,GFP_ATOMIC);
173 envp[0]=
"PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games::/home/kashrinivaasan/linux-3.7.8/drivers/virgo/queuing/";
174 envp[1]=
"HOME=/home/kashrinivaasan";
176 printk(KERN_INFO
"virgo_workqueue_handler(): kingcobra_in_userspace=1, before invoking call_usermodehelper() for KingCobra \n");
177 ret=call_usermodehelper(
"/home/kashrinivaasan/linux-3.7.8/drivers/virgo/queuing/kingcobra_main", argv, envp, UMH_WAIT_EXEC);
178 printk(KERN_INFO
"virgo_workqueue_handler(): after invoking call_usermodehelper() for KingCobra \n");
179 filp_close(file_stdout,NULL);
183 printk(KERN_INFO
"virgo_workqueue_handler(): kingcobra_in_userspace=0, before invoking kingcobra_servicerequest_kernelspace()\n");
184 kingcobra_servicerequest_kernelspace(vwqrq->data);
185 printk(KERN_INFO
"virgo_workqueue_handler(): after invoking kingcobra_servicerequest_kernelspace()\n");
193 static int __init virgo_queue_init();
196 static void __exit virgo_queue_exit();