X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Ferror.c;h=4cc9e0949e3645dbbd6b17c077161e3adb5ab2f5;hp=480c944c88020b0cd14821b636c3c81b2489fb1a;hb=906f0b27730b0506a24ed43029983b4d6819dd12;hpb=6e54f6179cb9e9d5706901a06744b8f4667c24e7 diff --git a/utils/mount/error.c b/utils/mount/error.c index 480c944..4cc9e09 100644 --- a/utils/mount/error.c +++ b/utils/mount/error.c @@ -23,7 +23,10 @@ * + Proper support for internationalization */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -32,8 +35,6 @@ #include #include #include -#include -#include #include "xcommon.h" #include "nls.h" @@ -185,7 +186,7 @@ void sys_mount_errors(char *server, int error, int will_retry, int bg) fprintf(stderr, "%s\n", errbuf); } -/* +/** * mount_error - report a foreground mount error * @spec: C string containing the device name being mounted * @mount_point: C string containing the pathname of the local mounted on dir @@ -195,12 +196,24 @@ void sys_mount_errors(char *server, int error, int will_retry, int bg) void mount_error(const char *spec, const char *mount_point, int error) { switch(error) { + case EACCES: + nfs_error(_("%s: access denied by server while mounting %s"), + progname, spec); + break; + case EINVAL: + nfs_error(_("%s: an incorrect mount option was specified"), progname); + break; + case EOPNOTSUPP: + nfs_error(_("%s: requested NFS version or transport" + " protocol is not supported"), + progname); + break; case ENOTDIR: nfs_error(_("%s: mount point %s is not a directory"), progname, mount_point); break; case EBUSY: - nfs_error(_("%s: %s is already mounted or busy"), + nfs_error(_("%s: %s is busy or already mounted"), progname, mount_point); break; case ENOENT: @@ -212,6 +225,18 @@ void mount_error(const char *spec, const char *mount_point, int error) nfs_error(_("%s: mount point %s does not exist"), progname, mount_point); break; + case ESPIPE: + rpc_mount_errors((char *)spec, 0, 0); + break; + case EIO: + nfs_error(_("%s: mount system call failed"), progname); + break; + case EFAULT: + nfs_error(_("%s: encountered unexpected error condition."), + progname); + nfs_error(_("%s: please report the error to" PACKAGE_BUGREPORT), + progname); + break; default: nfs_error(_("%s: %s"), progname, strerror(error)); @@ -275,6 +300,8 @@ void umount_error(int err, const char *dev) #define EDQUOT ENOSPC #endif +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + static struct { enum nfsstat stat; int errnum; @@ -304,19 +331,17 @@ static struct { #endif /* Throw in some NFSv3 values for even more fun (HP returns these) */ { 71, EREMOTE }, - - { -1, EIO } }; -char *nfs_strerror(int stat) +char *nfs_strerror(unsigned int stat) { - int i; + unsigned int i; static char buf[256]; - for (i = 0; nfs_errtbl[i].stat != -1; i++) { + for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) { if (nfs_errtbl[i].stat == stat) return strerror(nfs_errtbl[i].errnum); } - sprintf(buf, _("unknown nfs status return value: %d"), stat); + sprintf(buf, _("unknown nfs status return value: %u"), stat); return buf; }