diff options
author | Stephen Cprek <smcprek@us.ibm.com> | 2017-04-06 17:08:15 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-04-10 17:57:10 -0400 |
commit | 5afa41551b3d8e0a84cf21cebfc89a194d326e76 (patch) | |
tree | 27018d5dc7aa801fee3e77af6be9c7693a178aa3 /src/include/errno.h | |
parent | dee1ed49ad08fdb4b91775f50f65e69ad5bbfafa (diff) | |
download | talos-hostboot-5afa41551b3d8e0a84cf21cebfc89a194d326e76.tar.gz talos-hostboot-5afa41551b3d8e0a84cf21cebfc89a194d326e76.zip |
Add map list initialization and at() methods
Also add ErrnoToString() as a test which is a functionality
ported from p8
Change-Id: Ia6dd9b37638af2634267e224d9b97133bf984fb4
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38956
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include/errno.h')
-rw-r--r-- | src/include/errno.h | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/include/errno.h b/src/include/errno.h index 9e75d50fe..3817fd4bc 100644 --- a/src/include/errno.h +++ b/src/include/errno.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -27,9 +27,6 @@ #include <map> -// Map to to store strings of errorno codes -typedef std::map<int, const char*> ErrorNoNames; - #define ENOENT 2 // No such file or directory #define EIO 5 // I/O error #define ENXIO 6 // No such device or address @@ -46,27 +43,16 @@ typedef std::map<int, const char*> ErrorNoNames; #define EWOULDBLOCK EAGAIN // operation would block -// @Brief Initialize an ErrorNoNames map -// Note: All keys and values are preceded with a '-', this is because the -// the errno's will be set to 2's complement when there's an error. -inline ErrorNoNames init_map() -{ - ErrorNoNames l_map; - l_map[-ENOENT] = "-ENOENT"; - l_map[-EIO] = "-EIO"; - l_map[-ENXIO] = "-ENXIO"; - l_map[-ENOEXEC] = "-ENOEXEC"; - l_map[-EBADF] = "-EBADF"; - l_map[-EAGAIN] = "-EAGAIN"; - l_map[-EACCES] = "-EACCES"; - l_map[-EFAULT] = "-EFAULT"; - l_map[-EINVAL] = "-EINVAL"; - l_map[-ENFILE] = "-ENFILE"; - l_map[-EDEADLK] = "-EDEADLK"; - l_map[-ETIME] = "-ETIME"; - l_map[-EALREADY] = "-EALREADY"; - l_map[-EWOULDBLOCK] = "-EWOULDBLOCK"; - return l_map; -}; +/** + * @brief Returns string representation of an errno. + * + * @param[in] i_errno errno to get string for. + * + * @return const char* - If found, String associated with errno + * else, "UNKNOWN" string + * +*/ +const char * ErrnoToString( int i_errno ); + #endif |