From 79968466f45ef4eae3a69089c79002cc065bf504 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Tue, 13 Feb 2001 15:54:14 +0000 Subject: - better log of nfs mount errors - don't insmod modules already present (important for bzip2 slowness) --- mdk-stage1/modules.c | 19 +++++++++++++++++++ mdk-stage1/mount.c | 4 +--- mdk-stage1/nfsmount.c | 7 ++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index fe55ff15f..8194a7576 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -192,6 +192,22 @@ static void add_modules_conf(char * str) } +static int module_already_present(const char * name) +{ + FILE * f; + int answ = 0; + f = fopen("/proc/modules", "rb"); + while (1) { + char buf[500]; + if (!fgets(buf, sizeof(buf), f)) break; + if (!strncmp(name, buf, strlen(name))) + answ = 1; + } + fclose(f); + return answ; +} + + static int insmod_with_deps(const char * mod_name, char * options) { struct module_deps_elem * dep; @@ -210,6 +226,9 @@ static int insmod_with_deps(const char * mod_name, char * options) } } + if (module_already_present(mod_name)) + return 0; + log_message("needs %s", mod_name); return insmod_archived_file(mod_name, options); } diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c index bcdc069ca..171bf30b5 100644 --- a/mdk-stage1/mount.c +++ b/mdk-stage1/mount.c @@ -163,10 +163,8 @@ int my_mount(char *dev, char *location, char *fs) log_message("preparing nfsmount for %s", dev); rc = nfsmount_prepare(dev, &flags, &opts); - if (rc != 0) { - log_perror(dev); + if (rc != 0) return rc; - } } #endif diff --git a/mdk-stage1/nfsmount.c b/mdk-stage1/nfsmount.c index d980860a2..77fbb530e 100644 --- a/mdk-stage1/nfsmount.c +++ b/mdk-stage1/nfsmount.c @@ -232,7 +232,12 @@ int nfsmount_prepare(const char *spec, int *flags, char **mount_opts) goto fail; if (status.fhs_status != 0) { - log_message("nfsmount prepare failed, reason given by server: %d", status.fhs_status); + if (status.fhs_status == 2) + log_message("NFS server says: No such file or directory"); + else if (status.fhs_status == 13) + log_message("NFS server says: Permission denied"); + else + log_message("nfsmount prepare failed, reason given by server: %d", status.fhs_status); goto fail; } -- cgit v1.2.1