--- util-linux-2.12a/mount/loop.c.np 2004-07-20 13:03:46.301757658 +0200 +++ util-linux-2.12a/mount/loop.c 2004-07-20 13:04:09.658864564 +0200 @@ -12,7 +12,12 @@ #include <ctype.h> #include <sys/ioctl.h> #include <sys/types.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <fcntl.h> +#include <unistd.h> #include <errno.h> +#include "nls.h" #include "loop.h" static void convert_info_to_info64(struct loop_info *info, struct loop_info64 *info64) @@ -194,6 +199,32 @@ return(s); } +void load_module(char * module) { + pid_t x; + int y; + char * a[3]; + + if(!(x = fork())) { + if((x = open("/dev/null", O_WRONLY)) >= 0) { + dup2(x, 2); + close(x); + } + a[0] = "modprobe"; + a[1] = module; + a[2] = NULL; + execvp(a[0], &a[0]); + execv("/sbin/modprobe", &a[0]); + /* error to stdout, stderr is directed to /dev/null */ + printf(_("loop: unable to execute modprobe\n")); + exit(1); + } + if(x == -1) { + fprintf(stderr, _("loop: fork failed\n")); + return; + } + waitpid(x, &y, 0); +} + int loop_crypt_type(const char *name, u_int32_t *kbyp, char **apiName) { int i, k; @@ -210,6 +241,8 @@ } } *kbyp = 16; /* 128 bits */ + load_module("cryptoloop"); + load_module(*apiName); return 18; /* LO_CRYPT_CRYPTOAPI */ }