save works
This commit is contained in:
parent
b748e30d20
commit
f4b1ba4cd7
21 changed files with 373 additions and 324 deletions
|
|
@ -537,14 +537,14 @@ typedef struct {
|
|||
|
||||
static size_t job_datasize(va_list ap)
|
||||
{
|
||||
size_t sz = sizeof(xce_job_t);
|
||||
size_t sz = sizeof(job_t);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int job_init(meta_obj_t* obj, va_list ap)
|
||||
{
|
||||
xce_job_t* dst = RTTI_OBJ_TO_DATA(xce_job_t, obj);
|
||||
job_t* dst = RTTI_OBJ_TO_DATA(job_t, obj);
|
||||
job_private_t* priv = (job_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_job_t* src = va_arg(ap, xce_job_t*);
|
||||
|
||||
|
|
@ -552,22 +552,22 @@ static int job_init(meta_obj_t* obj, va_list ap)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
dst->jobid = src->jobid;
|
||||
dst->submit = makeJobsub(src->submit);
|
||||
dst->sub_time = src->sub_time;
|
||||
dst->queue_time = src->queue_time;
|
||||
dst->start_time = src->start_time;
|
||||
dst->finish_time = src->finish_time;
|
||||
MOVE_PTR(dst->pidinfo, src->pidinfo);
|
||||
dst->state = src->state;
|
||||
MOVE_PTR(dst->allocs, src->allocs);
|
||||
MOVE_PTR(dst->accounts, src->accounts);
|
||||
dst->run_time = src->run_time;
|
||||
MOVE_PTR(dst->run_usage, src->run_usage);
|
||||
MOVE_PTR(dst->exit_info, src->exit_info);
|
||||
dst->ckptinfo = makeString(src->ckptinfo);
|
||||
dst->pending_ctrl = src->pending_ctrl;
|
||||
MOVE_PTR(dst->pend_reasons, src->pend_reasons);
|
||||
dst->job.jobid = src->jobid;
|
||||
dst->job.submit = makeJobsub(src->submit);
|
||||
dst->job.sub_time = src->sub_time;
|
||||
dst->job.queue_time = src->queue_time;
|
||||
dst->job.start_time = src->start_time;
|
||||
dst->job.finish_time = src->finish_time;
|
||||
MOVE_PTR(dst->job.pidinfo, src->pidinfo);
|
||||
dst->job.state = src->state;
|
||||
MOVE_PTR(dst->job.allocs, src->allocs);
|
||||
MOVE_PTR(dst->job.accounts, src->accounts);
|
||||
dst->job.run_time = src->run_time;
|
||||
MOVE_PTR(dst->job.run_usage, src->run_usage);
|
||||
MOVE_PTR(dst->job.exit_info, src->exit_info);
|
||||
dst->job.ckptinfo = makeString(src->ckptinfo);
|
||||
dst->job.pending_ctrl = src->pending_ctrl;
|
||||
MOVE_PTR(dst->job.pend_reasons, src->pend_reasons);
|
||||
|
||||
my_rwlock_init(&(priv->lock));
|
||||
priv->refcount = 1;
|
||||
|
|
@ -577,24 +577,24 @@ static int job_init(meta_obj_t* obj, va_list ap)
|
|||
|
||||
static void job_destroy(meta_obj_t* obj)
|
||||
{
|
||||
xce_job_t* j = RTTI_OBJ_TO_DATA(xce_job_t, obj);
|
||||
job_t* j = RTTI_OBJ_TO_DATA(job_t, obj);
|
||||
job_private_t* priv = (job_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
|
||||
dereference(j->submit);
|
||||
dereference(j->ckptinfo);
|
||||
dereference(j->job.submit);
|
||||
dereference(j->job.ckptinfo);
|
||||
|
||||
/* FIXME: */
|
||||
if (j->pidinfo != NULL) { }
|
||||
if (j->job.pidinfo != NULL) { }
|
||||
|
||||
if (j->allocs != NULL) { }
|
||||
if (j->job.allocs != NULL) { }
|
||||
|
||||
if (j->accounts != NULL) { }
|
||||
if (j->job.accounts != NULL) { }
|
||||
|
||||
if (j->run_usage != NULL) { }
|
||||
if (j->job.run_usage != NULL) { }
|
||||
|
||||
if (j->exit_info != NULL) { }
|
||||
if (j->job.exit_info != NULL) { }
|
||||
|
||||
if (j->pend_reasons != NULL) { }
|
||||
if (j->job.pend_reasons != NULL) { }
|
||||
|
||||
my_rwlock_fini(&(priv->lock));
|
||||
memset(priv, 0x0, sizeof(*priv));
|
||||
|
|
@ -616,7 +616,7 @@ static int job_reference(meta_obj_t* obj)
|
|||
static void job_dereference(meta_obj_t* obj)
|
||||
{
|
||||
job_private_t* priv = (job_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_job_t* j = RTTI_OBJ_TO_DATA(xce_job_t, obj);
|
||||
job_t* j = RTTI_OBJ_TO_DATA(job_t, obj);
|
||||
uint64_t count;
|
||||
|
||||
my_rwlock_wlock(&(priv->lock));
|
||||
|
|
@ -674,9 +674,10 @@ static typeinfo_t job_type = {
|
|||
.unlock = (unlock_fn_t)job_unlock } }
|
||||
};
|
||||
|
||||
xce_job_t* makeJob(xce_job_t* j)
|
||||
job_t* makeJob(var jobmgr, xce_job_t* j)
|
||||
{
|
||||
xce_job_t* job = makeInstance(&job_type, j);
|
||||
job_t* job = makeInstance(&job_type, j);
|
||||
/* FIXME */
|
||||
return job;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ typedef struct {
|
|||
|
||||
static size_t queue_datasize(va_list ap)
|
||||
{
|
||||
size_t sz = sizeof(xce_queue_t);
|
||||
size_t sz = sizeof(queue_t);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int queue_init(meta_obj_t* obj, va_list ap)
|
||||
{
|
||||
xce_queue_t* dst = RTTI_OBJ_TO_DATA(xce_queue_t, obj);
|
||||
queue_t* dst = RTTI_OBJ_TO_DATA(queue_t, obj);
|
||||
queue_private_t* priv = (queue_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_queue_t* src = va_arg(ap, xce_queue_t*);
|
||||
|
||||
|
|
@ -31,26 +31,26 @@ static int queue_init(meta_obj_t* obj, va_list ap)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
dst->queue = makeString(src->queue);
|
||||
dst->attrs = src->attrs;
|
||||
dst->status = src->status;
|
||||
dst->priority = src->priority;
|
||||
dst->accept_interval = src->accept_interval;
|
||||
dst->sched_delay = src->sched_delay;
|
||||
dst->resreq = makeString(src->resreq);
|
||||
MOVE_PTR(dst->users, src->users);
|
||||
MOVE_PTR(dst->hosts, src->hosts);
|
||||
dst->nthresholds = src->nthresholds;
|
||||
MOVE_PTR(dst->thresholds, src->thresholds);
|
||||
dst->queue.queue = makeString(src->queue);
|
||||
dst->queue.attrs = src->attrs;
|
||||
dst->queue.status = src->status;
|
||||
dst->queue.priority = src->priority;
|
||||
dst->queue.accept_interval = src->accept_interval;
|
||||
dst->queue.sched_delay = src->sched_delay;
|
||||
dst->queue.resreq = makeString(src->resreq);
|
||||
MOVE_PTR(dst->queue.users, src->users);
|
||||
MOVE_PTR(dst->queue.hosts, src->hosts);
|
||||
dst->queue.nthresholds = src->nthresholds;
|
||||
MOVE_PTR(dst->queue.thresholds, src->thresholds);
|
||||
|
||||
MOVE_PTR(dst->runwindow, src->runwindow);
|
||||
MOVE_PTR(dst->dispatchwindow, src->dispatchwindow);
|
||||
MOVE_PTR(dst->runwindow_config, src->runwindow_config);
|
||||
MOVE_PTR(dst->dispatchwindow_config, src->dispatchwindow_config);
|
||||
dst->pending_ctrl = src->pending_ctrl;
|
||||
dst->pre_exec = makeString(src->pre_exec);
|
||||
dst->post_exec = makeString(src->post_exec);
|
||||
dst->autopscaler = makeString(src->autopscaler);
|
||||
MOVE_PTR(dst->queue.runwindow, src->runwindow);
|
||||
MOVE_PTR(dst->queue.dispatchwindow, src->dispatchwindow);
|
||||
MOVE_PTR(dst->queue.runwindow_config, src->runwindow_config);
|
||||
MOVE_PTR(dst->queue.dispatchwindow_config, src->dispatchwindow_config);
|
||||
dst->queue.pending_ctrl = src->pending_ctrl;
|
||||
dst->queue.pre_exec = makeString(src->pre_exec);
|
||||
dst->queue.post_exec = makeString(src->post_exec);
|
||||
dst->queue.autopscaler = makeString(src->autopscaler);
|
||||
|
||||
my_rwlock_init(&(priv->lock));
|
||||
priv->refcount = 1;
|
||||
|
|
@ -60,30 +60,30 @@ static int queue_init(meta_obj_t* obj, va_list ap)
|
|||
|
||||
static void queue_destroy(meta_obj_t* obj)
|
||||
{
|
||||
xce_queue_t* q = RTTI_OBJ_TO_DATA(xce_queue_t, obj);
|
||||
queue_t* q = RTTI_OBJ_TO_DATA(queue_t, obj);
|
||||
queue_private_t* priv = (queue_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
|
||||
dereference(q->queue);
|
||||
dereference(q->resreq);
|
||||
dereference(q->queue.queue);
|
||||
dereference(q->queue.resreq);
|
||||
|
||||
/* FIXME: */
|
||||
if (q->users != NULL) { }
|
||||
if (q->queue.users != NULL) { }
|
||||
|
||||
if (q->hosts != NULL) { }
|
||||
if (q->queue.hosts != NULL) { }
|
||||
|
||||
if (q->thresholds != NULL) { }
|
||||
if (q->queue.thresholds != NULL) { }
|
||||
|
||||
if (q->runwindow != NULL) { }
|
||||
if (q->queue.runwindow != NULL) { }
|
||||
|
||||
if (q->dispatchwindow != NULL) { }
|
||||
if (q->queue.dispatchwindow != NULL) { }
|
||||
|
||||
if (q->runwindow_config != NULL) { }
|
||||
if (q->queue.runwindow_config != NULL) { }
|
||||
|
||||
if (q->dispatchwindow_config != NULL) { }
|
||||
if (q->queue.dispatchwindow_config != NULL) { }
|
||||
|
||||
dereference(q->pre_exec);
|
||||
dereference(q->post_exec);
|
||||
dereference(q->autopscaler);
|
||||
dereference(q->queue.pre_exec);
|
||||
dereference(q->queue.post_exec);
|
||||
dereference(q->queue.autopscaler);
|
||||
|
||||
my_rwlock_fini(&(priv->lock));
|
||||
memset(priv, 0x0, sizeof(*priv));
|
||||
|
|
@ -163,8 +163,9 @@ static typeinfo_t queue_type = {
|
|||
.unlock = (unlock_fn_t)queue_unlock } }
|
||||
};
|
||||
|
||||
xce_queue_t* makeQueue(xce_queue_t* w)
|
||||
queue_t* makeQueue(var qmgr, xce_queue_t* w)
|
||||
{
|
||||
xce_queue_t* queue = makeInstance(&queue_type, w);
|
||||
/* FIMXE: */
|
||||
queue_t* queue = makeInstance(&queue_type, w);
|
||||
return queue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <unity/unity.h>
|
||||
|
||||
#include "jobj.h"
|
||||
#include "kvmgr.h"
|
||||
#include "utils.h"
|
||||
#include "xstring.h"
|
||||
|
||||
|
|
@ -206,6 +207,12 @@ static void test_jobsub_share(void)
|
|||
static void test_job_create(void)
|
||||
{
|
||||
int rc;
|
||||
kvmgr_params_t jobmgr_params = { .key_type = KVMGR_KEY_INT,
|
||||
.dynamic = 1,
|
||||
.nslots = 32,
|
||||
.delta = 32,
|
||||
.datakiller = destroy };
|
||||
var jobmgr;
|
||||
job_startinfo_t s1 = { .exechome = "/homes/rshen",
|
||||
.execcwd = "/tmp",
|
||||
.execuser = "rshen",
|
||||
|
|
@ -226,7 +233,7 @@ static void test_job_create(void)
|
|||
.job_description = "no description",
|
||||
.resreq = "type == any" };
|
||||
xce_job_t job1 = { .submit = &jobsub1 };
|
||||
xce_job_t* j2 = NULL;
|
||||
job_t* j2 = NULL;
|
||||
time_t now = time(NULL);
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
|
|
@ -249,31 +256,36 @@ static void test_job_create(void)
|
|||
job1.pending_ctrl = 0;
|
||||
job1.jobid = 100;
|
||||
|
||||
j2 = makeJob(&job1);
|
||||
jobmgr = makeInstance(&xkvmgr_type, &jobmgr_params);
|
||||
TEST_ASSERT_TRUE(jobmgr != NULL);
|
||||
|
||||
j2 = makeJob(jobmgr, &job1);
|
||||
|
||||
TEST_ASSERT_TRUE(j2 != NULL);
|
||||
|
||||
TEST_ASSERT_TRUE(
|
||||
EQUAL_STRING(s1.exechome, j2->submit->start_info->exechome)
|
||||
&& EQUAL_STRING(s1.execcwd, j2->submit->start_info->execcwd)
|
||||
&& EQUAL_STRING(s1.execuser, j2->submit->start_info->execuser)
|
||||
&& EQUAL_STRING(s1.cmdline, j2->submit->start_info->cmdline)
|
||||
&& EQUAL_STRING(s1.exdata, j2->submit->start_info->exdata)
|
||||
&& EQUAL_STRING(s1.q_pre_exec, j2->submit->start_info->q_pre_exec)
|
||||
&& EQUAL_STRING(s1.q_post_exec, j2->submit->start_info->q_post_exec)
|
||||
&& EQUAL_STRING(s1.job_pre_exec, j2->submit->start_info->job_pre_exec)
|
||||
&& EQUAL_STRING(s1.job_post_exec, j2->submit->start_info->job_post_exec)
|
||||
&& EQUAL_STRING(j2->submit->queue, "xce")
|
||||
&& EQUAL_STRING(j2->submit->user, "rshen")
|
||||
&& EQUAL_STRING(j2->submit->job_name, "J1")
|
||||
&& EQUAL_STRING(j2->submit->project_name, "default")
|
||||
&& EQUAL_STRING(j2->submit->job_description, "no description")
|
||||
&& EQUAL_STRING(j2->submit->resreq, "type == any")
|
||||
&& (j2->submit->mintasks == 1) && (j2->submit->maxtasks == 5)
|
||||
&& (j2->submit->user_group == NULL));
|
||||
EQUAL_STRING(s1.exechome, j2->job.submit->start_info->exechome)
|
||||
&& EQUAL_STRING(s1.execcwd, j2->job.submit->start_info->execcwd)
|
||||
&& EQUAL_STRING(s1.execuser, j2->job.submit->start_info->execuser)
|
||||
&& EQUAL_STRING(s1.cmdline, j2->job.submit->start_info->cmdline)
|
||||
&& EQUAL_STRING(s1.exdata, j2->job.submit->start_info->exdata)
|
||||
&& EQUAL_STRING(s1.q_pre_exec, j2->job.submit->start_info->q_pre_exec)
|
||||
&& EQUAL_STRING(s1.q_post_exec, j2->job.submit->start_info->q_post_exec)
|
||||
&& EQUAL_STRING(s1.job_pre_exec, j2->job.submit->start_info->job_pre_exec)
|
||||
&& EQUAL_STRING(s1.job_post_exec, j2->job.submit->start_info->job_post_exec)
|
||||
&& EQUAL_STRING(j2->job.submit->queue, "xce")
|
||||
&& EQUAL_STRING(j2->job.submit->user, "rshen")
|
||||
&& EQUAL_STRING(j2->job.submit->job_name, "J1")
|
||||
&& EQUAL_STRING(j2->job.submit->project_name, "default")
|
||||
&& EQUAL_STRING(j2->job.submit->job_description, "no description")
|
||||
&& EQUAL_STRING(j2->job.submit->resreq, "type == any")
|
||||
&& (j2->job.submit->mintasks == 1) && (j2->job.submit->maxtasks == 5)
|
||||
&& (j2->job.submit->user_group == NULL));
|
||||
|
||||
dereference(j2);
|
||||
|
||||
destroy(jobmgr);
|
||||
|
||||
job_obj_fini();
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,28 +2,40 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <rtti.h>
|
||||
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "qobj.h"
|
||||
#include "utils.h"
|
||||
#include "xstring.h"
|
||||
#include "kvmgr.h"
|
||||
|
||||
static void test_queue_create(void)
|
||||
{
|
||||
int rc;
|
||||
xce_queue_t q1 = { 0 };
|
||||
xce_queue_t* q = NULL;
|
||||
int rc;
|
||||
kvmgr_params_t params = { .key_type = KVMGR_KEY_STRING,
|
||||
.nslots = 32,
|
||||
.delta = 32,
|
||||
.datakiller = destroy };
|
||||
var qmgr;
|
||||
|
||||
xce_queue_t q1 = { 0 };
|
||||
queue_t* q = NULL;
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
TEST_ASSERT_TRUE(rc >= 0);
|
||||
|
||||
q = makeQueue(&q1);
|
||||
qmgr = makeInstance(&xkvmgr_type, ¶ms);
|
||||
TEST_ASSERT_TRUE(qmgr != NULL);
|
||||
|
||||
q = makeQueue(qmgr, &q1);
|
||||
|
||||
TEST_ASSERT_TRUE(q != NULL);
|
||||
|
||||
destroy(q);
|
||||
|
||||
destroy(qmgr);
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,41 +5,52 @@
|
|||
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "kvmgr.h"
|
||||
#include "utils.h"
|
||||
#include "wobj.h"
|
||||
#include "xstring.h"
|
||||
|
||||
static void test_worker_create(void)
|
||||
{
|
||||
int rc;
|
||||
hostattrs_t attrs1 = { .hosttype = "LINUX64",
|
||||
.hostmodel = "linux-gnu-x86_64",
|
||||
.cpufactor = 100.0,
|
||||
.maxcpus = 5,
|
||||
.maxmem = 65536.0,
|
||||
.maxswap = 65536.0,
|
||||
.maxtmp = 0.0,
|
||||
.ndisks = 2 };
|
||||
xce_worker_t w1 = {
|
||||
.name = "worker1",
|
||||
.attrs = &attrs1,
|
||||
int rc;
|
||||
kvmgr_params_t params = { .key_type = KVMGR_KEY_STRING,
|
||||
.nslots = 32,
|
||||
.delta = 32,
|
||||
.datakiller = destroy };
|
||||
var workermgr;
|
||||
hostattrs_t attrs1 = { .hosttype = "LINUX64",
|
||||
.hostmodel = "linux-gnu-x86_64",
|
||||
.cpufactor = 100.0,
|
||||
.maxcpus = 5,
|
||||
.maxmem = 65536.0,
|
||||
.maxswap = 65536.0,
|
||||
.maxtmp = 0.0,
|
||||
.ndisks = 2 };
|
||||
xce_worker_t w1 = {
|
||||
.name = "worker1",
|
||||
.attrs = &attrs1,
|
||||
};
|
||||
xce_worker_t* w = NULL;
|
||||
worker_t* w = NULL;
|
||||
|
||||
rc = xstring_table_init(32);
|
||||
TEST_ASSERT_TRUE(rc >= 0);
|
||||
|
||||
w = makeWorker(&w1);
|
||||
workermgr = makeInstance(&xkvmgr_type, ¶ms);
|
||||
TEST_ASSERT_TRUE(workermgr != NULL);
|
||||
|
||||
w = makeWorker(workermgr, &w1);
|
||||
|
||||
TEST_ASSERT_TRUE(w != NULL);
|
||||
TEST_ASSERT_TRUE(EQUAL_STRING(w->name, w1.name)
|
||||
&& EQUAL_STRING(w->attrs->hosttype, attrs1.hosttype)
|
||||
&& EQUAL_STRING(w->attrs->hostmodel, attrs1.hostmodel)
|
||||
&& (w->attrs->cpufactor == attrs1.cpufactor)
|
||||
&& (w->attrs->maxcpus == attrs1.maxcpus));
|
||||
TEST_ASSERT_TRUE(EQUAL_STRING(w->host.name, w1.name)
|
||||
&& EQUAL_STRING(w->host.attrs->hosttype, attrs1.hosttype)
|
||||
&& EQUAL_STRING(w->host.attrs->hostmodel, attrs1.hostmodel)
|
||||
&& (w->host.attrs->cpufactor == attrs1.cpufactor)
|
||||
&& (w->host.attrs->maxcpus == attrs1.maxcpus));
|
||||
|
||||
dereference(w);
|
||||
|
||||
destroy(workermgr);
|
||||
|
||||
xstring_table_fini();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ typedef struct {
|
|||
|
||||
static size_t worker_datasize(va_list ap)
|
||||
{
|
||||
size_t sz = sizeof(xce_worker_t);
|
||||
size_t sz = sizeof(worker_t);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int worker_init(meta_obj_t* obj, va_list ap)
|
||||
{
|
||||
xce_worker_t* dst = RTTI_OBJ_TO_DATA(xce_worker_t, obj);
|
||||
worker_t* dst = RTTI_OBJ_TO_DATA(worker_t, obj);
|
||||
worker_private_t* priv = (worker_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_worker_t* src = va_arg(ap, xce_worker_t*);
|
||||
|
||||
|
|
@ -31,28 +31,28 @@ static int worker_init(meta_obj_t* obj, va_list ap)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
dst->name = makeString(src->name);
|
||||
dst->attrs = (hostattrs_t*)calloc(1, sizeof(hostattrs_t));
|
||||
if (dst->attrs == NULL) {
|
||||
dst->host.name = makeString(src->name);
|
||||
dst->host.attrs = (hostattrs_t*)calloc(1, sizeof(hostattrs_t));
|
||||
if (dst->host.attrs == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(dst->attrs, src->attrs, sizeof(*(dst->attrs)));
|
||||
memcpy(dst->host.attrs, src->attrs, sizeof(*(dst->host.attrs)));
|
||||
|
||||
dst->attrs->hosttype = makeString(src->attrs->hosttype);
|
||||
dst->attrs->hostmodel = makeString(src->attrs->hostmodel);
|
||||
dst->status = src->status;
|
||||
dst->host.attrs->hosttype = makeString(src->attrs->hosttype);
|
||||
dst->host.attrs->hostmodel = makeString(src->attrs->hostmodel);
|
||||
dst->host.status = src->status;
|
||||
|
||||
/* FIXME: */
|
||||
zarray_init(&(dst->resvals), 64, NULL);
|
||||
zarray_init(&(dst->host.resvals), 64, NULL);
|
||||
|
||||
dst->dead_since = src->dead_since;
|
||||
dst->pending_ctrl = src->pending_ctrl;
|
||||
MOVE_PTR(dst->dispatch_window_config, src->dispatch_window_config);
|
||||
dst->nthresholds = src->nthresholds;
|
||||
MOVE_PTR(dst->thresholds, src->thresholds);
|
||||
dst->nresvals_to_sched = 0;
|
||||
dst->resvals_to_sched = NULL;
|
||||
dst->host.dead_since = src->dead_since;
|
||||
dst->host.pending_ctrl = src->pending_ctrl;
|
||||
MOVE_PTR(dst->host.dispatch_window_config, src->dispatch_window_config);
|
||||
dst->host.nthresholds = src->nthresholds;
|
||||
MOVE_PTR(dst->host.thresholds, src->thresholds);
|
||||
dst->host.nresvals_to_sched = 0;
|
||||
dst->host.resvals_to_sched = NULL;
|
||||
|
||||
my_rwlock_init(&(priv->lock));
|
||||
priv->refcount = 1;
|
||||
|
|
@ -62,24 +62,24 @@ static int worker_init(meta_obj_t* obj, va_list ap)
|
|||
|
||||
static void worker_destroy(meta_obj_t* obj)
|
||||
{
|
||||
xce_worker_t* w = RTTI_OBJ_TO_DATA(xce_worker_t, obj);
|
||||
worker_t* w = RTTI_OBJ_TO_DATA(worker_t, obj);
|
||||
worker_private_t* priv = (worker_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
|
||||
dereference(w->name);
|
||||
dereference(w->host.name);
|
||||
|
||||
if (w->attrs != NULL) {
|
||||
dereference(w->attrs->hosttype);
|
||||
dereference(w->attrs->hostmodel);
|
||||
FREEUP(w->attrs);
|
||||
if (w->host.attrs != NULL) {
|
||||
dereference(w->host.attrs->hosttype);
|
||||
dereference(w->host.attrs->hostmodel);
|
||||
FREEUP(w->host.attrs);
|
||||
}
|
||||
|
||||
if (w->dispatch_window_config != NULL) { }
|
||||
if (w->host.dispatch_window_config != NULL) { }
|
||||
|
||||
if (w->thresholds != NULL) { }
|
||||
if (w->host.thresholds != NULL) { }
|
||||
|
||||
if (w->resvals_to_sched != NULL) { }
|
||||
if (w->host.resvals_to_sched != NULL) { }
|
||||
|
||||
zarray_fini(&(w->resvals));
|
||||
zarray_fini(&(w->host.resvals));
|
||||
|
||||
my_rwlock_fini(&(priv->lock));
|
||||
memset(priv, 0x0, sizeof(*priv));
|
||||
|
|
@ -101,7 +101,7 @@ static int worker_reference(meta_obj_t* obj)
|
|||
static void worker_dereference(meta_obj_t* obj)
|
||||
{
|
||||
worker_private_t* priv = (worker_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_worker_t* w = RTTI_OBJ_TO_DATA(xce_worker_t, obj);
|
||||
worker_t* w = RTTI_OBJ_TO_DATA(worker_t, obj);
|
||||
uint64_t count = 0;
|
||||
|
||||
my_rwlock_wlock(&(priv->lock));
|
||||
|
|
@ -159,8 +159,9 @@ static typeinfo_t worker_type = {
|
|||
.unlock = (unlock_fn_t)worker_unlock } }
|
||||
};
|
||||
|
||||
xce_worker_t* makeWorker(xce_worker_t* w)
|
||||
worker_t* makeWorker(var workermgr, xce_worker_t* w)
|
||||
{
|
||||
xce_worker_t* worker = makeInstance(&worker_type, w);
|
||||
worker_t* worker = makeInstance(&worker_type, w);
|
||||
/* fIXME */
|
||||
return worker;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue