1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2016, Linaro Limited
4  */
5 
6 /*
7  * Interface with tee-supplicant for file operations
8  */
9 
10 #ifndef TEE_FS_RPC_H
11 #define TEE_FS_RPC_H
12 
13 #include <stdbool.h>
14 #include <stddef.h>
15 #include <tee_api_types.h>
16 #include <tee/tee_fs.h>
17 #include <kernel/thread.h>
18 
19 struct tee_fs_rpc_operation {
20 	uint32_t id;
21 	struct thread_param params[THREAD_RPC_MAX_NUM_PARAMS];
22 	size_t num_params;
23 };
24 
25 struct tee_fs_dirfile_fileh;
26 
27 TEE_Result tee_fs_rpc_open_dfh(uint32_t id,
28 			       const struct tee_fs_dirfile_fileh *dfh, int *fd);
29 TEE_Result tee_fs_rpc_create_dfh(uint32_t id,
30 				 const struct tee_fs_dirfile_fileh *dfh,
31 				 int *fd);
32 TEE_Result tee_fs_rpc_close(uint32_t id, int fd);
33 
34 TEE_Result tee_fs_rpc_read_init(struct tee_fs_rpc_operation *op,
35 				uint32_t id, int fd, tee_fs_off_t offset,
36 				size_t data_len, void **out_data);
37 TEE_Result tee_fs_rpc_read_final(struct tee_fs_rpc_operation *op,
38 				 size_t *data_len);
39 
40 TEE_Result tee_fs_rpc_write_init(struct tee_fs_rpc_operation *op,
41 				 uint32_t id, int fd, tee_fs_off_t offset,
42 				 size_t data_len, void **data);
43 TEE_Result tee_fs_rpc_write_final(struct tee_fs_rpc_operation *op);
44 
45 
46 TEE_Result tee_fs_rpc_truncate(uint32_t id, int fd, size_t len);
47 TEE_Result tee_fs_rpc_remove_dfh(uint32_t id,
48 				 const struct tee_fs_dirfile_fileh *dfh);
49 #endif /* TEE_FS_RPC_H */
50