// SPDX-License-Identifier: MPL-2.0 #ifndef SH_LIB_STATUS_H #define SH_LIB_STATUS_H #include "std/type.h" typedef sh_int64 SH_STATUS; #define SH_STATUS_NEW_SLAB_ADDED -5LL #define SH_STATUS_VA_FULLY_MAPPED -4LL #define SH_STATUS_VA_PARTIALLY_MAPPED -3LL #define SH_STATUS_VA_NOT_MAPPED -2LL #define SH_STATUS_VA_MAPPED -1LL #define SH_STATUS_SUCCESS 0LL #define SH_STATUS_INVALID_PARAMETER 1LL #define SH_STATUS_MEM_NOT_EQUAL 2LL #define SH_STATUS_INVALID_SIGNATURE 3LL #define SH_STATUS_MMAP_BUFFER_OVERFLOW 4LL #define SH_STATUS_PMAP_NO_PAGES_SET 5LL #define SH_STATUS_PT_POOL_NO_BITMAP_INIT 6LL #define SH_STATUS_PT_POOL_NO_PAGE_SET 7LL #define SH_STATUS_OUT_OF_MEMORY 8LL #define SH_STATUS_INVALID_INTERNAL_PA 9LL #define SH_STATUS_KERNEL_PANIC 10LL #define SH_STATUS_PTP_FULL 11LL #define SH_STATUS_ERROR_VA_FULLY_MAPPED 12LL #define SH_STATUS_ERROR_VA_PARTIALLY_MAPPED 13LL #define SH_STATUS_ERROR_VA_NOT_MAPPED 14LL #define SH_STATUS_SLAB_ALLOCATOR_FULL 15LL #define SH_STATUS_NOT_FOUND 16LL #define SH_STATUS_RESCAN_NEEDED 17LL #define SH_STATUS_ERROR_NULLPTR_RETURNED 18LL #define SH_STATUS_ERROR_PEZ_INITIALIZED 19LL #define SH_STATUS_SLAB_SLOT_ALREADY_FREE 20LL #define SH_STATUS_TEST_FAILED 21LL #define SH_STATUS_PBA_FULL 22LL #define SH_STATUS_FOUND_CORRUPTED_SLAB 23LL #define SH_STATUS_PEZ_CORRUPTED 24LL #define SH_STATUS_PAGE_ALREADY_FREE 25LL #define SH_STATUS_TOO_MUCH_DATA 26LL #define SH_STATUS_HEAP_NOT_INITIALIZED 27LL // Return SH_TRUE if provided status is an error static inline sh_bool sh_status_error(SH_STATUS s) { return s>=SH_STATUS_INVALID_PARAMETER; } #endif