diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2014-10-08 22:48:37 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-12-11 13:18:41 -0700 |
commit | 59345b1f0f9941d32b45d0e27401355b34106357 (patch) | |
tree | cf1af3b0281bf8962f503bfebca60b3e6fddbe4d /include/errno.h | |
parent | 115066666c251c2a481eeff7b700da14eba91d10 (diff) | |
download | u-boot-59345b1f0f9941d32b45d0e27401355b34106357.tar.gz u-boot-59345b1f0f9941d32b45d0e27401355b34106357.tar.bz2 u-boot-59345b1f0f9941d32b45d0e27401355b34106357.zip |
lib: errno: introduce errno_str(): returns errno related message
The functions error's numbers are standarized - but the error
messages are not.
The errors are often handled with unclear error messages,
so why not use an errno standarized messages.
Advantages:
- This could decrease the binary size.
- Appended with a detailed information,
the error message will be clear.
This commit introduces new function:
- const char *errno_to_str(int errno)
The functions returns a pointer to the errno corresponding text message:
- if errno is null or positive number - a pointer to "Success" message
- if errno is negative - a pointer to errno related message
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'include/errno.h')
-rw-r--r-- | include/errno.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/errno.h b/include/errno.h index e24a33b386..14ac3cb10b 100644 --- a/include/errno.h +++ b/include/errno.h @@ -6,4 +6,7 @@ extern int errno; #define __set_errno(val) do { errno = val; } while (0) +#ifdef CONFIG_ERRNO_STR +const char *errno_str(int errno); +#endif #endif /* _ERRNO_H */ |