My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
task.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * Helper function declarations of task management
25  */
26 
27 #ifndef __OTZ_TASK_H__
28 #define __OTZ_TASK_H__
29 
30 #include <sw_types.h>
31 #include <sw_list.h>
32 #include <otz_common.h>
33 #include <cpu_task.h>
34 #include <sw_wait.h>
35 
40 typedef struct sa_config_t
41 {
45  char service_name[32];
48 /* Name of the entry function */
49  char entry_func[32];
54  u32 elf_flag;
56  char file_path[255];
58  char process_name[32];
59 /* service func pointer */
60  int (*process)(u32 ,void*, u32,void*,u32, struct otzc_encode_meta *, u32*);
62  void* data;
64 
65 
74 };
75 
79 typedef struct sw_tls
80 {
83  pa_t params[4];
85  u32 ret_val;
89  int elf_flag;
91  int (*process)(u32 svc_cmd_id,void *req_buf, u32 req_buf_len,
92  void *resp_buf, u32 resp_buf_len, struct otzc_encode_meta *
93  meta_data, u32 *ret_res_buf_len);
95  void *private_data;
96 }sw_tls;
97 
101 typedef struct user_access_control{
102  char *username; //task name;
103  u32 uid; //user id
104  u32 gid; //group id
105 }acl_t;
106 
107 
111 struct sw_task {
112  struct list head;
113  struct list ready_head;
116  u32 task_id;
122  char name[32];
124  u32 state;
126  void* task_sp;
137 };
138 
139 
154 int create_task(sa_config_t *psa_config, int *task_id);
155 
168 int destroy_task(int task_id);
169 
183 int start_task(int task_id, pa_t* params);
184 
194 void task_context_switch(struct sw_task *new_task, struct sw_task *old_task, void *regs);
195 
207 int get_task_state(int task_id);
208 
209 
219 int print_task(int task_id);
220 
229 void resume_async_task(int task_id);
230 
240 sw_tls* get_task_tls(int task_id);
241 
251 struct sw_task* get_task(int task_id);
252 #endif /* __OTZ_TASK_H__ */
struct sw_task * get_task(int task_id)
Helper function to return task structure.
Definition: task.c:432
struct list head
Definition: task.h:112
Definition: task.h:71
Task local storage.
Definition: task.h:79
char * username
Definition: task.h:102
char entry_func[32]
Definition: task.h:49
int start_task(int task_id, pa_t *params)
Start the task.
Definition: task.c:243
struct wait_queue_head wq_head
Definition: task.h:134
char process_name[32]
Definition: task.h:58
Task registers context.
Definition: cpu_task.h:33
Definition: task.h:101
void * private_data
Definition: task.h:95
struct sw_task_cpu_regs regs
Definition: task.h:132
int get_task_state(int task_id)
Get task state.
Definition: task.c:320
Secure API configuration details for task.
Definition: task.h:40
struct list ready_head
Definition: task.h:113
u32 ipi_ret_val
Definition: task.h:87
Definition: task.h:72
struct list pending_head
Definition: task.h:114
u32 task_sp_size
Definition: task.h:128
struct sw_tls sw_tls
Task local storage.
int create_task(sa_config_t *psa_config, int *task_id)
Create a task.
Definition: task.c:52
int print_task(int task_id)
Helper function to print the task context.
Definition: task.c:357
char service_name[32]
Definition: task.h:45
acl_t acl
Definition: task.h:136
struct sa_config_t sa_config_t
Secure API configuration details for task.
void task_context_switch(struct sw_task *new_task, struct sw_task *old_task, void *regs)
Task context switch function.
Definition: task.c:300
int(* process)(u32 svc_cmd_id, void *req_buf, u32 req_buf_len, void *resp_buf, u32 resp_buf_len, struct otzc_encode_meta *meta_data, u32 *ret_res_buf_len)
Definition: task.h:91
char name[32]
Definition: task.h:122
u32 ret_val
Definition: task.h:85
pa_t params[4]
Definition: task.h:83
int destroy_task(int task_id)
Destroy the created task.
Definition: task.c:160
Metadata used for encoding/decoding.
Definition: otz_common.h:93
u32 state
Definition: task.h:124
pa_t entry_addr
Definition: task.h:120
sw_tls * get_task_tls(int task_id)
Get task local storage.
Definition: task.c:395
Wait queue list head. Wait queue elements are added to this.
Definition: sw_wait.h:60
Definition: task.h:73
pa_t entry_point
Definition: task.h:52
char file_path[255]
Definition: task.h:56
struct user_access_control acl_t
void * data
Definition: task.h:62
Task structure.
Definition: task.h:111
int(* process)(u32, void *, u32, void *, u32, struct otzc_encode_meta *, u32 *)
Definition: task.h:60
u32 elf_flag
Definition: task.h:54
Definition: task.h:70
Definition: sw_list.h:56
int service_uuid
Definition: task.h:43
task_state_e
Task state constants.
Definition: task.h:69
u32 uid
Definition: task.h:103
void resume_async_task(int task_id)
This functions wakes up a task from sleep. It is used for async tasks.
Definition: task.c:224
sw_tls * tls
Definition: task.h:130
void * task_sp
Definition: task.h:126
u32 stack_size
Definition: task.h:47
u32 task_id
Definition: task.h:116
u32 gid
Definition: task.h:104
u32 service_id
Definition: task.h:118
int elf_flag
Definition: task.h:89