forked from lei.chen/myxce
reformat code and job array
This commit is contained in:
parent
a665ccd4fe
commit
9ff857db9f
64 changed files with 1497 additions and 2476 deletions
|
|
@ -34,8 +34,7 @@ int not_null_check(void* arg)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int collect_resval_with_idx_(zarray_t* array,
|
||||
int* nres,
|
||||
static int collect_resval_with_idx_(zarray_t* array, int* nres,
|
||||
xce_val_with_idx_t*** resvals)
|
||||
{
|
||||
int nc;
|
||||
|
|
@ -97,8 +96,7 @@ static int collect_resval_with_idx_(zarray_t* array,
|
|||
val->val->u.svalue = strdup("-");
|
||||
}
|
||||
} else {
|
||||
memcpy(val->val, array->data[i],
|
||||
sizeof(xce_val_t));
|
||||
memcpy(val->val, array->data[i], sizeof(xce_val_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,8 +105,7 @@ static int collect_resval_with_idx_(zarray_t* array,
|
|||
return j;
|
||||
}
|
||||
|
||||
int collect_resval_with_idx(zarray_t* array,
|
||||
int* nres,
|
||||
int collect_resval_with_idx(zarray_t* array, int* nres,
|
||||
xce_val_with_idx_t*** resvals)
|
||||
{
|
||||
int rc = 0;
|
||||
|
|
@ -121,8 +118,7 @@ int collect_resval_with_idx(zarray_t* array,
|
|||
|
||||
return rc;
|
||||
}
|
||||
static int count_(void* arg1,
|
||||
void* arg2)
|
||||
static int count_(void* arg1, void* arg2)
|
||||
{
|
||||
struct intern_array_* arg = (struct intern_array_*)arg1;
|
||||
|
||||
|
|
@ -139,8 +135,7 @@ static int count_(void* arg1,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int add_confvar_(void* arg1,
|
||||
void* arg2)
|
||||
static int add_confvar_(void* arg1, void* arg2)
|
||||
{
|
||||
struct intern_array_* arg = (struct intern_array_*)arg1;
|
||||
xce_config_t** p = NULL;
|
||||
|
|
@ -159,8 +154,7 @@ static int add_confvar_(void* arg1,
|
|||
|
||||
p = (xce_config_t**)arg->data;
|
||||
if (p == NULL) {
|
||||
p = (xce_config_t**)calloc(arg->count,
|
||||
sizeof(xce_config_t*));
|
||||
p = (xce_config_t**)calloc(arg->count, sizeof(xce_config_t*));
|
||||
if (p == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -174,18 +168,15 @@ static int add_confvar_(void* arg1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void collect_confvars(cluster_t* c,
|
||||
collect_check_fn_t fn,
|
||||
int* nconfig,
|
||||
xce_config_t*** configs)
|
||||
void collect_confvars(cluster_t* c, collect_check_fn_t fn, int* nconfig,
|
||||
xce_config_t*** configs)
|
||||
{
|
||||
xlist_t lst;
|
||||
struct intern_array_ args = {
|
||||
.count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (fn == NULL) ? not_null_check : fn
|
||||
};
|
||||
struct intern_array_ args
|
||||
= { .count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (fn == NULL) ? not_null_check : fn };
|
||||
int rc;
|
||||
|
||||
*nconfig = 0;
|
||||
|
|
@ -205,8 +196,7 @@ void collect_confvars(cluster_t* c,
|
|||
}
|
||||
}
|
||||
|
||||
static int add_queue_(void* arg1,
|
||||
void* arg2)
|
||||
static int add_queue_(void* arg1, void* arg2)
|
||||
{
|
||||
struct intern_array_* arg = (struct intern_array_*)arg1;
|
||||
xce_queue_t** p = NULL;
|
||||
|
|
@ -229,8 +219,7 @@ static int add_queue_(void* arg1,
|
|||
|
||||
p = (xce_queue_t**)arg->data;
|
||||
if (p == NULL) {
|
||||
p = (xce_queue_t**)calloc(arg->count,
|
||||
sizeof(xce_queue_t*));
|
||||
p = (xce_queue_t**)calloc(arg->count, sizeof(xce_queue_t*));
|
||||
if (p == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -244,18 +233,15 @@ static int add_queue_(void* arg1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void collect_queues(cluster_t* c,
|
||||
collect_check_fn_t fn,
|
||||
int* nqueues,
|
||||
xce_queue_t*** queues)
|
||||
void collect_queues(cluster_t* c, collect_check_fn_t fn, int* nqueues,
|
||||
xce_queue_t*** queues)
|
||||
{
|
||||
xlist_t lst;
|
||||
struct intern_array_ args = {
|
||||
.count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (fn == NULL) ? not_null_check : fn
|
||||
};
|
||||
struct intern_array_ args
|
||||
= { .count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (fn == NULL) ? not_null_check : fn };
|
||||
int rc;
|
||||
|
||||
*nqueues = 0;
|
||||
|
|
@ -275,8 +261,7 @@ void collect_queues(cluster_t* c,
|
|||
}
|
||||
}
|
||||
|
||||
static int add_resource_(void* arg1,
|
||||
void* arg2)
|
||||
static int add_resource_(void* arg1, void* arg2)
|
||||
{
|
||||
struct intern_array_* arg = (struct intern_array_*)arg1;
|
||||
xce_resource_t** p = NULL;
|
||||
|
|
@ -299,8 +284,7 @@ static int add_resource_(void* arg1,
|
|||
|
||||
p = (xce_resource_t**)arg->data;
|
||||
if (p == NULL) {
|
||||
p = (xce_resource_t**)calloc(arg->count,
|
||||
sizeof(xce_resource_t*));
|
||||
p = (xce_resource_t**)calloc(arg->count, sizeof(xce_resource_t*));
|
||||
if (p == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
@ -315,18 +299,15 @@ static int add_resource_(void* arg1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void collect_resources(cluster_t* c,
|
||||
collect_check_fn_t fn,
|
||||
int* nresources,
|
||||
xce_resource_t*** resources)
|
||||
void collect_resources(cluster_t* c, collect_check_fn_t fn, int* nresources,
|
||||
xce_resource_t*** resources)
|
||||
{
|
||||
xlist_t lst;
|
||||
struct intern_array_ args = {
|
||||
.count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (fn == NULL) ? not_null_check : fn
|
||||
};
|
||||
struct intern_array_ args
|
||||
= { .count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (fn == NULL) ? not_null_check : fn };
|
||||
int rc;
|
||||
|
||||
*nresources = 0;
|
||||
|
|
@ -346,8 +327,7 @@ void collect_resources(cluster_t* c,
|
|||
}
|
||||
}
|
||||
|
||||
static int add_job_(void* arg1,
|
||||
void* arg2)
|
||||
static int add_job_(void* arg1, void* arg2)
|
||||
{
|
||||
struct intern_array_* arg = (struct intern_array_*)arg1;
|
||||
xce_job_t** p = NULL;
|
||||
|
|
@ -384,18 +364,12 @@ static int add_job_(void* arg1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void collect_jobs(cluster_t* c,
|
||||
collect_check_fn_t fn,
|
||||
int* njobs,
|
||||
xce_job_t*** jobs)
|
||||
void collect_jobs(cluster_t* c, collect_check_fn_t fn, int* njobs,
|
||||
xce_job_t*** jobs)
|
||||
{
|
||||
xlist_t lst;
|
||||
struct intern_array_ args = {
|
||||
.count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (check_fn_t)fn
|
||||
};
|
||||
struct intern_array_ args
|
||||
= { .count = 0, .idx = 0, .data = NULL, .checkfn = (check_fn_t)fn };
|
||||
int rc = 0;
|
||||
|
||||
*njobs = 0;
|
||||
|
|
@ -416,8 +390,7 @@ void collect_jobs(cluster_t* c,
|
|||
return;
|
||||
}
|
||||
|
||||
static int add_worker_(void* arg1,
|
||||
void* arg2)
|
||||
static int add_worker_(void* arg1, void* arg2)
|
||||
{
|
||||
struct intern_array_* arg = (struct intern_array_*)arg1;
|
||||
xce_worker_t** p = NULL;
|
||||
|
|
@ -451,8 +424,7 @@ static int add_worker_(void* arg1,
|
|||
|
||||
w = (xce_worker_t*)obj_ref(arg2, OBJREF_READ);
|
||||
|
||||
collect_resval_with_idx(&(w->resvals),
|
||||
&(w->nresvals_to_sched),
|
||||
collect_resval_with_idx(&(w->resvals), &(w->nresvals_to_sched),
|
||||
&(w->resvals_to_sched));
|
||||
|
||||
p[arg->idx] = w;
|
||||
|
|
@ -461,18 +433,12 @@ static int add_worker_(void* arg1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void collect_workers(cluster_t* c,
|
||||
collect_check_fn_t fn,
|
||||
int* nworkers,
|
||||
xce_worker_t*** workers)
|
||||
void collect_workers(cluster_t* c, collect_check_fn_t fn, int* nworkers,
|
||||
xce_worker_t*** workers)
|
||||
{
|
||||
xlist_t lst;
|
||||
struct intern_array_ args = {
|
||||
.count = 0,
|
||||
.idx = 0,
|
||||
.data = NULL,
|
||||
.checkfn = (check_fn_t)fn
|
||||
};
|
||||
struct intern_array_ args
|
||||
= { .count = 0, .idx = 0, .data = NULL, .checkfn = (check_fn_t)fn };
|
||||
int rc = 0;
|
||||
|
||||
*nworkers = 0;
|
||||
|
|
@ -494,20 +460,16 @@ void collect_workers(cluster_t* c,
|
|||
return;
|
||||
}
|
||||
|
||||
void collect_shared_resvals(cluster_t* c,
|
||||
collect_check_fn_t fn,
|
||||
int* nres,
|
||||
void collect_shared_resvals(cluster_t* c, collect_check_fn_t fn, int* nres,
|
||||
xce_val_with_idx_t*** resvals)
|
||||
{
|
||||
|
||||
collect_resval_with_idx(&(c->resmgr.sharedinst),
|
||||
nres, resvals);
|
||||
collect_resval_with_idx(&(c->resmgr.sharedinst), nres, resvals);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void deref_objs(int count,
|
||||
void** objs)
|
||||
void deref_objs(int count, void** objs)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -522,9 +484,7 @@ void deref_objs(int count,
|
|||
}
|
||||
}
|
||||
|
||||
int notify(cluster_t* c,
|
||||
endpoint_t* ep,
|
||||
xce_notify_data_t* data)
|
||||
int notify(cluster_t* c, endpoint_t* ep, xce_notify_data_t* data)
|
||||
{
|
||||
ioctx_t* ctx = NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue