From 57ec702077391433ce1ae89bd1e2293bca03bb47 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Tue, 24 Mar 2009 21:57:11 +0000 Subject: [PATCH] --- Makefile | 2 +- fd_fusemount.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7d586f6..44f991a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC=gcc CFLAGS=-g -O2 -all: dcookie fd_bmsocket +all: dcookie fd_bmsocket fd_fusemount dcookie: dcookie.c gcc dcookie.c -o exec/dcookie diff --git a/fd_fusemount.c b/fd_fusemount.c index 6280244..63e2b96 100644 --- a/fd_fusemount.c +++ b/fd_fusemount.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -7,10 +8,11 @@ unsigned int rcvbuf = 16*1024*1024; unsigned int arg_length = 128; +unsigned int mountflags = MS_NODEV | MS_NOSUID; void receive_argument(int control_channel_fd, char *source) { int received; - received=recv(control_channel_fd, source, arg_length); + 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); @@ -63,6 +72,21 @@ int main(int argc, char *argv[]) { exit(1); } + mount_fd = receive_fd (control_channel_fd); + + if (mount_fd != magic_fd) { + printf("mount_fd (%d) != magic_fd (%d)\n", mount_fd, magic_fd); + exit(1); + } + + check_source(source); + check_target(target); + check_fstype(filesystemtype); + sprintf(slice_target,"/vservers/%s/%s", target); + + if (!mount(source, slice_target, filesystemtype, mountflags, data)) { + send_fd(control_channel_fd, magic_fd); + } } -- 2.43.0