File: tee_pobj.h

package info (click to toggle)
optee-os 4.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,960 kB
  • sloc: ansic: 444,388; asm: 12,922; python: 3,719; makefile: 1,681; sh: 238
file content (54 lines) | stat: -rw-r--r-- 1,338 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (c) 2014, STMicroelectronics International N.V.
 */

#ifndef __TEE_TEE_POBJ_H
#define __TEE_TEE_POBJ_H

#include <stdint.h>
#include <sys/queue.h>
#include <tee_api_types.h>
#include <tee/tee_fs.h>

struct tee_pobj {
	TAILQ_ENTRY(tee_pobj) link;
	uint32_t refcnt;
	TEE_UUID uuid;
	void *obj_id;
	uint32_t obj_id_len;
	uint32_t flags;
	uint32_t obj_info_usage;
	bool temporary;	/* can be changed while creating == true */
	bool creating;	/* can only be changed with mutex held */
	/* Filesystem handling this object */
	const struct tee_file_operations *fops;
};

enum tee_pobj_usage {
	TEE_POBJ_USAGE_OPEN,
	TEE_POBJ_USAGE_RENAME,
	TEE_POBJ_USAGE_CREATE,
	TEE_POBJ_USAGE_ENUM,
};

TEE_Result tee_pobj_get(TEE_UUID *uuid, void *obj_id, uint32_t obj_id_len,
			uint32_t flags, enum tee_pobj_usage usage,
			const struct tee_file_operations *fops,
			struct tee_pobj **obj);

void tee_pobj_create_final(struct tee_pobj *obj);

TEE_Result tee_pobj_release(struct tee_pobj *obj);

TEE_Result tee_pobj_rename(struct tee_pobj *obj, void *obj_id,
			   uint32_t obj_id_len);

/*
 * Locks and unlocks a mutex intended to protect the obj_info_usage field
 * in struct tee_pobj.
 */
void tee_pobj_lock_usage(struct tee_pobj *obj);
void tee_pobj_unlock_usage(struct tee_pobj *obj);

#endif