/* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #include #include #include #include static const struct { char *uce_name; /* error name */ char *uce_msg; /* error message */ } _ucode_errstr[] = { /* * TRANSLATION_NOTE * The following message strings that begin with EM_ do not * need to be translated. */ { "EM_OK", "No error" }, { "EM_FILESIZE", "File size is invalid" }, { "EM_OPENFILE", "Failed to open file" }, { "EM_FILEFORMAT", "Not a valid microcode file" }, { "EM_HEADER", "File header is invalid" }, { "EM_CHECKSUM", "Checksum is invalid" }, { "EM_INVALIDARG", "Invalid argument(s)" }, { "EM_NOMATCH", "No matching microcode found" }, { "EM_HIGHERREV", "File does not contain higher revision microcode" }, { "EM_NOTSUP", "Processor does not support microcode operations" }, { "EM_UPDATE", "Failed to update to the latest revision" }, { "EM_SYS", "System call failed. See errno" }, { "EM_NOVENDOR", "File must start with vendor string" }, { "EM_NOMEM", "Not enough memory" }, }; static int _ucode_nerrno = sizeof (_ucode_errstr) / sizeof (_ucode_errstr[0]); const char * ucode_strerror(ucode_errno_t errno) { return (errno < 0 || errno >= _ucode_nerrno ? gettext("unknown error") : gettext(_ucode_errstr[errno].uce_msg)); } const char * ucode_errname(ucode_errno_t errno) { return (errno < 0 || errno >= _ucode_nerrno ? NULL : gettext(_ucode_errstr[errno].uce_name)); }