-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathprovider_file_memory.h
75 lines (60 loc) · 2.95 KB
/
provider_file_memory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Copyright (C) 2024-2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#ifndef UMF_FILE_MEMORY_PROVIDER_H
#define UMF_FILE_MEMORY_PROVIDER_H
#include <umf/providers/provider_os_memory.h>
#ifdef __cplusplus
extern "C" {
#endif
/// @cond
#define UMF_FILE_RESULTS_START_FROM 3000
/// @endcond
struct umf_file_memory_provider_params_t;
typedef struct umf_file_memory_provider_params_t
*umf_file_memory_provider_params_handle_t;
/// @brief Create a struct to store parameters of the File Memory Provider.
/// @param hParams [out] handle to the newly created parameters struct.
/// @param path path to the file.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFileMemoryProviderParamsCreate(
umf_file_memory_provider_params_handle_t *hParams, const char *path);
/// @brief Destroy parameters struct.
/// @param hParams handle to the parameters of the File Memory Provider.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFileMemoryProviderParamsDestroy(
umf_file_memory_provider_params_handle_t hParams);
/// @brief Set the path in the parameters struct.
/// @param hParams handle to the parameters of the File Memory Provider.
/// @param path path to the file.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFileMemoryProviderParamsSetPath(
umf_file_memory_provider_params_handle_t hParams, const char *path);
/// @brief Set the protection in the parameters struct.
/// @param hParams handle to the parameters of the File Memory Provider.
/// @param protection protection. Combination of \p umf_mem_protection_flags_t flags
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFileMemoryProviderParamsSetProtection(
umf_file_memory_provider_params_handle_t hParams, unsigned protection);
/// @brief Set the visibility in the parameters struct.
/// @param hParams handle to the parameters of the File Memory Provider.
/// @param visibility memory visibility mode.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFileMemoryProviderParamsSetVisibility(
umf_file_memory_provider_params_handle_t hParams,
umf_memory_visibility_t visibility);
/// @brief File Memory Provider operation results
typedef enum umf_file_memory_provider_native_error {
UMF_FILE_RESULT_SUCCESS = UMF_FILE_RESULTS_START_FROM, ///< Success
UMF_FILE_RESULT_ERROR_ALLOC_FAILED, ///< Memory allocation failed
UMF_FILE_RESULT_ERROR_FREE_FAILED, ///< Memory deallocation failed
UMF_FILE_RESULT_ERROR_PURGE_FORCE_FAILED, ///< Force purging failed
} umf_file_memory_provider_native_error_t;
const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void);
#ifdef __cplusplus
}
#endif
#endif /* UMF_FILE_MEMORY_PROVIDER_H */