diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-05-29 14:56:07 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-05-29 14:56:07 -0700 |
commit | 444ebf4700685a69edaa30016851566b815a5014 (patch) | |
tree | 15dbf70c9c030018213a701e8510247d33a35487 | |
parent | a8faea73a2bfe9661080ddec9169e2102f3861b4 (diff) | |
download | klibc-444ebf4700685a69edaa30016851566b815a5014.tar.gz |
[klibc] nfsmount: better debugging info and error messagesklibc-1.3.26
In particular, the error message we get when the kernel doesn't
have the appropriate NFS support was very confusing.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | usr/kinit/kinit.c | 12 | ||||
-rw-r--r-- | usr/kinit/kinit.h | 10 | ||||
-rw-r--r-- | usr/kinit/nfsmount/mount.c | 11 | ||||
-rw-r--r-- | usr/kinit/nfsroot.c | 11 |
4 files changed, 28 insertions, 16 deletions
diff --git a/usr/kinit/kinit.c b/usr/kinit/kinit.c index ecc514f8fec67..bd7c60e6253dc 100644 --- a/usr/kinit/kinit.c +++ b/usr/kinit/kinit.c @@ -18,27 +18,21 @@ int mnt_procfs; int mnt_sysfs; #ifdef INI_DEBUG -static void dump_args(int argc, char *argv[]) +void dump_args(int argc, char *argv[]) { int i; printf(" argc == %d\n", argc); for (i = 0; i < argc; i++) { - printf(" argv[%d]: '%s'\n", i, argv[i]); + printf(" argv[%d]: \"%s\"\n", i, argv[i]); } if (argv[argc] != NULL) { - printf(" argv[%d]: '%s' (SHOULD BE NULL)\n", + printf(" argv[%d]: \"%s\" (SHOULD BE NULL)\n", argc, argv[argc]); } } -#else -static inline void dump_args(int argc, char *argv[]) -{ - (void)argc; - (void)argv; -} #endif diff --git a/usr/kinit/kinit.h b/usr/kinit/kinit.h index bf20a638d3a27..23d974b621149 100644 --- a/usr/kinit/kinit.h +++ b/usr/kinit/kinit.h @@ -60,4 +60,14 @@ ssize_t freadfile(FILE *f, char **pptr); #define DEBUG(x) do { } while (0) #endif +#ifdef INI_DEBUG +void dump_args(int argc, char *argv[]); +#else +static inline void dump_args(int argc, char *argv[]) +{ + (void)argc; + (void)argv; +} +#endif + #endif /* KINIT_H */ diff --git a/usr/kinit/nfsmount/mount.c b/usr/kinit/nfsmount/mount.c index 1c6d3f3c5a898..066f6cdaa0129 100644 --- a/usr/kinit/nfsmount/mount.c +++ b/usr/kinit/nfsmount/mount.c @@ -7,6 +7,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #include "nfsmount.h" #include "sunrpc.h" @@ -265,7 +266,7 @@ int nfs_mount(const char *pathname, const char *hostname, goto bail; } - dump_params(server, path, data); + dump_params(server, rem_path, data); if (data->flags & NFS_MOUNT_TCP) { clnt = tcp_client(server, mount_port, CLI_RESVPORT); @@ -318,7 +319,13 @@ int nfs_mount(const char *pathname, const char *hostname, ret = mount(pathname, path, "nfs", mountflags, data); if (ret == -1) { - perror("mount"); + if (errno == ENODEV) { + fprintf(stderr, "mount: the kernel lacks NFS v%d " + "support\n", + (data->flags & NFS_MOUNT_VER3) ? 3 : 2); + } else { + perror("mount"); + } goto bail; } diff --git a/usr/kinit/nfsroot.c b/usr/kinit/nfsroot.c index 1965987f926eb..12ffce5edfea6 100644 --- a/usr/kinit/nfsroot.c +++ b/usr/kinit/nfsroot.c @@ -88,20 +88,21 @@ int mount_nfs_root(int argc, char *argv[], int flags) } snprintf(root, len, "%s:%s", inet_ntoa(addr), path); - - nfs_argv[a++] = sub_client(client, root, len); } else { strcpy(root, path); - nfs_argv[a++] = sub_client(client, root, len); } + + nfs_argv[a++] = sub_client(client, root, len); - DEBUG(("NFS-Root: mounting %s on %s with options '%s'\n", - argv[a - 1], mtpt, opts ? opts : "none")); + DEBUG(("NFS-Root: mounting %s on %s with options \"%s\"\n", + nfs_argv[a-1], mtpt, opts ? opts : "")); nfs_argv[a++] = mtpt; nfs_argv[a] = NULL; assert(a <= NFS_ARGC); + dump_args(a, nfs_argv); + if ((ret = nfsmount_main(a, nfs_argv)) != 0) { ret = -1; goto done; |