Krishna iResearch Intelligent Cloud Platform - VIRtual Generic Os - VIRGO - Linux kernel extensions for cloud
 All Classes
virgo.h
1 /***************************************************************************************
2 VIRGO - a linux module extension with CPU and Memory pooling with cloud capabilities
3 
4 Copyright (C) 2009-2013 Ka.Shrinivaasan
5 
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 --------------------------------------------------------------------------------------------------
20 Srinivasan Kannan (alias) Ka.Shrinivaasan (alias) Shrinivas Kannan
21 Independent Open Source Developer, Researcher and Consultant
22 Ph: 9003082186, 9791165980
23 Open Source Products Profile(Krishna iResearch): http://sourceforge.net/users/ka_shrinivaasan
24 Personal website(research): https://sites.google.com/site/kuja27/
25 emails: ka.shrinivaasan@gmail.com, shrinivas.kannan@gmail.com, kashrinivaasan@live.com
26 --------------------------------------------------------------------------------------------------
27 
28 *****************************************************************************************/
29 
30 #ifndef _VIRGO_H_
31 #define _VIRGO_H_
32 
33 #include <linux/ioport.h>
34 #include <linux/kobject.h>
35 #include <linux/klist.h>
36 #include <linux/list.h>
37 #include <linux/lockdep.h>
38 #include <linux/compiler.h>
39 #include <linux/types.h>
40 #include <linux/mutex.h>
41 #include <linux/pm.h>
42 #include <linux/atomic.h>
43 #include <linux/ratelimit.h>
44 #include <asm/device.h>
45 
46 /******************************************/
47 
48 #include <linux/kernel.h>
49 #include <linux/kthread.h>
50 #include <linux/sched.h>
51 #include <linux/module.h>
52 #include <linux/errno.h>
53 #include <linux/fcntl.h>
54 #include <linux/net.h>
55 #include <linux/in.h>
56 #include <linux/inet.h>
57 #include <linux/udp.h>
58 #include <linux/tcp.h>
59 #include <linux/string.h>
60 #include <linux/unistd.h>
61 #include <linux/slab.h>
62 #include <linux/netdevice.h>
63 #include <linux/skbuff.h>
64 #include <linux/file.h>
65 #include <linux/freezer.h>
66 #include <net/sock.h>
67 #include <net/checksum.h>
68 #include <net/ip.h>
69 #include <net/ipv6.h>
70 #include <net/tcp.h>
71 #include <net/tcp_states.h>
72 #include <asm/uaccess.h>
73 #include <asm/ioctls.h>
74 #include <trace/events/skb.h>
75 
76 #include <linux/module.h>
77 #include <linux/types.h>
78 #include <linux/uio.h>
79 #include <linux/unistd.h>
80 /*#include <linux/init.h>*/
81 
82 #include <linux/sunrpc/types.h>
83 #include <linux/sunrpc/clnt.h>
84 #include <linux/sunrpc/xdr.h>
85 #include <linux/sunrpc/msg_prot.h>
86 #include <linux/sunrpc/svcsock.h>
87 #include <linux/sunrpc/stats.h>
88 #include <linux/sunrpc/xprt.h>
89 /*#include "sunrpc.h"*/
90 #include <linux/sunrpc/xprt.h>
91 /*#include "netns.h"*/
92 
93 #define BUF_SIZE 500
94 typedef int (*FPTR)(void *args);
95 
96 int virgocloudexec_create(void);
97 int virgocloudexec_recvfrom(struct socket*);
98 int virgocloudexec_sendto(struct socket*);
99 
100 int virgo_cloudexec_service(void* args);
101 
102 void do_virgocloudexec_init(void);
103 
104 extern int virgo_cloud_test_kernelspace(void* args);
105 
106 extern void push_request(struct virgo_request* vrq);
107 
108 
109 /*
110 New boolean flag added for using VIRGO cloud for KingCobra. If set to 1, VIRGO cloudexec service
111 in cpupooling driver is invoked in kernelspace.
112 */
113 
114 int use_as_kingcobra_service=1;
115 
116 
117 /*
118 static struct svc_xprt_ops virgo_ops = {
119  .xpo_create = virgocloudexec_create,
120  .xpo_recvfrom = virgocloudexec_recvfrom,
121  .xpo_sendto = virgocloudexec_sendto
122 };
123 
124 static struct svc_xprt_class virgo_class = {
125  .xcl_name = "virgo",
126  .xcl_owner = THIS_MODULE,
127  .xcl_ops = &virgo_ops
128 };
129 */
130 
131 
132 struct virgo_ops_t {
133  int (*virgo_create)(void);
134  int (*virgo_recvfrom)(struct socket*);
135  int (*virgo_sendto)(struct socket*);
136 };
137 
138 static struct virgo_ops_t virgo_ops = {
139  .virgo_create = virgocloudexec_create,
140  .virgo_recvfrom = virgocloudexec_recvfrom,
141  .virgo_sendto = virgocloudexec_sendto,
142 };
143 
145  const char* m_virgo_name;
146  struct module* m_virgo_owner;
147  struct virgo_ops_t* m_virgo_ops;
148 };
149 
150 static struct virgo_class_t virgo_class = {
151  .m_virgo_name = "virgo",
152  .m_virgo_owner = THIS_MODULE,
153  .m_virgo_ops = &virgo_ops
154 };
155 
156 struct task_struct *task;
157 int (*cloneFunction_ptr)(void*);
158 char* cloneFunction;
159 int error;
160 char buffer[BUF_SIZE];
161 static struct socket *sock;
162 static struct sockaddr_in sin;
163 int len=0;
164 
165 /*
166 Multithreaded VIRGO Kernel Service - commented global declarations and moved to xxxsendto() and xxxrecvfrom() with in module
167 ----------------------------------------------------------------------------------------------------------------------------
168 static struct socket *clientsock;
169 static struct kvec iov;
170 static struct msghdr msg = { NULL, };
171 int buflen=BUF_SIZE;
172 int nr=1;
173 int args=0;
174 */
175 
176 int parameterIsExecutable=2;
177 struct file* file_stdout;
178 
179 void print_buffer(char*);
180 int tokenize_list_of_ip_addrs(char* buf);
181 void read_virgo_config();
182 int kernel_space_func(void* args);
183 char* strip_control_M(char*);
184 
185 int virgo_client_thread(void* args);
186 
187 
188 /*
189  * VIRGO cloudexec service kernel thread initialization
190  * - Ka.Shrinivaasan 3May2013
191 
192 
193 int virgo_cloudexec_service(void* args)
194 {
195  try_module_get(virgo_class.m_virgo_owner);
196  while(1)
197  {
198  virgo_ops.virgo_create();
199  virgo_ops.virgo_recvfrom();
200  virgo_ops.virgo_sendto();
201  }
202 }
203 
204 */
205 
206 #endif /* _VIRGO_H_ */