exit(1);
}
}
+
int connect_socket() {
int fd = socket( AF_UNIX, SOCK_STREAM, 0 );
struct sockaddr_un addr;
return fd;
}
-void do_umount( char *const argv[], int n, int fd ) {
-
- // write the length
- char buf[1024];
- sprintf( buf, "%08x\n", n );
- write( fd, buf, strlen(buf) );
-
- // now write each arg
- int i;
- for( i = 0; i < n; i++ ) {
- assert( strlen(argv[i]) < 1024 );
- sprintf( buf, "%s\n", argv[i] );
- write( fd, buf, strlen(buf) );
- }
-
- char inbuf[10];
- int n2 = read( fd, inbuf, 10 );
- inbuf[n2] = '\0';
-
- int r = atoi(inbuf);
-
-}
-
-int umount2( const char *mnt, int flags ) {
-
- int fd = connect_socket();
-
- const char *argv[3];
- argv[0] = "fusermount";
- argv[1] = "-u";
- argv[2] = mnt;
-
- do_umount( (char **const) argv, 3, fd );
-
- close(fd);
-
-}
-
int get_magic_fd (char *data) {
char *ptr;
int fd;
else
return -1;
}
+
int mount(const char *source, const char *target, const char *filesystemtype,
unsigned long mountflags, const void *data) {
int fd = connect_socket();
return 0;
}
-
-int execv( const char *path, char *const argv[] ) {
- int fd;
-
- if( strstr( path, "fusermount" ) == NULL ) {
- return execv( path, argv );
- }
-
- // also make sure this is an unmount . . .
- int n = 0;
- char *arg = argv[n];
- int found_u = 0;
- while( arg != NULL ) {
- if( strcmp( arg, "-u" ) == 0 ) {
- found_u = 1;
- break;
- }
- arg = argv[++n];
- }
-
- if( !found_u ) {
- return execv( path, argv );
- }
-
- // Have root do any fusermounts we need done
- fd = connect_socket();
-
- do_umount( argv, n, fd );
- exit(0);
-
-}
-