1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 */ 5 6 #ifndef TEE_POBJ_H 7 #define TEE_POBJ_H 8 9 #include <stdint.h> 10 #include <sys/queue.h> 11 #include <tee_api_types.h> 12 #include <tee/tee_fs.h> 13 14 struct tee_pobj { 15 TAILQ_ENTRY(tee_pobj) link; 16 uint32_t refcnt; 17 TEE_UUID uuid; 18 void *obj_id; 19 uint32_t obj_id_len; 20 uint32_t flags; 21 bool temporary; /* can be changed while creating == true */ 22 bool creating; /* can only be changed with mutex held */ 23 /* Filesystem handling this object */ 24 const struct tee_file_operations *fops; 25 }; 26 27 enum tee_pobj_usage { 28 TEE_POBJ_USAGE_OPEN, 29 TEE_POBJ_USAGE_RENAME, 30 TEE_POBJ_USAGE_CREATE, 31 TEE_POBJ_USAGE_ENUM, 32 }; 33 34 TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len, 35 uint32_t flags, enum tee_pobj_usage usage, 36 const struct tee_file_operations *fops, 37 struct tee_pobj **obj); 38 39 void tee_pobj_create_final(struct tee_pobj *obj); 40 41 TEE_Result tee_pobj_release(struct tee_pobj *obj); 42 43 TEE_Result tee_pobj_rename(struct tee_pobj *obj, void *obj_id, 44 uint32_t obj_id_len); 45 46 #endif 47