2 * Copyright (c) 2014, STMicroelectronics International N.V.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
28 #ifndef TEE_SVC_STORAGE_H
29 #define TEE_SVC_STORAGE_H
31 #include <tee_api_types.h>
32 #include <kernel/tee_ta_manager.h>
33 #include <tee/tee_fs.h>
36 * Persistant Object Functions
38 TEE_Result syscall_storage_obj_open(unsigned long storage_id, void *object_id,
39 size_t object_id_len, unsigned long flags,
42 TEE_Result syscall_storage_obj_create(unsigned long storage_id, void *object_id,
43 size_t object_id_len, unsigned long flags,
44 unsigned long attr, void *data, size_t len,
47 TEE_Result syscall_storage_obj_del(unsigned long obj);
49 TEE_Result syscall_storage_obj_rename(unsigned long obj, void *object_id,
50 size_t object_id_len);
53 * Persistent Object Enumeration Functions
55 TEE_Result syscall_storage_alloc_enum(uint32_t *obj_enum);
57 TEE_Result syscall_storage_free_enum(unsigned long obj_enum);
59 TEE_Result syscall_storage_reset_enum(unsigned long obj_enum);
61 TEE_Result syscall_storage_start_enum(unsigned long obj_enum,
62 unsigned long storage_id);
64 TEE_Result syscall_storage_next_enum(unsigned long obj_enum,
65 TEE_ObjectInfo *info, void *obj_id, uint64_t *len);
68 * Data Stream Access Functions
70 TEE_Result syscall_storage_obj_read(unsigned long obj, void *data, size_t len,
73 TEE_Result syscall_storage_obj_write(unsigned long obj, void *data,
76 TEE_Result syscall_storage_obj_trunc(unsigned long obj, size_t len);
78 TEE_Result syscall_storage_obj_seek(unsigned long obj, int32_t offset,
79 unsigned long whence);
81 void tee_svc_storage_close_all_enum(struct user_ta_ctx *utc);
83 void tee_svc_storage_init(void);
85 char *tee_svc_storage_create_filename(struct tee_ta_session *sess,
87 uint32_t object_id_len,
90 char *tee_svc_storage_create_dirname(struct tee_ta_session *sess);
92 #endif /* TEE_SVC_STORAGE_H */