2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2016-05-08 22:55:17 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Samsung Electronics
|
|
|
|
* Przemyslaw Marczak <p.marczak@samsung.com>
|
|
|
|
*/
|
2010-06-11 22:19:46 +00:00
|
|
|
#ifndef _ERRNO_H
|
2016-05-08 22:55:17 +00:00
|
|
|
#define _ERRNO_H
|
2010-06-11 22:19:46 +00:00
|
|
|
|
2016-09-21 02:28:57 +00:00
|
|
|
#include <linux/errno.h>
|
2010-06-11 22:19:46 +00:00
|
|
|
|
2021-05-20 11:24:05 +00:00
|
|
|
#ifdef __SANDBOX__
|
|
|
|
#define __errno_asm_label asm("__u_boot_errno")
|
|
|
|
#else
|
|
|
|
#define __errno_asm_label
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern int errno __errno_asm_label;
|
2010-06-11 22:19:46 +00:00
|
|
|
|
|
|
|
#define __set_errno(val) do { errno = val; } while (0)
|
|
|
|
|
2019-10-06 11:58:57 +00:00
|
|
|
/**
|
|
|
|
* errno_str() - get description for error number
|
|
|
|
*
|
|
|
|
* @errno: error number (negative in case of error)
|
|
|
|
* Return: string describing the error. If CONFIG_ERRNO_STR is not
|
|
|
|
* defined an empty string is returned.
|
|
|
|
*/
|
2022-02-28 19:08:21 +00:00
|
|
|
#if CONFIG_IS_ENABLED(ERRNO_STR)
|
2014-10-08 20:48:37 +00:00
|
|
|
const char *errno_str(int errno);
|
2016-05-08 22:55:18 +00:00
|
|
|
#else
|
2019-10-06 11:58:57 +00:00
|
|
|
static const char error_message[] = "";
|
|
|
|
|
2016-05-08 22:55:18 +00:00
|
|
|
static inline const char *errno_str(int errno)
|
|
|
|
{
|
2019-10-06 11:58:57 +00:00
|
|
|
return error_message;
|
2016-05-08 22:55:18 +00:00
|
|
|
}
|
2014-10-08 20:48:37 +00:00
|
|
|
#endif
|
2010-06-11 22:19:46 +00:00
|
|
|
#endif /* _ERRNO_H */
|