30 #include <sys/types.h>
44 struct virgo_fs_args* parse_virgofs_command_userspace(
char* fsFunction);
45 void* virgo_cloud_open(
void*);
46 void* virgo_cloud_close(
void*);
47 void* virgo_cloud_read(
void*);
48 void* virgo_cloud_write(
void*);
50 void* virgo_cloud_open(
void* args)
53 printf(
"virgo_cloud_fs.c:Executing virgo_cloud_fs on cloud node, Invoking virgo_cloud_open(), Writing to file opened by Kernel, Kernel Space to User space communication works\n");
54 struct virgo_fs_args* vmargs=parse_virgofs_command_userspace((
char*)args);
55 int fd=open(vmargs->fs_args[0],O_RDWR);
57 printf(
"virgo_cloud_fs.c:virgo_cloud_open(): fd=%d,buf=%s\n",fd,buf);
62 void* virgo_cloud_read(
void* args)
64 printf(
"virgo_cloud_fs.c:Executing virgo_cloud_fs on cloud node, Invoking virgo_cloud_read(), Writing to file opened by Kernel, Kernel Space to User space communication works\n");
65 struct virgo_fs_args* vmargs=parse_virgofs_command_userspace((
char*)args);
67 int fd=atoi(vmargs->fs_args[0]);
68 fd=open(
"/home/kashrinivaasan/linux-3.7.8/drivers/virgo/cloudfs/virgofstest.txt",O_RDWR);
70 printf(
"virgo_cloud_fs.c: virgo_cloud_read(): fd=%d, buf=%s\n",fd,buf);
74 void* virgo_cloud_write(
void* args)
76 printf(
"virgo_cloud_fs.c:Executing virgo_cloud_fs on cloud node, Invoking virgo_cloud_write(), Writing to file opened by Kernel, Kernel Space to User space communication works\n");
77 struct virgo_fs_args* vmargs=parse_virgofs_command_userspace((
char*)args);
78 int fd=atoi(vmargs->fs_args[0]);
79 printf(
"virgo_cloud_fs.c: virgo_cloud_write(): buf=%s\n",vmargs->fs_args[1]);
80 fd=open(
"/home/kashrinivaasan/linux-3.7.8/drivers/virgo/cloudfs/virgofstest.txt",O_RDWR);
81 write(fd,vmargs->fs_args[1],256);
86 void* virgo_cloud_close(
void* args)
88 printf(
"virgo_cloud_fs.c:Executing virgo_cloud_fs on cloud node, Invoking virgo_cloud_close(), Writing to file opened by Kernel, Kernel Space to User space communication works\n");
89 struct virgo_fs_args* vmargs=parse_virgofs_command_userspace((
char*)args);
90 int fd=atoi(vmargs->fs_args[0]);
95 struct virgo_fs_args* parse_virgofs_command_userspace(
char* fsFunction)
98 printf(
"virgo_cloud_fs.c:fsFunction to parse = %s\n",fsFunction);
99 vmargs->fs_cmd=strdup(strsep(&fsFunction,
"("));
100 printf(
"virgo_cloud_fs.c:vmargs->fs_cmd = %s\n",vmargs->fs_cmd);
101 if(strcmp(vmargs->fs_cmd,
"virgo_cloud_open")==0 || strcmp(vmargs->fs_cmd,
"virgo_cloud_close")==0)
103 vmargs->fs_args[0]=strdup(strsep(&fsFunction,
")"));
104 printf(
"virgo_cloud_fs.c:vmargs->fs_args[0] = %s\n",vmargs->fs_args[0]);
105 vmargs->fs_args[1]=NULL;
110 vmargs->fs_args[0]=strdup(strsep(&fsFunction,
","));
111 vmargs->fs_args[1]=strdup(strsep(&fsFunction,
","));
112 vmargs->fs_args[2]=strdup(strsep(&fsFunction,
")"));
113 printf(
"virgo_cloud_fs.c:vmargs->fs_args[0] = %s\n",vmargs->fs_args[0]);
114 printf(
"virgo_cloud_fs.c:vmargs->fs_args[1] = %s\n",vmargs->fs_args[1]);
115 printf(
"virgo_cloud_fs.c:vmargs->fs_args[2] = %s\n",vmargs->fs_args[2]);
116 vmargs->fs_args[3]=NULL;
126 char* toAddress(
char* strAddress)
129 sscanf(strAddress,
"%p",ptr);