Krishna iResearch Intelligent Cloud Platform - VIRtual Generic Os - VIRGO - Linux kernel extensions for cloud
 All Classes
virgo_fs_syscall.h
1 /***************************************************************************************
2 VIRGO - a linux module extension with CPU and Memory pooling with cloud capabilities
3 
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 --------------------------------------------------------------------------------------------------
18 Copyright(C):
19 Srinivasan Kannan (alias) Ka.Shrinivaasan (alias) Shrinivas Kannan
20 Independent Open Source Developer, Researcher and Consultant
21 Ph: 9003082186, 9791165980
22 Open Source Products Profile(Krishna iResearch): http://sourceforge.net/users/ka_shrinivaasan, http://ohloh.net/accounts/ka_shrinivaasan
23 Personal website(research): https://sites.google.com/site/kuja27/
24 emails: ka.shrinivaasan@gmail.com, shrinivas.kannan@gmail.com, kashrinivaasan@live.com
25 --------------------------------------------------------------------------------------------------
26 
27 *****************************************************************************************/
28 
29 /*
30  VIRGO File System syscall related declarations and datastructures
31 */
32 
33 #ifndef _VIRGO_FS_H_
34 #define _VIRGO_FS_H_
35 
36 #include <linux/ioport.h>
37 #include <linux/kobject.h>
38 #include <linux/klist.h>
39 #include <linux/list.h>
40 #include <linux/lockdep.h>
41 #include <linux/compiler.h>
42 #include <linux/types.h>
43 #include <linux/mutex.h>
44 #include <linux/pm.h>
45 #include <linux/atomic.h>
46 #include <linux/ratelimit.h>
47 #include <asm/device.h>
48 #include <linux/time.h>
49 
50 #include <linux/kernel.h>
51 #include <linux/kthread.h>
52 #include <linux/sched.h>
53 #include <linux/module.h>
54 #include <linux/errno.h>
55 #include <linux/fcntl.h>
56 #include <linux/net.h>
57 #include <linux/in.h>
58 #include <linux/inet.h>
59 #include <linux/udp.h>
60 #include <linux/tcp.h>
61 #include <linux/string.h>
62 #include <linux/unistd.h>
63 #include <linux/slab.h>
64 #include <linux/netdevice.h>
65 #include <linux/skbuff.h>
66 #include <linux/file.h>
67 #include <linux/freezer.h>
68 #include <net/sock.h>
69 #include <net/checksum.h>
70 #include <net/ip.h>
71 #include <net/ipv6.h>
72 #include <net/tcp.h>
73 #include <net/tcp_states.h>
74 #include <asm/uaccess.h>
75 #include <asm/ioctls.h>
76 #include <trace/events/skb.h>
77 
78 #include <linux/module.h>
79 #include <linux/types.h>
80 #include <linux/uio.h>
81 #include <linux/unistd.h>
82 
83 #include <linux/sunrpc/types.h>
84 #include <linux/sunrpc/clnt.h>
85 #include <linux/sunrpc/xdr.h>
86 #include <linux/sunrpc/msg_prot.h>
87 #include <linux/sunrpc/svcsock.h>
88 #include <linux/sunrpc/stats.h>
89 #include <linux/sunrpc/xprt.h>
90 #include <linux/sunrpc/xprt.h>
91 
92 #define BUF_SIZE 500
93 
94 struct hostport
95 {
96  char* hostip;
97  int port;
98 };
99 
100 /*
101 struct virgo_fs_args
102 {
103  char* fs_cmd;
104  char* fs_args[5];
105  char* fsFunction;
106  char* ptr;
107  char* data;
108 };
109 */
110 
111 struct hostport* get_least_loaded_hostport_from_cloud_fs();
112 char* get_host_from_cloud_Loadtrack_fs();
113 char* get_host_from_cloud_PRG_fs();
114 
115 char* int_to_str_vfs(int);
116 char* long_to_str(long n);
117 
118 /*
119 char* addr_to_str(char*);
120 char* str_to_addr(char*);
121 char* str_to_addr2(char* straddr);
122 
123 unsigned long addr_to_virgo_unique_id(struct virgo_address* vaddr);
124 struct virgo_address* virgo_unique_id_to_addr(unsigned long virgo_unique_id);
125 
126 typedef void* (*FPTR)(struct virgo_fs_args* args);
127 
128 void var_sscanf(char *str, const char* fmt, ...);
129 
130 struct mutex virgo_fs_mutex;
131 
132 FPTR toFuncPtr(char*);
133 struct virgo_fs_args* parse_virgofs_command(char* fsFunction);
134 
135 int virgocloudexec_fs_create(void);
136 void* virgocloudexec_fs_recvfrom(struct socket*);
137 int virgocloudexec_fs_sendto(struct socket*, void* virgo_fs_ret);
138 
139 int virgo_cloudexec_fs_service(void* args);
140 void do_virgocloudexec_init(void);
141 
142 extern void* virgo_cloud_open_kernelspace(struct virgo_fs_args* args);
143 extern void* virgo_cloud_close_kernelspace(struct virgo_fs_args* args);
144 extern void* virgo_cloud_read_kernelspace(struct virgo_fs_args* args);
145 extern void* virgo_cloud_write_kernelspace(struct virgo_fs_args* args);
146 extern char* toKernelAddress(const char* str);
147 
148 struct virgo_fs_ops_t {
149  int (*virgo_fs_create)(void);
150  void* (*virgo_fs_recvfrom)(struct socket*);
151  int (*virgo_fs_sendto)(struct socket*,void* virgo_fs_ret);
152 };
153 
154 static struct virgo_fs_ops_t virgo_fs_ops = {
155  .virgo_fs_create = virgocloudexec_fs_create,
156  .virgo_fs_recvfrom = virgocloudexec_fs_recvfrom,
157  .virgo_fs_sendto = virgocloudexec_fs_sendto
158 };
159 
160 struct virgo_fs_class_t {
161  const char* m_virgo_name;
162  struct module* m_virgo_owner;
163  struct virgo_ops_t* m_virgo_ops;
164 };
165 
166 static struct virgo_fs_class_t virgo_fs_class = {
167  .m_virgo_name = "virgo_fs",
168  .m_virgo_owner = THIS_MODULE,
169  .m_virgo_ops = &virgo_fs_ops
170 };
171 
172 static struct socket *sock;
173 
174 int parameterIsExecutable=0;
175 struct file* file_stdout;
176 
177 void print_buffer(char*);
178 int tokenize_list_of_ip_addrs(char* buf);
179 void read_virgo_config();
180 int kernel_space_func(void* args);
181 char* strip_control_M(char*);
182 
183 int virgo_fs_client_thread(void* args);
184 
185 
186 extern int virgo_cloud_test_kernelspace(void* args);
187 
188 
189 / File segment for virgo_fs syscalls serverside that invoke VFS kernel functions/
190 mm_segment_t fs;
191 
192 / Array to keep track of number of open files and generate unique VFS file descriptor for the client /
193 int no_of_openfiles=-1;
194 struct file* open_VFS_files[256];
195 
196 char* toVFSString(int* data);
197 */
198 
199 
200 #endif /* _VIRGO_FS_H_ */
201