#include #include #include #include #include #include #include #include "fdpass.h" unsigned int rcvbuf = 16*1024*1024; unsigned int arg_length = 128; unsigned int mountflags = MS_NODEV | MS_NOSUID; FILE *logfd; void receive_argument(int control_channel_fd, char *source) { int received; received=recv(control_channel_fd, source, arg_length, 0); if (received 1023) { printf ("Got control_channel_fd = %d\n", control_channel_fd); exit(1); } receive_argument(control_channel_fd, source); receive_argument(control_channel_fd, target); receive_argument(control_channel_fd, filesystemtype); receive_argument(control_channel_fd, data); mount_fd = receive_fd (control_channel_fd); if (mount_fd < 2) { printf("mount_fd = %d\n", mount_fd); exit(1); } set_magic_fd(data, mount_fd); check_source(source); check_target(target); check_fstype(filesystemtype); sprintf(slice_target,"/vservers/%s/%s", slice_name, target); fprintf(logfd, "Mount fd: %d Source: %s slice_target: %s fstype: %s mountflags: %d data: %s\n", mount_fd, source, slice_target, filesystemtype, mountflags, data); if (!mount(source, slice_target, filesystemtype, mountflags, data)) { send_fd(control_channel_fd, mount_fd); } else { printf ("Error executing mount\n"); exit(1); } close(logfd); return 0; }