update controller code
This commit is contained in:
parent
2836d196da
commit
41f56fa6ed
54 changed files with 9688 additions and 214 deletions
|
|
@ -106,14 +106,14 @@ void dataq_fini(dataq_t* q)
|
|||
{
|
||||
data_item_t* it;
|
||||
while ((it = dataq_deq_head(q)) != NULL) {
|
||||
if (q->killer != NULL) {
|
||||
if (q->killer != NULL) {
|
||||
(q->killer)(it);
|
||||
}
|
||||
// Note: dataq_deq_head already isolates 'it' (it->next = NULL)
|
||||
}
|
||||
|
||||
q->head = q->tail = NULL; // Explicitly set just in case.
|
||||
q->killer = NULL;
|
||||
|
||||
q->killer = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ int xce_add_hook(hooksys_t* s,
|
|||
int xce_run_hooks(hooksys_t* s,
|
||||
int type,
|
||||
int situation,
|
||||
int detail,
|
||||
int detail,
|
||||
...)
|
||||
{
|
||||
xlist_t* l;
|
||||
|
|
@ -84,17 +84,17 @@ int xce_run_hooks(hooksys_t* s,
|
|||
|
||||
for (i = 0; i < l->count; i++) {
|
||||
hook_item_t* it = l->data[i];
|
||||
va_list ap;
|
||||
va_list ap;
|
||||
|
||||
if (it == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
va_start(ap, detail);
|
||||
va_start(ap, detail);
|
||||
rc = (*(it->fn))(type, situation, detail,
|
||||
it->data, ap);
|
||||
va_end(ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
if ((situation == HOOK_BEFORE_EVENT) && (rc < 0)) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -103,10 +103,11 @@ int xce_run_hooks(hooksys_t* s,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int free_hook_item(void *data1,
|
||||
void *data2) {
|
||||
static int free_hook_item(void* data1,
|
||||
void* data2)
|
||||
{
|
||||
if (data1 == NULL) {
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
free(data1);
|
||||
|
|
@ -126,9 +127,9 @@ void xce_hook_fini(hooksys_t* s)
|
|||
}
|
||||
|
||||
for (i = 0; i < s->maxtypes; i++) {
|
||||
xlist_iter(&(s->hooks[i]),
|
||||
(xlist_iter_fn_t)free_hook_item,
|
||||
NULL);
|
||||
xlist_iter(&(s->hooks[i]),
|
||||
(xlist_iter_fn_t)free_hook_item,
|
||||
NULL);
|
||||
xlist_fini(&(s->hooks[i]));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,41 +171,46 @@ int cbuf_get(cbuf_t* b,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int my_rwlock_init(my_rwlock_t *l) {
|
||||
if ( l == NULL) {
|
||||
return -EINVAL;
|
||||
int my_rwlock_init(my_rwlock_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return pthread_rwlock_init(l, NULL);
|
||||
}
|
||||
|
||||
void my_rwlock_fini(my_rwlock_t *l) {
|
||||
void my_rwlock_fini(my_rwlock_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_rwlock_destroy(l);
|
||||
}
|
||||
|
||||
int my_rwlock_unlock(my_rwlock_t *l) {
|
||||
if (l == NULL) {
|
||||
return -EINVAL;
|
||||
int my_rwlock_unlock(my_rwlock_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return pthread_rwlock_unlock(l);
|
||||
}
|
||||
|
||||
int my_rwlock_rlock(my_rwlock_t *l) {
|
||||
int my_rwlock_rlock(my_rwlock_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return pthread_rwlock_rdlock(l);
|
||||
}
|
||||
|
||||
int my_rwlock_wlock(my_rwlock_t *l) {
|
||||
if (l==NULL) {
|
||||
return -EINVAL;
|
||||
int my_rwlock_wlock(my_rwlock_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return pthread_rwlock_wrlock(l);
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ int iomgr_stop(iomgr_t* iomgr)
|
|||
if (iomgr->worker == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
rc = pthread_cancel(iomgr->worker);
|
||||
if (rc != 0) {
|
||||
SET_ERROR(errno);
|
||||
|
|
|
|||
|
|
@ -309,14 +309,15 @@ int objmgr_set_default(objmgr_t* mgr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
myobj_t *obj_alloc(size_t size) {
|
||||
myobj_t *obj;
|
||||
|
||||
myobj_t* obj_alloc(size_t size)
|
||||
{
|
||||
myobj_t* obj;
|
||||
|
||||
if (size <= 0) {
|
||||
SET_ERROR(EINVAL);
|
||||
return NULL;
|
||||
SET_ERROR(EINVAL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj = (myobj_t *)calloc(1, sizeof(*obj) + size);
|
||||
obj = (myobj_t*)calloc(1, sizeof(*obj) + size);
|
||||
return obj;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ int xce_reply_with_ctx(ioctx_t* ctx,
|
|||
TRACE("%s seq %lu opcode %d status %d data which %d",
|
||||
__func__, reply->seq, reply->opcode,
|
||||
reply->status, reply->data_which);
|
||||
|
||||
|
||||
request.from = from;
|
||||
request.body.replymsg = reply;
|
||||
|
||||
|
|
@ -629,7 +629,7 @@ int extract_data(dataset_t* dataset,
|
|||
int count = 0;
|
||||
|
||||
TRACE("%s ...", __func__);
|
||||
|
||||
|
||||
switch (getdata->table) {
|
||||
case Data_data_schedjobs:
|
||||
case Data_data_jobs:
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "xce/errnox.h"
|
||||
#include "utils.h"
|
||||
#include "xce/errnox.h"
|
||||
|
||||
static void test_error_setget(void) {
|
||||
int myerrno =1;
|
||||
ectx_t *e;
|
||||
static void test_error_setget(void)
|
||||
{
|
||||
int myerrno = 1;
|
||||
ectx_t* e;
|
||||
|
||||
SET_ERROR(myerrno);
|
||||
e = get_ectx();
|
||||
|
|
@ -34,7 +35,8 @@ static void test_strerror_r(void) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
void test_error(void) {
|
||||
void test_error(void)
|
||||
{
|
||||
printf("\n>> error test\n\n");
|
||||
|
||||
RUN_TEST(test_error_setget);
|
||||
|
|
|
|||
|
|
@ -2,48 +2,52 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <unity/unity.h>
|
||||
#include "htab.h"
|
||||
#include <unity/unity.h>
|
||||
|
||||
static htab_t htab;
|
||||
static char *s = "Hello,world";
|
||||
static char* s = "Hello,world";
|
||||
|
||||
static void test_ht_add_string(void) {
|
||||
hent_t *e = NULL;
|
||||
static void test_ht_add_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
e = ht_add(&(htab), (void *)s);
|
||||
e = ht_add(&(htab), (void*)s);
|
||||
TEST_ASSERT_NOT_NULL(e);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void test_ht_get_string(void) {
|
||||
hent_t *e = NULL;
|
||||
static void test_ht_get_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
e = ht_get(&htab, (void *)s);
|
||||
e = ht_get(&htab, (void*)s);
|
||||
TEST_ASSERT_NOT_NULL(e);
|
||||
|
||||
TEST_ASSERT_TRUE(0 == strcmp(e->key, s));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void test_ht_del_string(void) {
|
||||
hent_t *e = NULL;
|
||||
|
||||
ht_del(&htab, (void *)s);
|
||||
static void test_ht_del_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
ht_del(&htab, (void*)s);
|
||||
|
||||
e = ht_get(&htab, (void*)s);
|
||||
TEST_ASSERT_TRUE(e == NULL);
|
||||
|
||||
e = ht_get(&htab, (void *)s);
|
||||
TEST_ASSERT_TRUE( e == NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void test_ht_string(void) {
|
||||
void test_ht_string(void)
|
||||
{
|
||||
printf("\n>> htab test string\n\n");
|
||||
|
||||
ht_init(&htab, 13, string_hash_key);
|
||||
|
||||
|
||||
RUN_TEST(test_ht_add_string);
|
||||
RUN_TEST(test_ht_get_string);
|
||||
RUN_TEST(test_ht_del_string);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "htab.h"
|
||||
|
|
@ -10,42 +10,46 @@ static htab_t htab;
|
|||
|
||||
uint64_t key = (uint64_t)0xfabcde6666666666;
|
||||
|
||||
static void test_ht_add_string(void) {
|
||||
hent_t *e = NULL;
|
||||
static void test_ht_add_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
e = ht_add(&(htab), (void *)key);
|
||||
e = ht_add(&(htab), (void*)key);
|
||||
TEST_ASSERT_NOT_NULL(e);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void test_ht_get_string(void) {
|
||||
hent_t *e = NULL;
|
||||
static void test_ht_get_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
e = ht_get(&htab, (void *)key);
|
||||
e = ht_get(&htab, (void*)key);
|
||||
TEST_ASSERT_NOT_NULL(e);
|
||||
|
||||
TEST_ASSERT_TRUE((uint64_t)e->key == (uint64_t)key);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void test_ht_del_string(void) {
|
||||
hent_t *e = NULL;
|
||||
|
||||
ht_del(&htab, (void *)key);
|
||||
static void test_ht_del_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
ht_del(&htab, (void*)key);
|
||||
|
||||
e = ht_get(&htab, (void*)key);
|
||||
TEST_ASSERT_TRUE(e == NULL);
|
||||
|
||||
e = ht_get(&htab, (void *)key);
|
||||
TEST_ASSERT_TRUE( e == NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void test_ht_int(void) {
|
||||
void test_ht_int(void)
|
||||
{
|
||||
printf("\n>> htab test int\n\n");
|
||||
|
||||
ht_init(&htab, 13, int_hash_key);
|
||||
|
||||
|
||||
RUN_TEST(test_ht_add_string);
|
||||
RUN_TEST(test_ht_get_string);
|
||||
RUN_TEST(test_ht_del_string);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void test_xstring_create(void)
|
|||
myobj_t* obj;
|
||||
|
||||
objmgr_init(&mgr);
|
||||
register_xstring(&mgr,4,4);
|
||||
register_xstring(&mgr, 4, 4);
|
||||
TEST_ASSERT_EQUAL(1, mgr.types.count);
|
||||
|
||||
s2 = create_obj_by_typename(&mgr, "xstring", s1);
|
||||
|
|
@ -37,7 +37,7 @@ void test_xstring_ref(void)
|
|||
myobj_t* obj;
|
||||
|
||||
objmgr_init(&mgr);
|
||||
register_xstring(&mgr,4,4);
|
||||
register_xstring(&mgr, 4, 4);
|
||||
TEST_ASSERT_EQUAL(1, mgr.types.count);
|
||||
|
||||
s1 = create_obj_by_typename(&mgr, "xstring",
|
||||
|
|
@ -63,7 +63,7 @@ void test_xstring_deref(void)
|
|||
myobj_t* obj;
|
||||
|
||||
objmgr_init(&mgr);
|
||||
register_xstring(&mgr,4,4);
|
||||
register_xstring(&mgr, 4, 4);
|
||||
TEST_ASSERT_EQUAL(1, mgr.types.count);
|
||||
|
||||
s2 = create_obj_by_typename(&mgr, "xstring", s1);
|
||||
|
|
@ -73,12 +73,12 @@ void test_xstring_deref(void)
|
|||
|
||||
TEST_ASSERT_EQUAL(0, rc);
|
||||
if (rc == 0) {
|
||||
objtype_t *typeval;
|
||||
objtype_t* typeval;
|
||||
|
||||
obj = TO_MYOBJ(s2);
|
||||
typeval = obj->type;
|
||||
obj = TO_MYOBJ(s2);
|
||||
typeval = obj->type;
|
||||
|
||||
obj_deref(s2);
|
||||
obj_deref(s2);
|
||||
|
||||
TEST_ASSERT_EQUAL(0, XSTRING_TYPE_STRINGS(typeval).count);
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ void test_xstring_share(void)
|
|||
int rc = 0;
|
||||
|
||||
objmgr_init(&mgr);
|
||||
register_xstring(&mgr,4,4);
|
||||
register_xstring(&mgr, 4, 4);
|
||||
TEST_ASSERT_EQUAL(1, mgr.types.count);
|
||||
|
||||
s2 = create_obj_by_typename(&mgr, "xstring", s1);
|
||||
|
|
|
|||
|
|
@ -5,38 +5,41 @@
|
|||
|
||||
#include "zarray.h"
|
||||
|
||||
static void test_zarray_create(void) {
|
||||
static void test_zarray_create(void)
|
||||
{
|
||||
zarray_t array;
|
||||
|
||||
zarray_init(&array, 8, NULL);
|
||||
|
||||
TEST_ASSERT_EQUAL(0,array.count);
|
||||
TEST_ASSERT_EQUAL(0, array.count);
|
||||
TEST_ASSERT_NULL(array.data);
|
||||
}
|
||||
|
||||
static void test_zarray_store(void) {
|
||||
static void test_zarray_store(void)
|
||||
{
|
||||
zarray_t array;
|
||||
int idx;
|
||||
char *s1 = "hello";
|
||||
char *s2 = NULL;
|
||||
int idx;
|
||||
char* s1 = "hello";
|
||||
char* s2 = NULL;
|
||||
|
||||
zarray_init(&array, 8, NULL);
|
||||
idx = zarray_store(&array, (void *)s1);
|
||||
idx = zarray_store(&array, (void*)s1);
|
||||
TEST_ASSERT_TRUE(idx >= 0);
|
||||
s2 = (char *)zarray_get(&array, idx);
|
||||
s2 = (char*)zarray_get(&array, idx);
|
||||
TEST_ASSERT_NOT_NULL(s2);
|
||||
TEST_ASSERT_EQUAL(0, strcmp(s1, s2));
|
||||
|
||||
zarray_fini(&(array));
|
||||
}
|
||||
|
||||
static void test_zarray_del(void) {
|
||||
static void test_zarray_del(void)
|
||||
{
|
||||
zarray_t array;
|
||||
int idx;
|
||||
char *s1 = "hello";
|
||||
int idx;
|
||||
char* s1 = "hello";
|
||||
|
||||
zarray_init(&array, 8, NULL);
|
||||
idx = zarray_store(&array, (void *)s1);
|
||||
idx = zarray_store(&array, (void*)s1);
|
||||
TEST_ASSERT_TRUE(idx >= 0);
|
||||
TEST_ASSERT_TRUE(array.count == 1);
|
||||
zarray_del(&array, idx);
|
||||
|
|
@ -46,52 +49,56 @@ static void test_zarray_del(void) {
|
|||
zarray_fini(&array);
|
||||
}
|
||||
|
||||
static void test_zarray_put(void) {
|
||||
static void test_zarray_put(void)
|
||||
{
|
||||
zarray_t array;
|
||||
int idx;
|
||||
char *s1 = "hello";
|
||||
char *s2 = "test";
|
||||
int idx;
|
||||
char* s1 = "hello";
|
||||
char* s2 = "test";
|
||||
|
||||
zarray_init(&array, 8, NULL);
|
||||
idx = zarray_store(&array, (void *)s1);
|
||||
idx = zarray_store(&array, (void*)s1);
|
||||
TEST_ASSERT_TRUE(idx >= 0);
|
||||
TEST_ASSERT_TRUE(array.count == 1);
|
||||
TEST_ASSERT_TRUE(zarray_get(&array, idx) != NULL);
|
||||
|
||||
TEST_ASSERT_TRUE(strcmp((char *)zarray_get(&array, idx), s1) == 0);
|
||||
|
||||
zarray_put(&array, idx, (void *)s2);
|
||||
TEST_ASSERT_TRUE(strcmp((char*)zarray_get(&array, idx), s1) == 0);
|
||||
|
||||
zarray_put(&array, idx, (void*)s2);
|
||||
TEST_ASSERT_TRUE(zarray_get(&array, idx) != NULL);
|
||||
TEST_ASSERT_TRUE(strcmp((char *)zarray_get(&array, idx), s2) == 0);
|
||||
TEST_ASSERT_TRUE(strcmp((char*)zarray_get(&array, idx), s2) == 0);
|
||||
|
||||
zarray_fini(&array);
|
||||
}
|
||||
|
||||
static int sum_(void *arg1, void *arg2) {
|
||||
int *pv = (int *)arg1;
|
||||
int x = (int)((long)arg2);
|
||||
static int sum_(void* arg1, void* arg2)
|
||||
{
|
||||
int* pv = (int*)arg1;
|
||||
int x = (int)((long)arg2);
|
||||
|
||||
(*pv) += x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_zarray_iter(void) {
|
||||
static void test_zarray_iter(void)
|
||||
{
|
||||
zarray_t array;
|
||||
int i;
|
||||
int val = 0;
|
||||
int i;
|
||||
int val = 0;
|
||||
|
||||
zarray_init(&array, 10, NULL);
|
||||
for(i = 0; i < 10; i ++) {
|
||||
zarray_store(&array, (void *)(long)i);
|
||||
for (i = 0; i < 10; i++) {
|
||||
zarray_store(&array, (void*)(long)i);
|
||||
}
|
||||
|
||||
zarray_iter(&array, (zarray_iter_fn_t)sum_, &val);
|
||||
|
||||
TEST_ASSERT_TRUE(val == 45);
|
||||
|
||||
|
||||
zarray_fini(&(array));
|
||||
}
|
||||
void test_zarray(void) {
|
||||
void test_zarray(void)
|
||||
{
|
||||
printf("\n>> zarray test\n\n");
|
||||
|
||||
RUN_TEST(test_zarray_create);
|
||||
|
|
|
|||
11
src/lib/utils.c
Executable file → Normal file
11
src/lib/utils.c
Executable file → Normal file
|
|
@ -456,7 +456,7 @@ void free_resval_with_idx_list(xce_val_with_idx_t*** vals,
|
|||
if (val->val->which == Value_u_svalue) {
|
||||
FREEUP(val->val->u.svalue);
|
||||
}
|
||||
|
||||
|
||||
FREEUP(val->val);
|
||||
FREEUP(val);
|
||||
}
|
||||
|
|
@ -465,10 +465,11 @@ void free_resval_with_idx_list(xce_val_with_idx_t*** vals,
|
|||
*vals = NULL;
|
||||
}
|
||||
|
||||
void free_strlist(xce_strlist_t *l) {
|
||||
void free_strlist(xce_strlist_t* l)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( l == NULL) {
|
||||
|
||||
if (l == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -476,7 +477,7 @@ void free_strlist(xce_strlist_t *l) {
|
|||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < l->count; i ++) {
|
||||
for (i = 0; i < l->count; i++) {
|
||||
FREEUP(l->data[i]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ void vcpu_idle(vcpu_t* vcpu)
|
|||
|
||||
void run_task(vtask_t* task)
|
||||
{
|
||||
vtaskmgr_t *vtaskmgr;
|
||||
|
||||
vtaskmgr_t* vtaskmgr;
|
||||
|
||||
if (task->entry != NULL) {
|
||||
(task->entry)(task);
|
||||
}
|
||||
|
||||
endpoint_unblock_tasks(task->ctx.ep);
|
||||
vtaskmgr = (vtaskmgr_t *)task->owner;
|
||||
vtaskmgr = (vtaskmgr_t*)task->owner;
|
||||
if (vtaskmgr != NULL) {
|
||||
/* wake up dispatcher */
|
||||
vtaskmgr_wakeup(vtaskmgr);
|
||||
|
|
@ -209,14 +209,14 @@ static vcpu_t* pick_idle_vcpu(vtaskmgr_t* vtaskmgr)
|
|||
|
||||
TRACE("%s pick idle cpu #%d",
|
||||
__func__, i);
|
||||
|
||||
|
||||
return &(vtaskmgr->vcpus[i]);
|
||||
}
|
||||
|
||||
static int vtask_eligible(data_item_t* data)
|
||||
{
|
||||
vtask_t* task = ITPTR_TO_VTASK(data);
|
||||
int eligible = 0;
|
||||
vtask_t* task = ITPTR_TO_VTASK(data);
|
||||
int eligible = 0;
|
||||
|
||||
if (task->ctx.ep == NULL) {
|
||||
WARN("no endpoint for task 0x%p", task);
|
||||
|
|
@ -226,7 +226,7 @@ static int vtask_eligible(data_item_t* data)
|
|||
eligible = !(endpoint_is_task_blocked(task->ctx.ep));
|
||||
TRACE("%s vtask %p is %s",
|
||||
__func__, task,
|
||||
eligible?"eligible":"not eligible");
|
||||
eligible ? "eligible" : "not eligible");
|
||||
|
||||
return eligible;
|
||||
}
|
||||
|
|
@ -283,8 +283,7 @@ static void* vdispatcher_entry(void* arg)
|
|||
bind_vtask(task, vcpu);
|
||||
vcpu = NULL;
|
||||
task = NULL;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
vtaskmgr_wait(vtaskmgr);
|
||||
}
|
||||
}
|
||||
|
|
@ -308,13 +307,15 @@ int vtaskmgr_start(vtaskmgr_t* vtaskmgr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void vtaskmgr_wait(vtaskmgr_t *vtaskmgr) {
|
||||
void vtaskmgr_wait(vtaskmgr_t* vtaskmgr)
|
||||
{
|
||||
int dummy = 0;
|
||||
|
||||
|
||||
cbuf_get(&(vtaskmgr->wtbuf), &dummy);
|
||||
}
|
||||
|
||||
void vtaskmgr_wakeup(vtaskmgr_t *vtaskmgr) {
|
||||
void vtaskmgr_wakeup(vtaskmgr_t* vtaskmgr)
|
||||
{
|
||||
int dummy = 0;
|
||||
|
||||
cbuf_tryput(&(vtaskmgr->wtbuf), &dummy);
|
||||
|
|
@ -351,7 +352,7 @@ int vtask_enq(vtaskmgr_t* vtaskmgr,
|
|||
ioctx_ref(&(task->ctx));
|
||||
|
||||
rc = dataq_enq(&(vtaskmgr->taskq),
|
||||
&(task->ctx.link));
|
||||
&(task->ctx.link));
|
||||
if (rc >= 0) {
|
||||
/* wake up task dispatcher */
|
||||
task->owner = vtaskmgr;
|
||||
|
|
|
|||
|
|
@ -633,8 +633,8 @@ int xce_queuectrl(xce_ctx_t* ctx,
|
|||
return status;
|
||||
}
|
||||
|
||||
int xce_runtask(xce_ctx_t* ctx,
|
||||
xce_taskrun_t* runinfo)
|
||||
int xce_runtask(xce_ctx_t* ctx,
|
||||
xce_taskrun_t* runinfo)
|
||||
{
|
||||
ioctx_t* ioctx;
|
||||
int rc;
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ static int xlist_ensure(xlist_t* l)
|
|||
}
|
||||
|
||||
l->data = p;
|
||||
for(i = l->caps; i < nc; i ++) {
|
||||
l->data[i] = NULL;
|
||||
for (i = l->caps; i < nc; i++) {
|
||||
l->data[i] = NULL;
|
||||
}
|
||||
|
||||
|
||||
l->caps = nc;
|
||||
|
||||
return 1;
|
||||
|
|
@ -64,25 +64,27 @@ int xlist_store(xlist_t* l,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void xlist_clear(xlist_t *l) {
|
||||
void xlist_clear(xlist_t* l)
|
||||
{
|
||||
if (l == NULL) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
l->count = 0;
|
||||
}
|
||||
|
||||
int xlist_iter(xlist_t *l,
|
||||
xlist_iter_fn_t fn,
|
||||
void *data) {
|
||||
int xlist_iter(xlist_t* l,
|
||||
xlist_iter_fn_t fn,
|
||||
void* data)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if ((l == NULL) || (fn == NULL)) {
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for(i = 0; i < l->count; i ++) {
|
||||
(*fn)((void *)l->data[i], data);
|
||||
for (i = 0; i < l->count; i++) {
|
||||
(*fn)((void*)l->data[i], data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue