/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file contains code to support better NFS error messages. Death to
* integer codes in user error messages!
*
* XXX Ideally this code should be more general and available to the entire
* kernel (see RFE 1101936). When this happens, this file can go away.
*/
/* size of a temporary printf format buffer. */
static void expand_format_string(int, const char *, char *, int);
static char *nfs_strerror(int);
/*
* nfs_perror: Works like printf (format string and variable args) except
* that it will substitute an error message for a "%m" string (like
* syslog), using the given errno value.
*/
void
{
/* Expand %m */
/*
* Now pass the massaged format string and its arguments off to
* printf.
*/
}
/*
* nfs_cmn_err: Works like cmn_err (error level, format string, and
* variable args) except that it will substitute an error message for a
* "%m" string (like syslog), using the given errno value.
*/
void
{
/* Expand %m */
/*
* Now pass the massaged format string and its arguments off to
* cmn_err.
*/
}
/*
* expand_format_string: copy the printf format string from "fmt" to "buf",
* expanding %m to the error string for "error".
*/
static void
{
/*
* Copy the given format string into the result buffer, expanding
* %m as we go. If the result buffer is too short, complain and
* truncate the message. (We don't expect this to ever happen,
* though.)
*/
break;
}
/*
* If there's an error message and room to display
* it, copy it in. If there's no message or not
* enough room, try just printing an error number.
* (We assume that the error value is in a
* reasonable range.) If there's no room for
* anything, bail out.
*/
buf_chars) {
/*
* Don't try to guess how many characters
* were laid down.
*/
} else {
break;
}
from++;
} else {
}
}
*to = '\0';
}
/*
* nfs_strerror: map an errno value to a string. Not all possible errno
* values are supported.
*
* If there is no string for the given errno value, return NULL.
*/
static char *
{
char *result;
switch (errcode) {
case EPERM:
result = "Not owner";
break;
case ENOENT:
result = "No such file or directory";
break;
case EIO:
result = "I/O error";
break;
case EACCES:
result = "Permission denied";
break;
case EEXIST:
result = "File exists";
break;
case ENOTDIR:
result = "Not a directory";
break;
case EISDIR:
result = "Is a directory";
break;
case EINVAL:
result = "Invalid argument";
break;
case EFBIG:
result = "File too large";
break;
case ENOSPC:
result = "No space left on device";
break;
case EROFS:
result = "Read-only file system";
break;
case EDQUOT:
result = "Disc quota exceeded";
break;
case ENOTEMPTY:
result = "Directory not empty";
break;
case ESTALE:
result = "Stale NFS file handle";
break;
case ENOMEM:
result = "Not enough memory";
break;
default:
break;
}
return (result);
}