2 #include <sys/socket.h>
8 unsigned int rcvbuf = 16*1024*1024;
9 unsigned int arg_length = 128;
11 void receive_argument(int control_channel_fd, char *source) {
13 received=recv(control_channel_fd, source, arg_length);
14 if (received<arg_length) {
15 printf("Error receiving arguments over the control buffer\n");
20 int get_magic_fd (char *data) {
24 data[arg_length-1]='\0';
25 ptr = strstr(data,"fd=");
29 // Found two fd= expressions
30 if (strstr(ptr+3,"fd="))
34 sscanf(ptr+3,"%d",&fd);
41 int main(int argc, char *argv[]) {
42 int control_channel_fd, magic_fd;
43 char source[128],target[128],filesystemtype[128],data[129];
48 printf("This script is called by vsys.\n");
52 sscanf(argv[2],"%d", &control_channel_fd);
54 receive_argument(control_channel_fd, source);
55 receive_argument(control_channel_fd, target);
56 receive_argument(control_channel_fd, filesystemtype);
57 receive_argument(control_channel_fd, data);
59 magic_fd = get_magic_fd (data);
62 printf("Got fd %d in fusemount\n",magic_fd);