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_H 13 #define __SSA_FS_H 14 15 #include "tee_defines.h" 16 17 #define TRANS_BUFF_SIZE AGENT_BUFF_SIZE /* transfer buffer size, equal to teecd's buffer size */ 18 19 TEE_Result tee_fs_init(void *control); 20 void tee_fs_exit(void); 21 22 TEE_Result check_file_name(const char *name); 23 TEE_Result check_name_by_storageid(const char *obj_id, uint32_t obj_len, uint32_t storage_id); 24 25 void fs_set_serr(uint32_t ns_errno); 26 TEE_Result fs_get_serr(void); 27 int32_t ssa_fs_fopen(const char *name, uint32_t flag, uint32_t storage_id); 28 int32_t ssa_fs_fclose(int32_t fd); 29 uint32_t ssa_fs_fread(void *out_buf, uint32_t count, int32_t fd, int32_t *error); 30 uint32_t ssa_fs_fwrite(const void *content, uint32_t count, int32_t fd); 31 int32_t ssa_fs_fseek(int32_t fd, int32_t offset, uint32_t whence); 32 int32_t ssa_fs_fremove(const char *name, uint32_t storage_id); 33 int32_t ssa_fs_ftruncate(const char *name, uint32_t len, uint32_t storage_id); 34 int32_t ssa_fs_frename(const char *old_name, const char *new_name, uint32_t storage_id); 35 int32_t ssa_fs_fcreate(const char *name, uint32_t flag, uint32_t storage_id); 36 int32_t ssa_fs_finfo(int32_t fd, uint32_t *pos, uint32_t *len); 37 int32_t ssa_fs_faccess(const char *name, int mode, uint32_t storage_id); 38 int32_t ssa_fs_faccess2(const char *name, int mode); 39 int32_t ssa_fs_fcopy(const char *from_path, const char *to_path, uint32_t storage_id); 40 int32_t ssa_fs_fsync(int32_t fd); 41 uint32_t get_fs_meta_size(); 42 int32_t ssa_fs_delete_all(const char *path, uint32_t path_len); 43 int32_t ssa_fs_disk_usage(uint32_t *secure_remain, uint32_t *data_secure_remain); 44 #endif 45