1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 #ifndef __SSA_FS_ERRDEF_H 13 #define __SSA_FS_ERRDEF_H 14 15 #include "tee_defines.h" 16 17 #define EPERM 1 18 #define ENOENT 2 19 #define EINTR 4 20 #define EIO 5 21 #define EBADF 9 22 #define EAGAIN 11 23 #define ENOMEM 12 24 #define EACCES 13 25 #define ENOTDIR 20 26 #define EISDIR 21 27 #define EINVAL 22 28 #define ENFILE 23 29 #define EMFILE 24 30 #define EFBIG 27 31 #define ENOSPC 28 32 #define EROFS 30 33 #define ENAMETOOLONG 36 34 #define EOVERFLOW 75 35 #define ESTORAGEDEAD 200 36 #define EFCORRUPT 201 37 38 struct errno_map_type { 39 uint32_t ns_errno; 40 TEE_Result s_errno; 41 const char *msg; 42 }; 43 44 static const struct errno_map_type g_fs_error_strings[] = { 45 { 0, TEE_SUCCESS, "Success" }, 46 { EPERM, TEE_ERROR_ACCESS_DENIED, "Operation not permitted" }, 47 { ENOENT, TEE_ERROR_ITEM_NOT_FOUND, "No such file or directory" }, 48 { EINTR, TEE_ERROR_EXTERNAL_CANCEL, "Interrupted system call" }, 49 { EIO, TEE_ERROR_STORAGE_EIO, "I/O error" }, 50 { EBADF, TEE_ERROR_BAD_PARAMETERS, "Bad file number" }, 51 { EAGAIN, TEE_ERROR_STORAGE_EAGAIN, "Try again" }, 52 { ENOMEM, TEE_ERROR_OUT_OF_MEMORY, "Out of memory" }, 53 { EACCES, TEE_ERROR_ACCESS_DENIED, "Permission denied" }, 54 { ENOTDIR, TEE_ERROR_STORAGE_ENOTDIR, "Not a directory" }, 55 { EISDIR, TEE_ERROR_STORAGE_EISDIR, "Is a directory" }, 56 { EINVAL, TEE_ERROR_BAD_PARAMETERS, "Invalid argument" }, 57 { ENFILE, TEE_ERROR_STORAGE_ENFILE, "File table overflow" }, 58 { EMFILE, TEE_ERROR_STORAGE_EMFILE, "Too many open files" }, 59 { EFBIG, TEE_ERROR_OVERFLOW, "File too large" }, 60 { ENOSPC, TEE_ERROR_STORAGE_NO_SPACE, "No space left on device" }, 61 { EROFS, TEE_ERROR_STORAGE_EROFS, "Read-only file system" }, 62 { ENAMETOOLONG, TEE_ERROR_BAD_PARAMETERS, "File name too long" }, 63 { EOVERFLOW, TEE_ERROR_OVERFLOW, "Value too large for defined data type" }, 64 { ESTORAGEDEAD, TEE_ERROR_STORAGE_NOT_AVAILABLE, "Secure storage died" }, 65 { EFCORRUPT, TEE_ERROR_CORRUPT_OBJECT, "Object corruptted" }, 66 { 0, TEE_SUCCESS, NULL }, 67 }; 68 #endif 69