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(uint32_t id, struct tee_pobj *po, int *fd); 28 TEE_Result tee_fs_rpc_open_dfh(uint32_t id, 29 const struct tee_fs_dirfile_fileh *dfh, int *fd); 30 TEE_Result tee_fs_rpc_create(uint32_t id, struct tee_pobj *po, int *fd); 31 TEE_Result tee_fs_rpc_create_dfh(uint32_t id, 32 const struct tee_fs_dirfile_fileh *dfh, 33 int *fd); 34 TEE_Result tee_fs_rpc_close(uint32_t id, int fd); 35 36 TEE_Result tee_fs_rpc_read_init(struct tee_fs_rpc_operation *op, 37 uint32_t id, int fd, tee_fs_off_t offset, 38 size_t data_len, void **out_data); 39 TEE_Result tee_fs_rpc_read_final(struct tee_fs_rpc_operation *op, 40 size_t *data_len); 41 42 TEE_Result tee_fs_rpc_write_init(struct tee_fs_rpc_operation *op, 43 uint32_t id, int fd, tee_fs_off_t offset, 44 size_t data_len, void **data); 45 TEE_Result tee_fs_rpc_write_final(struct tee_fs_rpc_operation *op); 46 47 48 TEE_Result tee_fs_rpc_truncate(uint32_t id, int fd, size_t len); 49 TEE_Result tee_fs_rpc_remove(uint32_t id, struct tee_pobj *po); 50 TEE_Result tee_fs_rpc_remove_dfh(uint32_t id, 51 const struct tee_fs_dirfile_fileh *dfh); 52 TEE_Result tee_fs_rpc_rename(uint32_t id, struct tee_pobj *old, 53 struct tee_pobj *new, bool overwrite); 54 55 TEE_Result tee_fs_rpc_opendir(uint32_t id, const TEE_UUID *uuid, 56 struct tee_fs_dir **d); 57 TEE_Result tee_fs_rpc_closedir(uint32_t id, struct tee_fs_dir *d); 58 TEE_Result tee_fs_rpc_readdir(uint32_t id, struct tee_fs_dir *d, 59 struct tee_fs_dirent **ent); 60 #endif /* TEE_FS_RPC_H */ 61